import express from 'express';
import { projectController } from '../controller/projectController';
import SecurityUtil from '../utils/security/securityUtil';
import { Role } from '../declarations/roles';

const router = express.Router();

router.get('/', projectController.getProjects.bind(projectController));
router.post('/', projectController.createProject.bind(projectController));

router.get('/:id', projectController.getProject.bind(projectController));
router.put('/:id', projectController.updateProject.bind(projectController));
router.delete(
    '/:id',
    SecurityUtil.handleAuthorizeRoleMiddleware(Role.Employee),
    projectController.removeProject.bind(projectController)
);

export const projectRoutes = router;
