import { Suspense } from "react"

import { serverClient } from "@/lib/trpc/server"

import BookingWidget from "@/components/BookingWidget"
import LoadingSpinner from "@/components/LoadingSpinner"

export default async function BookingWidgetPage() {
  // Get the booking widget show/hide status based on page specific settings
  const bookingWidgetToggle =
    await serverClient().contentstack.bookingwidget.getToggle()

  return (
    <Suspense fallback={<LoadingSpinner />}>
      {bookingWidgetToggle && bookingWidgetToggle.hideBookingWidget ? null : (
        <BookingWidget />
      )}
    </Suspense>
  )
}
