import { notFound } from "next/navigation";
import { toClientJson } from "@/lib/serialize";
import { LeadDetailClient } from "@/app/leads/[id]/lead-detail-client";
import { getLead } from "@/server/services/lead.service";

export default async function LeadDetailPage({
  params,
}: {
  params: Promise<{ id: string }>;
}) {
  const { id } = await params;
  const lead = await getLead(id);
  if (!lead) notFound();
  return <LeadDetailClient lead={toClientJson(lead)} />;
}
