"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapSettingsRouter = void 0;
const express_1 = require("express");
const settings_service_1 = require("./settings.service");
const settings_schemas_1 = require("./settings.schemas");
const validate_1 = require("../../../middleware/validate");
const auth_middleware_1 = require("../../../middleware/auth.middleware");
const rbac_middleware_1 = require("../../../middleware/rbac.middleware");
const roles_1 = require("../../../utils/roles");
const router = (0, express_1.Router)();
exports.mapSettingsRouter = router;
// GET /api/map/settings — public (needed for map center/zoom)
router.get('/', async (_req, res, next) => {
    try {
        const settings = await settings_service_1.mapSettingsService.get();
        res.json(settings);
    }
    catch (err) {
        next(err);
    }
});
// PUT /api/map/settings — admin only
router.put('/', auth_middleware_1.authenticate, (0, rbac_middleware_1.requireRole)(...roles_1.MAP_ROLES), (0, validate_1.validate)(settings_schemas_1.updateMapSettingsSchema), async (req, res, next) => {
    try {
        const settings = await settings_service_1.mapSettingsService.update(req.body);
        res.json(settings);
    }
    catch (err) {
        next(err);
    }
});
//# sourceMappingURL=settings.routes.js.map