<?php

namespace App\User\Action\Input;

use App\User\Action\Command\SaveUserCalendarPreferencesCommand;
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 SaveUserCalendarPreferencesInput implements InputInterface
{
    public function __construct(
        #[SourceSecurity]
        public mixed $userId,

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

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