<?php

namespace App\Modules\LodgingPlace\Application\Delete;

use App\Modules\LodgingPlace\Domain\IdLodgingPlace;
use App\Modules\LodgingPlace\Domain\LodgingPlaceRepository;
use App\Modules\Shared\Domain\Bus\Query\QueryHandler;

final class DeleteLodgingPlaceQueryHandler implements QueryHandler
{
    public function __construct(
        private LodgingPlaceDeleter $deleter,
        private LodgingPlaceRepository $repository
    ) {}

    public function __invoke(DeleteLodgingPlaceQuery $query): DeleteLodgingPlaceResponse
    {
        $this->deleter->__invoke(new IdLodgingPlace($query->idLodgingPlace()), true);
        return new DeleteLodgingPlaceResponse();
    }
}
