// Get Helcim payment plans
import { listHelcimPlans } from '../../utils/helcim.js'

export default defineEventHandler(async (event) => {
  try {
    await requireAdmin(event)

    const plansData = await listHelcimPlans()

    return {
      success: true,
      plans: plansData
    }

  } catch (error) {
    if (error.statusCode) throw error
    console.error('Error fetching Helcim payment plans:', error)
    throw createError({
      statusCode: 500,
      statusMessage: 'An unexpected error occurred'
    })
  }
})
