const express = require("express");
const router = express.Router();
const authMiddleware = require("../middleware/authMiddleware");
const hrOrAdminMiddleware = require("../middleware/hrOrAdminMiddleware");
const c = require("../controllers/leave-requests");

router.use(authMiddleware);

router.post("/", c.createLeaveRequest);
router.get("/my", c.getMyLeaveRequests);
router.get("/pending", hrOrAdminMiddleware, c.getPendingLeaveRequests);
router.get("/", hrOrAdminMiddleware, c.getCompanyLeaveRequests);
router.put("/:id/approve", hrOrAdminMiddleware, c.approveLeaveRequest);
router.put("/:id/reject", hrOrAdminMiddleware, c.rejectLeaveRequest);

module.exports = router;
