import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"

import { bookingFlowConfig } from "@/constants/bookingFlowConfig"

import { getLang } from "@/i18n/serverContext"

export default async function BookingWidgetPage(
  props: PageProps<"/[lang]/hotelreservation">
) {
  const searchParams = await props.searchParams

  const booking = parseBookingWidgetSearchParams(searchParams)

  const lang = await getLang()

  return (
    <BookingWidget booking={booking} lang={lang} config={bookingFlowConfig} />
  )
}
