/**
 * Broadcast Routes
 *
 * Runtime-only endpoints for broadcast.
 * Provider setup and secret provisioning remain CLI-only.
 */
import { Router } from '../src/routes/Router.js';
export function registerBroadcastRoutes(router) {
    Router.get(router, '/broadcast/health', async (_req, res) => {
        res.json({ ok: true });
    });
    Router.post(router, '/broadcast/send', async (req, res) => {
        const body = (req.body ?? {});
        const channel = typeof body['channel'] === 'string' ? body['channel'] : '';
        const event = typeof body['event'] === 'string' ? body['event'] : '';
        const data = body['data'];
        if (!channel || !event) {
            res
                .setStatus(400)
                .json({ ok: false, error: 'Invalid payload: channel and event are required' });
            return;
        }
        const { Broadcast } = await import('../src/tools/broadcast/Broadcast.js');
        const result = await Broadcast.send(channel, event, data);
        res.json({ ok: true, result });
    });
}
