"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUsageRouter = void 0;
const usage_1 = require("../helpers/usage");
const openapi_1 = require("../helpers/openapi");
function getUsageRouter({ config }) {
    return [
        openapi_1.createRoute('getUsage', async (_req, res) => {
            const space = await usage_1.checkDiskSpace(config.torrents.path);
            const usedSpace = await usage_1.getUsedSpace(config.torrents.path);
            return res.json({
                totalDiskSpace: space.size,
                freeDiskSpace: space.free,
                usedTorrentSpace: usedSpace,
            });
        }),
    ];
}
exports.getUsageRouter = getUsageRouter;
