import { LoginForm } from '@/components/login-form';
import { getSystemConfig } from '@/lib/config';
import { isGoogleAuthEnabled } from '@/lib/auth-providers';

export default async function LoginPage({
  searchParams,
}: {
  searchParams: Promise<{ error?: string }>;
}) {
  const config = await getSystemConfig();
  const allowRegister = config.ALLOW_REGISTRATION !== 'false' && process.env.ALLOW_REGISTRATION !== 'false';
  const { error: authError } = await searchParams;

  return (
    <LoginForm
      allowRegister={allowRegister}
      googleAuthEnabled={isGoogleAuthEnabled()}
      authError={authError}
    />
  );
}
