<?php

namespace App\Modules\RoomPassenger\Application\Update;

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

final class UpdateRoomPassengerQueryHandler implements QueryHandler
{
    public function __construct(private RoomPassengerUpdater $updater) {}

    public function __invoke(UpdateRoomPassengerQuery $query): UpdateRoomPassengerResponse
    {
        $this->updater->__invoke(
            new IdRoomPassenger($query->id()),
            new RoomPassengerVersion($query->version()),
            new RoomPassengerStatus($query->status()),
            $query->idAdmin()
        );
        return new UpdateRoomPassengerResponse();
    }
}
