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

const AdminWithdrawalMethodsController = require("../../controllers/admin/withdrawalMethodsController");

// List
router.get(
  "/",
  authenticateAdmin,
  AdminWithdrawalMethodsController.getWithdrawalMethods
);

// Single
router.get(
  "/:id",
  authenticateAdmin,
  AdminWithdrawalMethodsController.getWithdrawalMethodById
);

// Create
router.post(
  "/",
  authenticateAdmin,
  audit("withdrawal_methods.create", "withdrawal_method"),
  AdminWithdrawalMethodsController.createWithdrawalMethod
);

// Update
router.patch(
  "/:id",
  authenticateAdmin,
  audit("withdrawal_methods.update", "withdrawal_method"),
  AdminWithdrawalMethodsController.updateWithdrawalMethod
);

// Delete
router.delete(
  "/:id",
  authenticateAdmin,
  audit("withdrawal_methods.delete", "withdrawal_method"),
  AdminWithdrawalMethodsController.deleteWithdrawalMethod
);

// Toggle active
router.post(
  "/:id/toggle",
  authenticateAdmin,
  audit("withdrawal_methods.toggle", "withdrawal_method"),
  AdminWithdrawalMethodsController.toggleWithdrawalMethod
);

module.exports = router;

/**
 * Mounting:
 * In your main admin router (adminS.js style :contentReference[oaicite:2]{index=2}), just require this file
 * and attach it to the same router you export.
 */