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

import Details from "@/components/HotelReservation/BookingConfirmation/Details"
import Header from "@/components/HotelReservation/BookingConfirmation/Header"
import TotalPrice from "@/components/HotelReservation/BookingConfirmation/TotalPrice"
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)
  const { confirmationNumber } = searchParams

  return (
    <div className={styles.main}>
      <Header confirmationNumber={confirmationNumber} />
      <Details confirmationNumber={confirmationNumber} />
      <TotalPrice confirmationNumber={confirmationNumber} />
    </div>
  )
}
