<?php

namespace App\Download\Action\Input;

use App\Download\Action\Command\DeleteDownloadCommand;
use OneToMany\RichBundle\Attribute\SourceQuery;
use OneToMany\RichBundle\Attribute\SourceRoute;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\InputInterface;

/** @implements InputInterface<DeleteDownloadInput> */
class DeleteDownloadInput implements InputInterface
{
    public function __construct(
        #[SourceRoute('downloadId')]
        public int $downloadId,
        #[SourceQuery('deleteFile')]
        public bool $deleteFile = false,
    ) {}

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