<?php
declare(strict_types=1);

namespace App\ApiResources;

use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;

/**
 * A request for a file from the LocalStorage
 */
#[ApiResource(
    collectionOperations:[],
    itemOperations: [
        'get' => [
            'security' => 'is_granted("ROLE_FILE")',
            'method' => 'GET',
            'path' => '/download/{fileId}',
            'requirements' => ['fileId' => '\d+']
        ],
    ],
    compositeIdentifier: false,
)]
class DownloadRequest
{
    #[ApiProperty(identifier: true)]
    private int $fileId;

    /**
     * @return int
     */
    public function getFileId(): int
    {
        return $this->fileId;
    }

    /**
     * @param int $fileId
     */
    public function setFileId(int $fileId): void
    {
        $this->fileId = $fileId;
    }
}
