import { notFound } from "next/navigation"
import { Suspense } from "react"

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

import DestinationCityPage from "@/components/ContentType/DestinationPage/DestinationCityPage"
import DestinationCityPageSkeleton from "@/components/ContentType/DestinationPage/DestinationCityPage/DestinationCityPageSkeleton"

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

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

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

  return (
    <Suspense fallback={<DestinationCityPageSkeleton />}>
      <DestinationCityPage isMapView={searchParams.view === "map"} />
    </Suspense>
  )
}
