const router = require("express").Router();
const { authenticateAdmin, audit } = require("../../middleware");

const AdminTradingPairsController = require("../../controllers/admin/tradingPairController");

// LIST
router.get(
  "/",
  authenticateAdmin,
  AdminTradingPairsController.getTradingPairs
);

// GET ONE
router.get(
  "/:pairId",
  authenticateAdmin,
  AdminTradingPairsController.getTradingPairById
);

// CREATE
router.post(
  "/",
  authenticateAdmin,
  audit("trading_pairs.create", "trading_pair"),
  AdminTradingPairsController.createTradingPair
);

// UPDATE
router.patch(
  "/:pairId",
  authenticateAdmin,
  audit("trading_pairs.update", "trading_pair"),
  AdminTradingPairsController.updateTradingPair
);

// DELETE
router.delete(
  "/:pairId",
  authenticateAdmin,
  audit("trading_pairs.delete", "trading_pair"),
  AdminTradingPairsController.deleteTradingPair
);

module.exports = router;