import { notFound } from "next/navigation"

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

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

export default async function ContentTypePage({
  params,
}: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams, {}>) {
  switch (params.contentType) {
    case "loyalty-page":
      return <LoyaltyPage lang={params.lang} />
    case "account-page":
      return <AccountPage lang={params.lang} />
    default:
      const type: never = params.contentType
      console.error(`Unsupported content type given: ${type}`)
      notFound()
  }
}
