import { Suspense } from "react";
import type { Metadata } from "next";
import {
  DogrulaKarti,
  DogrulaKartiSkeleton,
} from "@/features/kullanici/components/dogrula-karti";

export const metadata: Metadata = {
  title: "Girişini onayla",
  robots: { index: false, follow: false },
};

export default function DogrulaPage({
  searchParams,
}: {
  searchParams: Promise<{
    token?: string;
    callbackURL?: string;
    errorCallbackURL?: string;
    newUserCallbackURL?: string;
  }>;
}) {
  return (
    <div className="-mb-28 flex min-h-dvh flex-col bg-slate-50 text-slate-900">
      <main className="mx-auto flex w-full max-w-md flex-1 flex-col items-stretch justify-center px-6 py-8">
        <Suspense fallback={<DogrulaKartiSkeleton />}>
          {searchParams.then((sp) => (
            <DogrulaKarti
              token={sp.token}
              callbackURL={sp.callbackURL}
              errorCallbackURL={sp.errorCallbackURL}
              newUserCallbackURL={sp.newUserCallbackURL}
            />
          ))}
        </Suspense>
      </main>
    </div>
  );
}
