<?php

namespace App\Modules\Booking\Application\FindIdFrom;

use App\Modules\Booking\Application\Find\BookingNotFound;
use App\Modules\Booking\Domain\BookingCode;
use App\Modules\Shared\Domain\Bus\Query\QueryHandler;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class BookingFindIdFromQueryHandler implements QueryHandler
{

    public function __construct(
        private BookingFromIdFinder $bookingFinder
    ) {}

    public function __invoke(BookingFindIdFromQuery $query)
    {
        $booking = $this->bookingFinder->__invoke($query->id, $query->type);
        return new BookingFindIdFromQueryResponse(
            $booking->Id_Booking,
        );
    }
}
