import { getServerLocale } from "@/lib/i18n/server";
import { Header } from "@/components/layout/Header";
import Footer from "@/components/layout/Footer";
import ContentDetailShell from "@/features/content/components/ContentDetailShell";

interface Props {
  params: Promise<{ slug: string }>;
  searchParams: Promise<{ type?: string }>;
}

export default async function DetailPage({ params, searchParams }: Props) {
  const { slug } = await params;
  const { type } = await searchParams;
  const locale = await getServerLocale();

  const contentId = parseInt(slug, 10);
  const contentType = type ? parseInt(type, 10) : 1; // default to Article

  return (
    <div className="dt-fade-in">
      <Header locale={locale} />
      <ContentDetailShell
        contentType={isNaN(contentType) ? 1 : contentType}
        contentId={isNaN(contentId) ? 0 : contentId}
      />
      <Footer locale={locale} />
    </div>
  );
}
