import { NextResponse } from 'next/server';
import { getRegistrationSettings } from '@/lib/shopware-admin';

export const dynamic = 'force-dynamic';

/**
 * Exposes the storefront-relevant login/registration settings (read from the
 * Admin API) to the client register form. Currently: whether to show the
 * private/commercial account-type selector.
 */
export async function GET() {
  try {
    const settings = await getRegistrationSettings();
    return NextResponse.json(settings);
  } catch {
    // Fail open so B2B registration stays available
    return NextResponse.json({ showAccountTypeSelection: true });
  }
}
