"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAdminRouter = createAdminRouter;
const express_1 = require("express");
const auth_js_1 = require("../middleware/auth.js");
const vaults_js_1 = require("../controllers/vaults.js");
const paymentTransactions_js_1 = require("../controllers/paymentTransactions.js");
const subscriptions_js_1 = require("../controllers/subscriptions.js");
const supportRoutes_js_1 = require("../../support/interface/http/routes/supportRoutes.js");
function createAdminRouter(config, cryptoBox, bot, supportModule) {
    const router = (0, express_1.Router)();
    const authMiddleware = (0, auth_js_1.createAuthMiddleware)(config);
    const vaults = (0, vaults_js_1.createVaultsController)(config, cryptoBox);
    const paymentTransactions = (0, paymentTransactions_js_1.createPaymentTransactionsController)(config, cryptoBox, bot);
    const subscriptions = (0, subscriptions_js_1.createSubscriptionsController)(config);
    router.use(authMiddleware);
    if (supportModule) {
        router.use("/support", (0, supportRoutes_js_1.createSupportRoutes)(supportModule, supportModule.logger));
    }
    router.get("/sweep-vaults", vaults.list);
    router.post("/sweep-vaults", vaults.create);
    router.get("/sweep-vaults/:id", vaults.getById);
    router.post("/sweep-vaults/:id/decrypt", vaults.decrypt);
    router.post("/sweep-vaults/:id/transfer", vaults.transfer);
    router.delete("/sweep-vaults/:id", vaults.delete);
    // get payment wallet private key
    router.post("/payment-wallets/:id/private-key", paymentTransactions.decryptedPrivateKey);
    router.get("/payment-transactions", paymentTransactions.list);
    router.post("/payment-transactions/:id/confirm", paymentTransactions.confirm);
    router.delete("/payment-transactions/:id", paymentTransactions.delete);
    router.post("/payment-transactions/sweep", paymentTransactions.sweep);
    router.post("/payment-transactions/sweep/:id", paymentTransactions.sweepOne);
    router.post("/payment-transactions/sweep-selected", paymentTransactions.sweepSelected);
    router.get("/subscriptions", subscriptions.list);
    router.get("/subscriptions/:id", subscriptions.getById);
    router.put("/subscriptions/:id", subscriptions.update);
    router.delete("/subscriptions/:id", subscriptions.delete);
    return router;
}
