<?php

namespace App\Library\Action\Input;

use App\Library\Action\Command\DeleteMediaFileCommand;
use OneToMany\RichBundle\Attribute\SourceRequest;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\InputInterface;

/**
 * @implements InputInterface<DeleteMediaFileInput,DeleteMediaFileCommand>
 */
class DeleteMediaFileInput implements InputInterface
{
    public function __construct(
        #[SourceRequest('filename')]
        public string $filename,
        #[SourceRequest('downloadId', nullify: true)]
        public ?int $downloadId = null,
    ) {}

    public function toCommand(): CommandInterface
    {
        return new DeleteMediaFileCommand(
            $this->filename,
            $this->downloadId,
        );
    }
}
