const express = require("express");
const router = express.Router();

const {
  listUsers,
  showCreateUser,
  postCreateUser,
  changeUserRole,
  resetUserPassword,
  activateUser,
  deactivateUser,
} = require("../controllers/admin.controller");

const { requireAdmin } = require("../middleware/auth.middleware");

router.get("/users", requireAdmin, listUsers);
router.get("/create-user", requireAdmin, showCreateUser);
router.post("/create-user", requireAdmin, postCreateUser);

router.post("/users/change-role/:id", requireAdmin, changeUserRole);
router.post("/users/reset-password/:id", requireAdmin, resetUserPassword);
router.post("/users/activate/:id", requireAdmin, activateUser);
router.post("/users/deactivate/:id", requireAdmin, deactivateUser);

module.exports = router;
