<?php

namespace App\User\Action\Input;

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

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

        #[SourceRequest('resolution')]
        public string $resolution,

        #[SourceRequest('quality')]
        public string $quality,

        #[SourceRequest('codec')]
        public string $codec,

        #[SourceRequest('language')]
        public string $language,

        #[SourceRequest('provider')]
        public string $provider,
    ) {}

    public function toCommand(): C
    {
        return new SaveUserMediaPreferencesCommand(
            $this->resolution,
            $this->codec,
            $this->quality,
            $this->language,
            $this->provider,
        );
    }
}
