import { notFound } from "next/navigation"

import AccountPage from "@/components/Webviews/AccountPage"
import LoyaltyPage from "@/components/Webviews/LoyaltyPage"

import type {
  ContentTypeWebviewParams,
  LangParams,
  PageArgs,
  UIDParams,
} from "@/types/params"

export default async function ContentTypePage(
  props: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams, {}>
) {
  const params = await props.params

  switch (params.contentType) {
    case "loyalty-page":
      return <LoyaltyPage />
    case "account-page":
      return <AccountPage />
    default:
      const type: never = params.contentType
      console.error(`Unsupported content type given: ${type}`)
      notFound()
  }
}
