"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const notify_service_1 = require("../notify-service");
const authz_1 = require("../middleware/authz");
const router = (0, express_1.Router)();
router.get('/config', authz_1.requireAdmin, (_req, res) => {
    res.json((0, notify_service_1.getNotifyConfig)());
});
router.put('/config', authz_1.requireAdmin, (req, res) => {
    const body = req.body;
    const webhookUrl = typeof body.webhookUrl === 'string' ? body.webhookUrl : undefined;
    const webhookEnabled = typeof body.webhookEnabled === 'boolean' ? body.webhookEnabled : undefined;
    const current = (0, notify_service_1.getNotifyConfig)();
    const updated = {
        webhookEnabled: webhookEnabled ?? current.webhookEnabled,
        webhookUrl: webhookUrl !== undefined ? webhookUrl : current.webhookUrl,
    };
    (0, notify_service_1.saveNotifyConfig)(updated);
    res.json(updated);
});
exports.default = router;
//# sourceMappingURL=notify.js.map