import { notFound } from "next/navigation";
import { PLATFORM_CONFIGS } from "@/types";
import GeneratorLayout from "@/components/generator/GeneratorLayout";
import type { Platform } from "@/types";

interface Props {
  params: Promise<{ platform: string }>;
}

export default async function GeneratorPage({ params }: Props) {
  const { platform: platformParam } = await params;
  const platform = platformParam as Platform;

  if (!PLATFORM_CONFIGS[platform]) {
    notFound();
  }

  return <GeneratorLayout platform={platform} />;
}

export function generateStaticParams() {
  return Object.keys(PLATFORM_CONFIGS).map((platform) => ({ platform }));
}
