const {authJwt} = require("../middlewares");
module.exports = app => {
    const employees = require("../controllers/employee.controller.js");
    app.use((req, res, next) => {
      res.header(
        "Access-Control-Allow-Headers",
        "x-access-token, Origin, Content-Type, Accept"
      );
      next();
    });
    var router = require("express").Router();
    // Retrieve all employee
    router.get("/", employees.getAllEmployees);
    // Retrieve active employee list from HR integration service
    router.post("/external/list", [authJwt.verifyToken], employees.getExternalEmployeesList);
    // Get external user permission config for a site
    router.get("/external/permissions", [authJwt.verifyToken], employees.getExternalUserPermission);
    // List external user permission configs for a site
    router.get("/external/permissions-list", [authJwt.verifyToken], employees.getExternalUserPermissionsList);
    // Save external user permission config for a site
    router.post("/external/permissions", [authJwt.verifyToken], employees.saveExternalUserPermission);
    // Revoke external user permission config for a site
    router.delete("/external/permissions", [authJwt.verifyToken], employees.revokeExternalUserPermission);
    // Retrive employees across sites
    router.get("/all-sites", employees.getAllEmployeesAcrossSites);
    // Create a new employee
    router.post("/", employees.createEmployee);
    // Update an employee
    router.put("/:id",[authJwt.verifyToken], employees.updateEmployee );
    // Get one employee
    router.get("/:id",[authJwt.verifyToken], employees.getEmployee)
    app.use('/api/employees', router);
 };