import { RegisterForm } from '@/components/register-form';
import { getSystemConfig } from '@/lib/config';
import { isGoogleAuthEnabled } from '@/lib/auth-providers';
import { redirect } from 'next/navigation';

export default async function RegisterPage() {
  const config = await getSystemConfig();
  const allowRegister = config.ALLOW_REGISTRATION !== 'false' && process.env.ALLOW_REGISTRATION !== 'false';

  if (!allowRegister) {
    redirect('/login');
  }

  return <RegisterForm googleAuthEnabled={isGoogleAuthEnabled()} />;
}
