const express = require("express");
const isAuth = require("../../../../middlewares/authorization");

const {
  getUserPermissions,
  getUserPagePermission,
  addNewSellerGroup,
  getSellerGroups,
  getSellerGroupPermissionsAndUsersById,
  updateGroupPermission,
  updateSellerGroup,
  getAllSellerAccounts,
  addRemoveSellerAccountToGroup,
  getSellerModules,
  deleteSellerGroup,
} = require("../../../../controllers/seller/permissions");

const router = express.Router();

router.get("/", isAuth, getUserPermissions);
router.get("/page", isAuth, getUserPagePermission);

router.post("/group", isAuth, addNewSellerGroup);
router.get("/group", isAuth, getSellerGroups);
router.get("/group/:group_id", isAuth, getSellerGroupPermissionsAndUsersById);
router.patch("/group/:group_id", isAuth, updateGroupPermission);
router.delete("/group/:group_id", isAuth, deleteSellerGroup);
router.put("/group/:group_id", isAuth, updateSellerGroup);

router.get("/seller-accounts", isAuth, getAllSellerAccounts);
router.post("/seller-accounts", isAuth, addRemoveSellerAccountToGroup);

router.get("/modules", isAuth, getSellerModules);
module.exports = router;
