37 lines
982 B
PHP
37 lines
982 B
PHP
<?php
|
|
|
|
namespace App\Download\Action\Input;
|
|
|
|
use App\Download\Action\Command\DownloadMediaCommand;
|
|
use App\Download\Action\Command\DownloadSeasonCommand;
|
|
use OneToMany\RichBundle\Attribute\SourceRequest;
|
|
use OneToMany\RichBundle\Attribute\SourceRoute;
|
|
use OneToMany\RichBundle\Contract\CommandInterface;
|
|
use OneToMany\RichBundle\Contract\InputInterface;
|
|
|
|
/** @implements InputInterface<DownloadSeasonInput> */
|
|
class DownloadSeasonInput implements InputInterface
|
|
{
|
|
public function __construct(
|
|
#[SourceRoute('imdbId')]
|
|
public string $imdbId,
|
|
|
|
#[SourceRoute('season')]
|
|
public int $season,
|
|
|
|
#[SourceRequest('mediaType')]
|
|
public string $mediaType = 'tvshows',
|
|
|
|
public ?int $userId = null,
|
|
) {}
|
|
|
|
public function toCommand(): CommandInterface
|
|
{
|
|
return new DownloadSeasonCommand(
|
|
$this->userId,
|
|
$this->season,
|
|
$this->imdbId,
|
|
$this->mediaType,
|
|
);
|
|
}
|
|
} |