import { createFileRoute } from '@tanstack/react-router'
import { apiJson, withApiKey } from '@/lib/api-keys.server'
import { usableSenderIds } from '@/lib/messaging.server'

// Public API: sender IDs the key owner can send with right now.
export const Route = createFileRoute('/api/v1/sender-ids')({
  server: {
    handlers: {
      GET: withApiKey(async ({ account }) =>
        apiJson({ ok: true, data: { sender_ids: await usableSenderIds(account.userId) } }),
      ),
    },
  },
})
