const express = require("express");
const router = express.Router();
const authenticate = require("../../middlewares/authenticate")
const  transportController = require("../../controllers/dispatch/transportController");
const upload = require("../../middlewares/upload")

router.post("/create",authenticate,upload.array("vehicle_documents"), (req,res)=>{
     transportController.createTransportAgency(req,res);
});


// routes/transportRoutes.js

router.get("/all",authenticate, (req,res) =>{
    transportController.getTransportAgencyList(req,res);
}
);


router.get("/dropdown",
  authenticate,
  (req,res) =>{
    transportController.getTransportAgencyDropdown(req,res);
  }
);

// routes/transportRoutes.js

router.get("/statistics",authenticate, (req,res)=>{
     transportController.getTransportStatistics(req,res);
});


router.delete("/delete/:id",
  authenticate, (req,res)=>{
     transportController.deleteTransportAgency(req,res);
});

router.post("/add-driver",  authenticate, (req,res)=>{
  console.log("routes...")
     transportController.addDriver(req,res);
});


router.get("/dropdown-by-mode",
  authenticate,
 (req,res)=>{

     transportController.getTransportAgenciesByMode(req,res);
});

router.get("/:id",  authenticate,
 (req,res)=>{
     transportController.getTransportAgencyById(req,res);
});

router.put("/update/:id",upload.array("vehicle_documents"),
  authenticate,
  (req,res)=>{
     transportController.updateTransportAgency(req,res);
});

module.exports = router;