import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { ResumePageContent } from "@/components/resume-page-content";
import { getPortfolioContent, isLanguage, languages, type Language } from "@/data/portfolio";

export function generateStaticParams() {
  return languages.map((lang) => ({ lang }));
}

export function generateMetadata({ params }: { params: { lang: string } }): Metadata {
  if (!isLanguage(params.lang)) {
    return {};
  }

  const language = params.lang as Language;
  const t = getPortfolioContent(language);

  return {
    title: language === "ar" ? `السيرة الذاتية | ${t.meta.title}` : `Resume | ${t.meta.title}`,
    description: t.resume.description,
    alternates: {
      canonical: `/${language}/resume`,
      languages: {
        en: "/en/resume",
        ar: "/ar/resume",
      },
    },
  };
}

export default function LocalizedResumePage({ params }: { params: { lang: string } }) {
  if (!isLanguage(params.lang)) {
    notFound();
  }

  return <ResumePageContent language={params.lang as Language} />;
}
