import type { Metadata } from "next";
import ResetPasswordForm from "@/components/auth/reset-password/ResetPasswordForm";

export const metadata: Metadata = {
  title: "Reset Password",
  description: "Choose a new password for your S.I. Tech Hub account.",
  robots: { index: false },
};

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

  return (
    <main className="flex min-h-screen w-full flex-col items-center justify-center gap-6 px-4 py-6">
      <section className="w-full max-w-md">
        <div className="mb-6 text-center">
          <h1 className="text-xl font-bold tracking-tight sm:text-2xl">
            Choose a new password
          </h1>
          <p className="mt-2 text-sm text-muted-foreground">
            Enter a new password for your S.I. Tech Hub account.
          </p>
        </div>
        {token ? (
          <ResetPasswordForm token={token} />
        ) : (
          <p className="px-2 text-sm text-muted-foreground">
            Missing reset link. Please use the link emailed to you, or{" "}
            <a className="font-medium text-primary" href="/forgot-password">
              request a new one
            </a>
            .
          </p>
        )}
      </section>
    </main>
  );
}