/**
 * Get a specific Metabase card by ID
 */
export default defineEventHandler(async (event) => {
  try {
    const id = getRouterParam(event, 'id')

    if (!id) {
      throw createError({
        statusCode: 400,
        statusMessage: 'Card ID is required'
      })
    }

    const card = await getMetabaseCard(parseInt(id))
    return card
  } catch (error: any) {
    console.error('[API] Failed to get Metabase card:', error)
    throw createError({
      statusCode: error.statusCode || 500,
      statusMessage: error.statusMessage || 'Failed to fetch card'
    })
  }
})
