import type { BookingConfirmationRoom } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation" import { BreakfastPackageEnum } from "@/types/enums/breakfast" import type { BookingConfirmationSchema } from "@/types/trpc/routers/booking/confirmation" export function mapRoomState( booking: BookingConfirmationSchema, room: BookingConfirmationRoom ) { const selectedBreakfast = booking.packages.find( (pkg) => pkg.code === BreakfastPackageEnum.REGULAR_BREAKFAST ) const breakfastIncluded = booking.packages.some( (pkg) => pkg.code === BreakfastPackageEnum.FREE_MEMBER_BREAKFAST ) return { adults: booking.adults, bedDescription: room.bedType.description, breakfastIncluded, children: booking.childrenAges.length, confirmationNumber: booking.confirmationNumber, fromDate: booking.checkInDate, name: room.name, rateDefinition: booking.rateDefinition, roomPrice: booking.roomPrice, selectedBreakfast, toDate: booking.checkOutDate, totalPrice: booking.totalPrice, } }