import { notFound } from "next/navigation"

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

import StartPage from "@/components/ContentType/StartPage"
import { parseBookingWidgetSearchParams } from "@/utils/url"

import type { NextSearchParams, PageArgs } from "@/types/params"

export { generateMetadata } from "@/utils/generateMetadata"

export default async function StartPagePage(
  props: PageArgs<{}, NextSearchParams>
) {
  const searchParams = await props.searchParams
  if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {
    return notFound()
  }

  const booking = parseBookingWidgetSearchParams(searchParams)

  return <StartPage booking={booking} />
}
