const express = require("express");
const router = express.Router();
const rolePermissionsController = require("../controllers/rolePermissionsController");
const authenticate = require("../middlewares/authenticate");




router.get("/get/all", authenticate, (req, res) => {
  /*
    #swagger.tags = ['Roles']
    #swagger.summary = 'Get all roles'
    #swagger.security = [{ "bearerAuth": [] }]
  */
  rolePermissionsController.getAllRoles(req, res);
});


router.get("/get/:role_id",
  authenticate, (req,res) => {
   rolePermissionsController.getRolePermissions(req,res);
  }
  
);



/* ===========================
   ✅ GET ROLE BY ID
=========================== */
router.get("/:id", authenticate, (req, res) => {
  /*
    #swagger.tags = ['Roles']
    #swagger.summary = 'Get role by ID'
    #swagger.security = [{ "bearerAuth": [] }]

    #swagger.parameters['id'] = {
      in: 'path',
      required: true,
      type: 'integer',
      description: 'Role ID',
      example: 1
    }
  */
  rolePermissionsController.getRoleById(req, res);
});



router.put("/update",
  authenticate, (req,res) => {
   rolePermissionsController.updateRolePermissions(req,res);
  }
  
);

module.exports = router;