<?php

declare(strict_types=1);

namespace App\ApiResource;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\QueryParameter;
use App\State\AuditLogProvider;

#[ApiResource(
    operations: [
        new GetCollection(
            uriTemplate: '/audit-logs',
            provider: AuditLogProvider::class,
            parameters: [
                new QueryParameter(key: 'employeeId'),
                new QueryParameter(key: 'employee'),
                new QueryParameter(key: 'from'),
                new QueryParameter(key: 'to'),
                new QueryParameter(key: 'entityType'),
                new QueryParameter(key: 'action'),
                new QueryParameter(key: 'username'),
                new QueryParameter(key: 'ip'),
                new QueryParameter(key: 'device'),
                new QueryParameter(key: 'page'),
                new QueryParameter(key: 'perPage'),
            ],
            security: "is_granted('ROLE_SUPER_ADMIN')"
        ),
    ]
)]
final class AuditLogResource {}
