"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const usage_meter_1 = require("../../shared/usage-meter");
const response_json_1 = __importDefault(require("../schemas/usage/DELETE/response.json"));
const usageRoute = (fastify, opts, done) => {
    const usageMeter = new usage_meter_1.UsageMeter(fastify.redis);
    fastify.addHook("onRequest", fastify.basicAuth);
    fastify.delete("/", {
        schema: {
            response: {
                200: response_json_1.default,
            },
            tags: ["Admin"],
            summary: "Fetch & reset usage statistics",
            security: [
                {
                    "Admin": []
                }
            ]
        },
        async handler(request, reply) {
            const usage = await usageMeter.readAndReset();
            reply.status(200).send(usage);
        },
    });
    done();
};
exports.default = usageRoute;
//# sourceMappingURL=usage.js.map