import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests"

import Header from "@/components/HotelReservation/BookingConfirmation/Header"
import Rooms from "@/components/HotelReservation/BookingConfirmation/Rooms"
import Summary from "@/components/HotelReservation/BookingConfirmation/Summary"
import { setLang } from "@/i18n/serverContext"

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

import type { LangParams, PageArgs } from "@/types/params"

export default async function BookingConfirmationPage({
  params,
  searchParams,
}: PageArgs<LangParams, { confirmationNumber: string }>) {
  setLang(params.lang)
  void getBookingConfirmation(searchParams.confirmationNumber)
  return (
    <div className={styles.main}>
      <Header confirmationNumber={searchParams.confirmationNumber} />
      <Rooms />
      <Summary />
    </div>
  )
}
