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

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

import type { Lang } from "@scandic-hotels/common/constants/language"

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

  const booking = parseBookingWidgetSearchParams(searchParams)

  const lang = params.lang as Lang

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