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/vehiclesConfigs.routes";
import vAssigRouter from "./modules/vehicle-assignments/vehicleassig.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(express.urlencoded({
    extended:true
})
);

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

export default app;