// Imports
import express from "express";

// Routes
import results from "../routes/results-route.js";
import alerting from "../routes/alerting-route.js";
import react from "../routes/react-route.js";
import catalog from "../routes/catalog-route.js";

import buildDevRoute from "../routes/dev-route.js";

export default function buildRoutes(pg, skio) {
  const router = express.Router();
  // Special Routes
  router.all("/", (req, res) => res.redirect("/qualiteer"));
  if (process.env.USE_DEV_ROUTER === "true")
    router.use("/api/dev", buildDevRoute(pg, skio));

  // Middlewares

  // Routes
  router.use("/qualiteer", react); // Static Build Route
  router.use("/api/results", results);
  router.use("/api/alerting", alerting);
  router.use("/api/catalog", catalog);

  return router;
}
