"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.statsRouter = void 0;
const tslib_1 = require("tslib");
const express_1 = (0, tslib_1.__importDefault)(require("express"));
const stat_manager_1 = require("../../../lib/stat-manager");
const constants_1 = require("../../../initializers/constants");
const middlewares_1 = require("../../../middlewares");
const cache_1 = require("../../../middlewares/cache/cache");
const hooks_1 = require("../../../lib/plugins/hooks");
const statsRouter = express_1.default.Router();
exports.statsRouter = statsRouter;
statsRouter.get('/stats', (0, cache_1.cacheRoute)(constants_1.ROUTE_CACHE_LIFETIME.STATS), (0, middlewares_1.asyncMiddleware)(getStats));
function getStats(_req, res) {
    return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
        let data = yield stat_manager_1.StatsManager.Instance.getStats();
        data = yield hooks_1.Hooks.wrapObject(data, 'filter:api.server.stats.get.result');
        return res.json(data);
    });
}
//# sourceMappingURL=stats.js.map