import express from 'express';
const router = express.Router();
import { employeeController } from '../controller/employeeController';
import SecurityUtil from '../utils/security/securityUtil';
import { Role } from '../declarations/roles';
import { userController } from '../controller/userController';

router.get('/', employeeController.getEmployees.bind(employeeController));
router.post('/', employeeController.createEmployee.bind(employeeController));

router.get('/:id', employeeController.getEmployee.bind(employeeController));
router.put('/:id', employeeController.updateEmployee.bind(employeeController));
router.delete(
    '/:id',
    SecurityUtil.handleAuthorizeRoleMiddleware(Role.Employee),
    userController.removeUser.bind(userController)
);

export const employeeRoutes = router;
