"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const events_1 = require("../lib/events");
const nats_1 = require("../lib/events/nats");
const router = (0, express_1.Router)();
/**
 * GET /api/nats-credentials
 * Returns NATS WebSocket URL and auth token.
 * Mounted behind requireAuth — only authenticated users receive the token.
 */
router.get('/', async (_req, res) => {
    const hasNats = !!events_1.eventRegistry.getAdapter(nats_1.NatsEventAdapter);
    if (!hasNats) {
        return res.json({ natsWsUrl: null, natsToken: null });
    }
    res.json({
        natsWsUrl: process.env.VITE_NATS_WS_URL || process.env.NATS_WS_URL || null,
        natsToken: process.env.NATS_TOKEN || null,
    });
});
exports.default = router;
