import { authenticate } from '../../plugins/auth.js'
import { getSupportHandles } from '../../services/config.service.js'

/**
 * Phase 4 — Tanya Admin sheet handles. Sourced from `app_config.support_handles_json`,
 * editable by CC. Authenticated so unauthenticated callers can't enumerate the
 * support channels (rate-limit hardening, not a secret).
 */
export const clientSupportRoutes = async (app) => {
  app.get('/support-handles', { preHandler: authenticate }, async (_request, reply) => {
    const handles = await getSupportHandles()
    return reply.send({ success: true, data: handles })
  })
}
