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

import BookingConfirmation from "@/components/HotelReservation/BookingConfirmation"
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)
  const confirmationNumber = searchParams.confirmationNumber
  void getBookingConfirmation(confirmationNumber)
  return (
    <main className={styles.main}>
      <BookingConfirmation confirmationNumber={confirmationNumber} />
    </main>
  )
}
