import { Router } from "express";
import { PumpReadingController } from "./pumpReading.controller";
import { authMiddleware } from "../auth/auth.middleware";

const pumpReadingRouter = Router();

const controller = new PumpReadingController();


// Obtener todas las lecturas
pumpReadingRouter.get("/", authMiddleware, controller.getAll);

// Obtener una lectura por ID
pumpReadingRouter.get("/:id", authMiddleware, controller.getById);

// Crear una nueva lectura
pumpReadingRouter.post("/", authMiddleware, controller.create);

// Actualizar una lectura
pumpReadingRouter.put("/:id", authMiddleware, controller.update);

// Eliminar una lectura
pumpReadingRouter.delete("/:id", authMiddleware, controller.delete);

// Cerrar lectura y realizar el cuadre
pumpReadingRouter.post("/:id/close", authMiddleware, controller.closeReading);

export default pumpReadingRouter;