<?php

namespace App\Http\Controllers\PaxInformationLink\PaxInformationRoomPassenger;

use App\Http\Controllers\Controller;
use App\Http\Helpers\ResponseBuilder;
use App\Modules\PaxInformationRoomPassenger\Application\List\ListPaxInformationRoomPassengerQuery;
use App\Modules\PaxInformationRoomPassenger\Application\PaxInformationRoomPassengerResponses;
use App\Modules\Shared\Domain\Bus\Query\QueryBus;
use App\Modules\Shared\Validator\Infraestructure\LaravelDTOGenerator;
use Illuminate\Http\Request;

class PaxInformationRoomPassengerListController extends Controller
{
    private $domain;

    public function __construct(
        private QueryBus $queryBus,
        private LaravelDTOGenerator $dtoGenerator
    ) {
        $this->domain = "PaxInformationRoomPassenger";
    }

    public function __invoke(Request $request, $Id_PaxInformationRoomPassenger)
    {
        // /** @var PaxInformationRoomPassengerListDTO $dto */
        // $dto = $this->dtoGenerator->generate($request->all(), $this->domain, PaxInformationRoomPassengerListDTO::class);
        /** @var PaxInformationRoomPassengerResponses $response */
        $response = $this->queryBus->ask(new ListPaxInformationRoomPassengerQuery(
            [$Id_PaxInformationRoomPassenger],
            'active'
        ));

        return ResponseBuilder::Response([
            "Response_Status"           => 200,
            "Response_Code"             => 200,
            "Response_Data"             => $response->data(),
            "Response_Domain"           => $this->domain,
            "Response_Message"          => 'Listado con éxito',
            "Response_Error_Message"    => '',
            "Response_Error_Reason"     => '',
        ]);
    }
}
