<?php

namespace App\Modules\RoomPassenger\Application\Delete;

use App\Modules\RoomPassenger\Domain\IdRoomPassenger;
use App\Modules\RoomPassenger\Domain\RoomPassengerRepository;
use App\Modules\Shared\Domain\Bus\Query\QueryHandler;

final class DeleteRoomPassengerQueryHandler implements QueryHandler
{
    public function __construct(
        private RoomPassengerDeleter $deleter,
        private RoomPassengerRepository $repository
    ) {}

    public function __invoke(DeleteRoomPassengerQuery $query): DeleteRoomPassengerResponse
    {
        $this->deleter->__invoke(new IdRoomPassenger($query->idRoomPassenger()), true);
        return new DeleteRoomPassengerResponse();
    }
}
