<?php

namespace App\Modules\Room\Application\List;

use App\Modules\BookingExtra\Domain\IdBookingExtra;
use App\Modules\Room\Domain\ListRoom;
use App\Modules\Room\Domain\RoomRepository;

final class RoomLister
{
    public function __construct(private RoomRepository $repository) {}

    public function __invoke(
        string $action,
        ?int $idBookingExtra = null
    ) {
        return $this->repository->search(new ListRoom(
            new IdBookingExtra($idBookingExtra),
            $action,
        ));
    }
}
