const express = require("express");
const { PropertyController } = require("../../controllers/web");
const { verifySession } = require("../../middleware");
const { upload } = require("../../helpers");
const router = express.Router();

router.get("/", PropertyController.index);
router.get("/add-property/:id?", verifySession, PropertyController.addProperty);
router.get("/my-properties", verifySession, PropertyController.myProperties);
router.get("/:id", PropertyController.getById);
router.post(
  "/addProperty",
  verifySession,
  upload.array("image"),
  PropertyController.addPropertyProcess
);
router.post(
  "/initiatePayment",
  verifySession,
  PropertyController.initiatePayment
);
router.get(
  "/deleteImage/:propertyId/:id",
  verifySession,
  PropertyController.deleteImage
);

router.get(
  "/deleteProperty/:propertyId",
  verifySession,
  PropertyController.deleteProperty
);

router.post("/report", verifySession, PropertyController.report);

module.exports = router;
