import { Router } from "express";

import { ApprovalController } from "./approval.controller";

import { authMiddleware } from "../auth/auth.middleware";

const approvalrouter = Router();

const controller = new ApprovalController();

//Obtener todas las aprobaciones

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

//Obtener aprobación por ID
 
approvalrouter.get( "/:id", authMiddleware, controller.getById);

//Crear aprobación

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

//Aprobar solicitud

approvalrouter.put( "/:id/approve", authMiddleware, controller.approve);

//Rechazar solicitud

approvalrouter.put( "/:id/reject", authMiddleware, controller.reject);

//Buscar por estado
approvalrouter.get("/status/:status", authMiddleware, controller.getByStatus);

//Buscar por tipo

approvalrouter.get("/type/:referenceType", authMiddleware, controller.getByReferenceType);

//Eliminar aprobación

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

export default approvalrouter;