const express = require('express');
const router = express.Router();
const controller = require('../controllers/roleController');

router.get('/', controller.getRoles);
router.post('/', controller.createRole);
router.put('/:id', controller.updateRole);
router.delete('/:id', controller.deleteRole);

router.get('/pages', controller.getPages);
router.post('/pages', controller.createPage);
router.get('/pages/:id', controller.getPageById);
router.put('/pages/:id', controller.updatePage);
router.delete('/pages/:id', controller.deletePage);

router.get('/role-pages/:roleId', controller.getRolePages);
router.post('/role-pages/:roleId', controller.updateRolePages);
router.get('/role-pages/detail/:roleId', controller.getPagesWithRoleAccess);


module.exports = router;