const {authJwt} = require("../middlewares");
module.exports = app => {
    const calendarEvent = require("../controllers/calendar-event.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 Events
    router.get("/", [authJwt.verifyToken], calendarEvent.getAllEvents);
    router.get('/getByCustomer',[authJwt.verifyToken], calendarEvent.getEventsByCustomer );
    // Create a new Event
    router.post("/", [authJwt.verifyToken], calendarEvent.createCalendarEvent);
    router.get('/:id', [authJwt.verifyToken], calendarEvent.getEvent);
    router.put('/:id', [authJwt.verifyToken], calendarEvent.updateEvent);
    router.put('/:id/disable', [authJwt.verifyToken], calendarEvent.disableEvent);
    router.post('/assign', [authJwt.verifyToken], calendarEvent.assignTransportationToEvents);
    router.delete('/:id', [authJwt.verifyToken], calendarEvent.deleteEvent);
    app.use('/api/events', router);
 };