import { notFound } from "next/navigation";

import { auth } from "@/config/auth";
import { Breadcrumb } from "@/shared/components/ui/breadcrumb";
import { ContactsImportPageView } from "@/modules/contacts/components/contacts-import-page-view";

export const metadata = {
  title: "Importar Contatos | Newsletter Platform",
  description: "Importe contatos via CSV com mapeamento de colunas e relatório de erros",
};

interface ContactsImportPageProps {
  searchParams: Promise<{ listId?: string }>;
}

export default async function ContactsImportPage({ searchParams }: ContactsImportPageProps) {
  const session = await auth();
  if (!session?.user?.id) {
    notFound();
  }

  const { listId } = await searchParams;

  return (
    <div className="w-full max-w-[1600px] mx-auto px-4 sm:px-6 lg:px-8 py-6 space-y-6">
      <Breadcrumb
        items={[
          { label: "Início", href: "/" },
          { label: "Contatos", href: "/contacts" },
          { label: "Importar" },
        ]}
      />
      <ContactsImportPageView initialListId={listId} />
    </div>
  );
}
