<?php

namespace App\User\Action\Input;

use App\User\Action\Command\SaveUserDownloadPreferencesCommand;
use OneToMany\RichBundle\Attribute\SourceRequest;
use OneToMany\RichBundle\Attribute\SourceSecurity;
use OneToMany\RichBundle\Contract\CommandInterface as C;
use OneToMany\RichBundle\Contract\InputInterface;

/** @implements InputInterface<SaveUserDownloadPreferencesInput, SaveUserDownloadPreferencesCommand> */
class SaveUserDownloadPreferencesInput implements InputInterface
{
    public function __construct(
        #[SourceSecurity]
        public mixed $userId,

        #[SourceRequest('movie_folder', nullify: true)]
        public bool $movieFolder,
    ) {}

    public function toCommand(): C
    {
        return new SaveUserDownloadPreferencesCommand(
            $this->movieFolder,
        );
    }
}
