import { Suspense } from "react";
import type { Metadata } from "next";
import {
  UniversiteIcerik,
  UniversiteIcerikSkeleton,
  uniSayfaMetadata,
  uniStaticSlugs,
} from "@/features/katalog/components/universite-icerik";

export function generateStaticParams() {
  return uniStaticSlugs().map((slug) => ({ slug }));
}

export async function generateMetadata({
  params,
}: PageProps<"/universite/[slug]">): Promise<Metadata> {
  const { slug } = await params;
  return uniSayfaMetadata(slug, 1);
}

export default function UniversitePage({
  params,
}: PageProps<"/universite/[slug]">) {
  return (
    <Suspense fallback={<UniversiteIcerikSkeleton />}>
      {params.then(({ slug }) => (
        <UniversiteIcerik slug={slug} sayfa={1} />
      ))}
    </Suspense>
  );
}
