import { getDemoBySlug } from "@/data/demos";
import KlinikTemplate from "@/components/templates/KlinikTemplate";
import RestoranTemplate from "@/components/templates/RestoranTemplate";
import KurumsalTemplate from "@/components/templates/KurumsalTemplate";
import DentalTemplate from "@/components/templates/DentalTemplate";
import RestoranTemplate2 from "@/components/templates/RestoranTemplate2";
import TaxiTemplate from "@/components/templates/TaxiTemplate";
import TaxiTemplate2 from "@/components/templates/TaxiTemplate2";
import ChatbotTemplate from "@/components/templates/ChatbotTemplate";
import BarTemplate from "@/components/templates/BarTemplate";
import BarTemplate2 from "@/components/templates/BarTemplate2";
import HotelTemplate1 from "@/components/templates/HotelTemplate1";
import HotelTemplate2 from "@/components/templates/HotelTemplate2";
import HotelTemplate3 from "@/components/templates/HotelTemplate3";
import BodrumCerrahiTemplate from "@/components/templates/BodrumCerrahiTemplate";
import ChatbotTemplate2 from "@/components/templates/ChatbotTemplate2";
import { notFound } from "next/navigation";

export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) {
  const { slug } = await params;
  const data = getDemoBySlug(slug);
  if (!data) return { title: "Demo bulunamadı" };
  return {
    title: `${data.firma.adi} — Ayris Tech Demo`,
    description: data.firma.slogan,
  };
}

export default async function DemoPage({ params }: { params: Promise<{ slug: string }> }) {
  const { slug } = await params;
  const data = getDemoBySlug(slug);
  if (!data) notFound();

  if (data.template === "klinik")   return <KlinikTemplate data={data} />;
  if (data.template === "restoran") return <RestoranTemplate data={data} />;
  if (data.template === "kurumsal") return <KurumsalTemplate data={data} />;
  if (data.template === "dental")   return <DentalTemplate data={data} />;
  if (data.template === "restoran2") return <RestoranTemplate2 data={data} />;
  if (data.template === "taxi")      return <TaxiTemplate data={data} />;
  if (data.template === "taxi2")     return <TaxiTemplate2 data={data} />;
  if (data.template === "chatbot")   return <ChatbotTemplate data={data} />;
  if (data.template === "bar")       return <BarTemplate data={data} />;
  if (data.template === "bar2")      return <BarTemplate2 data={data} />;
  if (data.template === "hotel1")    return <HotelTemplate1 data={data} />;
  if (data.template === "hotel2")    return <HotelTemplate2 data={data} />;
  if (data.template === "hotel3")       return <HotelTemplate3 data={data} />;
  if (data.template === "bodrumcerrahi") return <BodrumCerrahiTemplate data={data} />;
  if (data.template === "chatbot2")   return <ChatbotTemplate2 data={data} />;
  notFound();
}
