<?php

namespace App\Modules\PaxInformationRoomPassenger\Application\Update;

use App\Modules\PaxInformationRoomPassenger\Domain\IdPaxInformationRoomPassenger;
use App\Modules\PaxInformationRoomPassenger\Domain\PaxInformationRoomPassengerStatus;
use App\Modules\PaxInformationRoomPassenger\Domain\PaxInformationRoomPassengerVersion;
use App\Modules\Shared\Domain\Bus\Query\QueryHandler;

final class UpdatePaxInformationRoomPassengerQueryHandler implements QueryHandler
{
    public function __construct(private PaxInformationRoomPassengerUpdater $updater) {}

    public function __invoke(UpdatePaxInformationRoomPassengerQuery $query): UpdatePaxInformationRoomPassengerResponse
    {
        $this->updater->__invoke(
            new IdPaxInformationRoomPassenger($query->id()),
            new PaxInformationRoomPassengerVersion($query->version()),
            new PaxInformationRoomPassengerStatus($query->status()),
            $query->idAdmin()
        );
        return new UpdatePaxInformationRoomPassengerResponse();
    }
}
