import { env } from "@/env/server"

import BookingWidget, { preload } from "@/components/BookingWidget"

import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
import type { PageArgs } from "@/types/params"

export default async function BookingWidgetPage({
  searchParams,
}: PageArgs<{}, BookingWidgetSearchData>) {
  if (!env.ENABLE_BOOKING_WIDGET) {
    return null
  }

  preload()

  return <BookingWidget bookingWidgetSearchParams={searchParams} />
}
