const express = require("express");
const { getReqInformation, getSettings } = require("../../utils/Common");
const router = express.Router();

router.use("/", require("./Home"));
router.use("/about", require("./About"));
router.use("/agents", require("./Agent"));
router.use("/blog", require("./Blog"));
router.use("/contacts", require("./Contact"));
router.use("/services", require("./Service"));
router.use("/properties", require("./Property"));
router.use("/", require("./Auth"));
router.use("/profile", require("./Profile"));
router.use("/faq", require("./FAQ"));
router.use("/feedback", require("./Feedback"));
router.use("/bookmark", require("./Bookmark"));
router.use("/plans", require("./Plan"));
router.use("/razorpay", require("./Razorpay"));
router.use("/cashfree", require("./Cashfree"));
router.use("/terms-and-conditions", require("./TermsAndCondition"));
router.use("/privacy-policy", require("./PrivacyPolicy"));
router.use("/enquiry", require("./Enquiry"));
router.get("*", async function (req, res) {
  let user = {};
  let settings = await getSettings();
  const { baseUrl, endPoint } = getReqInformation(req);
  return res.render("errors/404.ejs", {
    baseUrl,
    endPoint,
    user,
    settings,
  });
});

module.exports = router;
