<?php

namespace App\Modules\DefinedService\TypeDefinedService\Application\Delete;

use App\Modules\DefinedService\TypeDefinedService\Domain\IdTypeDefinedService;
use App\Modules\DefinedService\TypeDefinedService\Domain\TypeDefinedServiceRepository;
use App\Modules\Shared\Domain\Bus\Query\QueryHandler;

final class DeleteTypeDefinedServiceQueryHandler implements QueryHandler
{
    public function __construct(
        private TypeDefinedServiceDeleter $deleter,
        private TypeDefinedServiceRepository $repository
    ) {}

    public function __invoke(DeleteTypeDefinedServiceQuery $query): DeleteTypeDefinedServiceResponse
    {
        $this->deleter->__invoke(new IdTypeDefinedService($query->idTypeDefinedService()), true);
        return new DeleteTypeDefinedServiceResponse();
    }
}
