import express from "express";
import cors from "cors";

import roleRouter from "./modules/roles/role.routes";
import userRouter from "./modules/user/user.routes";
import authRouter from "./modules/auth/auth.routes";
import fuelRoutes from "./modules/fuel-types/fuelType.routes";
import fuelPriceRoute from "./modules/fuel_prices/fuelPrices.routes";
import fuelPumpRouter from "./modules/fuel_pumps/fuelPump.routes";
import vehicleConfigRouter from "./modules/vehicles-config/vehiclesConfig.routes";
import vAssigRouter from "./modules/vehicle-assignments/vehicleassig.routes";
import fuelRequestRouter from "./modules/fuel-requests/fuelRequest.routes";
import approvalrouter from "./modules/approvals/approval.routes";
import invoicerouter from "./modules/external-invoices/externalInvoice.routes";
import lpgRouter from "./modules/lpg/lpg.routes";
import anomalyRouter from "./modules/anomalies/anomaly.routes";
import pumpReadingRouter from "./modules/pump-reading/pumpReading.routes";
import dashboardRouter from "./modules/dashboard/dashboard.routes";




const app = express();
app.use(cors());

app.use(express.json());

app.use("/api/roles", roleRouter);
app.use("/api/user", userRouter);
app.use("/api/fuel", fuelRoutes);
app.use("/api/auth", authRouter);
app.use("/api/fuelprice", fuelPriceRoute);
app.use("/api/pump", fuelPumpRouter);
app.use("/api/vconfig", vehicleConfigRouter);
app.use("/api/vAssig", vAssigRouter);
app.use("/api/fuelRequest", fuelRequestRouter);
app.use("/api/approvals", approvalrouter);
app.use("/api/exterinvoice", invoicerouter);
app.use("/api/lpg",lpgRouter);
app.use("/api/anomaly", anomalyRouter);
app.use("/api/pumpReading", pumpReadingRouter);
app.use("/api/dashboard", dashboardRouter);

app.use(express.urlencoded({
    extended:true
})
);

app.get(
    "/api/health",
    (   
        req,
        res   
    ) => {
        
        res.status(200).json({
            success:true,
            message: "API funcionando correctamente"
        });
    }
);

export default app;