import { UsageMeter } from "../../shared/usage-meter";
import DELETEUsageResponseSchema from "../schemas/usage/DELETE/response.json";
const usageRoute = (fastify, opts, done) => {
    const usageMeter = new UsageMeter(fastify.redis);
    fastify.addHook("onRequest", fastify.basicAuth);
    fastify.delete("/", {
        schema: {
            response: {
                200: DELETEUsageResponseSchema,
            },
            tags: ["Admin"],
            summary: "Fetch & reset usage statistics",
            security: [
                {
                    "Admin": []
                }
            ]
        },
        async handler(request, reply) {
            const usage = await usageMeter.readAndReset();
            reply.status(200).send(usage);
        },
    });
    done();
};
export default usageRoute;
//# sourceMappingURL=usage.js.map