export default defineEventHandler(async (event) => {
  console.log('[api/registration-config.get] =========================');
  console.log('[api/registration-config.get] GET /api/registration-config - Get public registration configuration');
  
  try {
    // Get registration configuration (public access - safe to expose)
    const { getRegistrationConfig } = await import('~/server/utils/admin-config');
    const config = getRegistrationConfig();
    
    console.log('[api/registration-config.get] Returning registration config:', {
      membershipFee: config.membershipFee,
      hasIban: !!config.iban,
      hasAccountHolder: !!config.accountHolder
    });
    
    return {
      success: true,
      data: {
        membershipFee: config.membershipFee || 50,
        iban: config.iban || '',
        accountHolder: config.accountHolder || ''
      }
    };

  } catch (error: any) {
    console.error('[api/registration-config.get] ❌ Error getting public registration config:', error);
    
    return {
      success: false,
      error: 'Failed to get registration configuration',
      data: {
        membershipFee: 50,
        iban: '',
        accountHolder: ''
      }
    };
  }
});
