<?php

namespace App\Modules\PaxInformation\Application\Insert;

use App\Modules\Admin\Domain\IdAdmin;
use App\Modules\Booking\Domain\IdBooking;
use App\Modules\PaxInformation\Application\Insert\PaxInformationInsert;
use App\Modules\PaxInformation\Application\Insert\PaxInformationInsertCommand;
use App\Modules\PaxInformation\Domain\PaxInformationDateExpire;
use App\Modules\PaxInformation\Domain\PaxInformationDescription;
use App\Modules\PaxInformation\Domain\PaxInformationLock;
use App\Modules\PaxInformation\Domain\PaxInformationRemaining;
use App\Modules\PaxInformation\Domain\PaxInformationShowAllPassenger;
use App\Modules\PaxInformation\Domain\PaxInformationShowHotels;
use App\Modules\PaxInformation\Domain\PaxInformationStatus;

final class PaxInformationInsertHandler
{

    private PaxInformationInsert $paxInformationInsert;


    public function __construct(
        PaxInformationInsert $action
    ) {
        $this->paxInformationInsert = $action;
    }

    public function __invoke(PaxInformationInsertCommand $query): array
    {
        $description = new PaxInformationDescription($query->description());
        $remaining = new PaxInformationRemaining($query->remaining());
        $expire = new PaxInformationDateExpire($query->expire());
        $showHotels = new PaxInformationShowHotels($query->showHotels());
        $showAllPassenger = new PaxInformationShowAllPassenger($query->showAllPassenger());
        $lock = new PaxInformationLock($query->lock());
        $status = new PaxInformationStatus($query->status());
        $idBooking = new IdBooking($query->idBooking());
        $idAdmin = new IdAdmin($query->idAdmin());

        $response = $this->paxInformationInsert->__invoke(
            $description,
            $remaining,
            $expire,
            $showHotels,
            $showAllPassenger,
            $lock,
            $status,
            $idBooking,
            $idAdmin
        );
        return $response;
    }
}
