"use client"

import { LinkedReservation } from "./LinkedReservation"
import Room from "./Room"

import styles from "./rooms.module.css"

import type { BookingConfirmationRoomsProps } from "@/types/components/hotelReservation/bookingConfirmation/rooms"

export default function Rooms({
  booking,
  mainRoom,
  linkedReservations,
}: BookingConfirmationRoomsProps) {
  return (
    <section className={styles.rooms}>
      <Room
        booking={booking}
        img={mainRoom.images[0]}
        roomName={mainRoom.name}
      />
      {linkedReservations?.map((reservation, idx) => (
        <LinkedReservation
          key={reservation.confirmationNumber}
          linkedReservation={reservation}
          roomIndex={idx}
        />
      ))}
    </section>
  )
}
