import Link from 'next/link';
import { CheckCircle2 } from 'lucide-react';

export default async function SentPage({
  searchParams,
}: {
  searchParams: Promise<{ cid?: string }>;
}) {
  const { cid } = await searchParams;

  return (
    <main className="mx-auto flex min-h-dvh max-w-lg flex-col items-center justify-center gap-6 p-6 text-center">
      <div className="flex flex-col items-center gap-3">
        <CheckCircle2 className="h-16 w-16 text-green-500" />
        <h1 className="text-2xl font-bold">Pedido enviado</h1>
        {cid && (
          <p className="font-mono text-xs text-muted-foreground" data-testid="request-cid">
            {cid}
          </p>
        )}
        <p className="text-sm text-muted-foreground">
          A equipa de manutenção foi notificada e irá tratar do problema.
        </p>
      </div>
      <Link
        href="/"
        className="rounded-xl bg-primary px-8 py-3 font-semibold text-primary-foreground hover:opacity-90"
      >
        Voltar ao início
      </Link>
    </main>
  );
}
