<?php

namespace App\Modules\Template\TourTemplate\Application\Delete;

use App\Modules\Template\TourTemplate\Domain\IdTourTemplate;
use App\Modules\Template\TourTemplate\Domain\TourTemplateRepository;
use App\Modules\Shared\Domain\Bus\Query\QueryHandler;

final class DeleteTourTemplateQueryHandler implements QueryHandler
{
    public function __construct(
        private TourTemplateDeleter $deleter,
        private TourTemplateRepository $repository
    ) {}

    public function __invoke(DeleteTourTemplateQuery $query): DeleteTourTemplateResponse
    {
        $this->deleter->__invoke(new IdTourTemplate($query->idTourTemplate()), true);
        return new DeleteTourTemplateResponse();
    }
}
