import { LoginForm } from "@/components/auth-form";

export const metadata = { title: "Sign in" };

export default async function LoginPage({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
  const { error } = await searchParams;
  const messages: Record<string, string> = {
    "google-not-configured": "Google sign-in is not configured on this deployment. Add GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET to enable it.",
    "google-state": "Google sign-in session expired. Please try again.",
    "google-token": "Google rejected the sign-in attempt.",
    "google-profile": "Google did not return an email address.",
    suspended: "This account has been suspended.",
  };
  return <LoginForm initialError={error ? messages[error] ?? "Sign-in failed" : undefined} />;
}
