import type { RateEnum } from "@/types/enums/rate"
import type { PackageEnum, Packages } from "@/types/requests/packages"
import type {
  Product,
  RoomConfiguration,
} from "@/types/trpc/routers/hotel/roomAvailability"
import type { ChildBedMapEnum } from "../../bookingWidget/enums"
import type { BookingSearchType } from "../booking"

export interface Child {
  bed: ChildBedMapEnum
  age: number
}

export interface Room {
  adults: number
  childrenInRoom?: Child[]
  bookingCode?: string | null
  counterRateCode?: string | null
  packages?: PackageEnum[] | null
  rateCode?: string | null
  roomTypeCode?: string | null
}

export type SelectRateBooking = {
  bookingCode?: string
  city?: string
  fromDate: string
  hotelId: string
  rooms: Room[]
  searchType?: BookingSearchType
  toDate: string
}

export type Rate = {
  features: RoomConfiguration["features"]
  packages: NonNullable<Packages>
  priceName?: string
  priceTerm?: string
  product: Product
  rate: RateEnum
  roomRates?: {
    rate: Rate
    roomIndex: number
  }[]
  roomType: RoomConfiguration["roomType"]
  roomTypeCode: RoomConfiguration["roomTypeCode"]
}

export type RateCode = {
  publicRateCode: string
  roomTypeCode: string
  name: string
  paymentTerm: string
}
