import express from 'express';
import { wrapAsync } from '@/api/http/request';
import * as permissionsController from '@/api/controllers/permissions.controller';
import permissions from '@/middlewares/check-permissions';

const router = express.Router();

router.use(permissions.checkCrudPermissions('permissions'));

router.post('/', wrapAsync(permissionsController.create));
router.post('/bulk-import', wrapAsync(permissionsController.bulkImport));
router.put('/:id', wrapAsync(permissionsController.update));
router.delete('/:id', wrapAsync(permissionsController.remove));
router.post('/deleteByIds', wrapAsync(permissionsController.deleteByIds));
router.get('/', wrapAsync(permissionsController.list));
router.get('/count', wrapAsync(permissionsController.count));
router.get('/autocomplete', wrapAsync(permissionsController.autocomplete));
router.get('/:id', wrapAsync(permissionsController.findById));

export default router;
