import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { HomePage } from "@/components/home-page";
import { isLanguage, languages, type Language } from "@/data/portfolio";
import { getHomeMetadata } from "@/data/seo";

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

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

  return getHomeMetadata(params.lang as Language);
}

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

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