<?php

namespace App\Search\Action\Input;

use App\Search\Action\Command\SearchCommand;
use OneToMany\RichBundle\Attribute\SourceQuery;
use OneToMany\RichBundle\Attribute\SourceRequest;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\InputInterface;

/** @implements InputInterface<SearchCommand> */
class SearchInput implements InputInterface
{
    public function __construct(
        #[SourceQuery('term')]
        #[SourceRequest('term')]
        public string $term
    ){}

    public function toCommand(): CommandInterface
    {
        return new SearchCommand($this->term);
    }
}
