<?php

namespace App\Modules\Room\Application\Delete;

use App\Modules\Room\Domain\IdRoom;
use App\Modules\Room\Domain\RoomRepository;
use App\Modules\Shared\Domain\Bus\Query\QueryHandler;

final class DeleteRoomQueryHandler implements QueryHandler
{
    public function __construct(
        private RoomDeleter $deleter,
        private RoomRepository $repository
    ) {}

    public function __invoke(DeleteRoomQuery $query): DeleteRoomResponse
    {
        $this->deleter->__invoke(new IdRoom($query->idRoom()), true);
        return new DeleteRoomResponse();
    }
}
