import { platformApi } from '~~/server/utils/platform-api'

// Force a payout-ledger generation run. Optional ?period=YYYY-MM. Operator-only.
export default defineEventHandler(async (event) => {
  const period = getQuery(event).period
  const qs = period ? `?period=${encodeURIComponent(String(period))}` : ''
  return platformApi(event, `/billing/payouts/generate${qs}`, { method: 'POST' })
})
