<?php
declare (strict_types=1);

namespace App\ApiResources\Core\File;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\State\Provider\Core\DownloadRequestProvider;

/**
 * A request for a file from the LocalStorage
 */
#[ApiResource(
    operations: [
        new Get(
            uriTemplate: '/download/{fileId}',
            requirements: ['fileId' => '\\d+'],
            security: 'is_granted("ROLE_FILE")',
            provider: DownloadRequestProvider::class
        ),
        new Get(
            uriTemplate: '/internal/download/{fileId}',
            requirements: ['fileId' => '\\d+'],
            provider: DownloadRequestProvider::class
        )
    ]
)]
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;
    }
}
