export default defineEventHandler(async (event) => {
  try {
    const config = useRuntimeConfig().nocodb;
    
    return {
      success: true,
      config: {
        url: config.url,
        hasToken: !!config.token,
        tokenPrefix: config.token ? config.token.substring(0, 8) + '...' : 'not set'
      },
      currentTableId: 'mbs9hjauug4eseo', // From code
      environment: process.env.NODE_ENV || 'unknown'
    }
  } catch (error) {
    console.error('[DEBUG] NocoDB config error:', error)
    return {
      success: false,
      error: error instanceof Error ? error.message : 'Unknown error'
    }
  }
})
