import { Router } from "express";
import { AnomalyController } from "./anomaly.controller";
import { authMiddleware } from "../auth/auth.middleware";

const anomalyRouter = Router();

const controller = new AnomalyController();

anomalyRouter.get("/", authMiddleware, controller.getAll);

anomalyRouter.get("/:id", authMiddleware, controller.getById);

anomalyRouter.get("/status/:status", authMiddleware, controller.getByStatus);

anomalyRouter.get("/vehicleId/:vehicleId", authMiddleware, controller.getByVehicle);

anomalyRouter.get("/employeeId/:employeeId", authMiddleware, controller.getByEmployee);

anomalyRouter.post("/", authMiddleware, controller.create);

anomalyRouter.put("/:id", authMiddleware, controller.update);

anomalyRouter.put("/:id/status", authMiddleware, controller.changeStatus);

anomalyRouter.put("/:id/close", authMiddleware, controller.close);

anomalyRouter.delete("/:id", authMiddleware, controller.delete);

export default anomalyRouter;

