"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const catalog_routing_1 = require("../../cliproxy/services/catalog-routing");
const router = (0, express_1.Router)();
/**
 * GET /api/cliproxy/catalog - Get merged model catalogs
 * Returns resolved catalogs with live -> cache -> static fallback ordering.
 */
router.get('/', async (_req, res) => {
    try {
        const snapshot = await (0, catalog_routing_1.getCatalogRoutingSnapshot)();
        res.json({
            catalogs: snapshot.catalogs,
            routing: snapshot.routing,
            source: snapshot.source,
            cache: {
                synced: snapshot.source !== 'static' || snapshot.cacheAge !== null,
                age: snapshot.cacheAge,
            },
        });
    }
    catch (error) {
        res.status(500).json({ error: error.message });
    }
});
exports.default = router;
//# sourceMappingURL=catalog-routes.js.map