const {authJwt} = require("../middlewares");
module.exports = app => {
    const vehicles = require("../controllers/vehicle.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("/", [authJwt.verifyToken], vehicles.getAllVehicles);
    // Create a new employee
    router.post("/", [authJwt.verifyToken], vehicles.createVehicle);
    router.get('/active', [authJwt.verifyToken], vehicles.getAllActiveVehicles);
    router.get('/:id', [authJwt.verifyToken], vehicles.getVehicle);
    router.put('/:id', [authJwt.verifyToken], vehicles.updateVehicle);
    router.delete('/:id', [authJwt.verifyToken], vehicles.deleteVehicle);
    app.use('/api/vehicles', router);
 };