import express from "express";

import { Tadbir } from "$controllers/index.js";
import {
  checkPermission,
  ensureTadbirVerified,
  jwt,
} from "$middlewares/index.js";

const router = express.Router();

router.get("/funds", Tadbir.FUNDS);
router.get("/balances", jwt, Tadbir.BALANCES);
router.get(
  "/external-requests",
  jwt,
  checkPermission("externalRequests:view"),
  Tadbir.EXTERNAL_REQUESTS,
);
router.get(
  "/cardex",
  jwt,
  checkPermission("investCardex:view"),
  Tadbir.INVEST_CARDEX,
);
router.get("/profile", jwt, checkPermission("profile:view"), Tadbir.PROFILE);
router.get(
  "/turnover",
  jwt,
  checkPermission("turnoverAccount:view"),
  Tadbir.TURNOVER_ACCOUNT,
);
router.get(
  "/dashboard-charts",
  jwt,
  checkPermission("home:view"),
  Tadbir.DASHBOARD_CHARTS,
);
router.get(
  "/reinvest/history",
  jwt,
  ensureTadbirVerified,
  Tadbir.REINVEST_HISTORY,
);
router.get(
  "/reinvest/history/embedded",
  jwt,
  ensureTadbirVerified,
  Tadbir.REINVEST_HISTORY_EMBEDDED,
);
router.post("/reinvest", jwt, ensureTadbirVerified, Tadbir.UPDATE_REINVEST);

export default router;
