"use strict";

const express = require("express");

const { getWelcome, postWelcome } = require("../controllers/welcome");
const {
  getRealEstateTypes,
  postRealEstateTypes
} = require("../controllers/realEstateTypes");
const {
  getPublishTypes,
  postPublishTypes
} = require("../controllers/publishRealEstateTypes");
const {
  getPublishInputs,
  postPublishInputs
} = require("../controllers/publishRealEstate");
const { getViewRealEstate } = require("../controllers/viewRealEstate");
const {
  getQueryReview,
  postQueryReview
} = require("../controllers/queryReview");
const { getGoAgain } = require("../controllers/goAgain");
const { publishSuccess } = require("../controllers/publishSuccess");
const { editSuccess } = require("../controllers/editSuccess");
const { getLocation, postLocation } = require("../controllers/location");
const { getUnsubscribe } = require("../controllers/unsubscribe");
const { getDeletePublishedAd } = require("../controllers/deleteRealEstate");
const { getRealEstates } = require("../controllers/realEstates");
const { getRedirect } = require("../controllers/redirect");
const { getFilters, postFilters } = require("../controllers/realEstateFilters");

const router = express.Router();

router.get("/", getWelcome);
router.post("/", postWelcome);

router.get("/vrstanekretnine/:searchRequestId", getRealEstateTypes);
router.get("/vrstanekretnine", getRealEstateTypes);
router.post("/vrstanekretnine/:searchRequestId", postRealEstateTypes);
router.post("/vrstanekretnine", postRealEstateTypes);

router.get("/objavinekretninu/:kiviRealEstateId", getPublishTypes);
router.get("/objavinekretninu", getPublishTypes);
router.post("/objavinekretninu/:kiviRealEstateId", postPublishTypes);
router.post("/objavinekretninu", postPublishTypes);

router.get("/podacionekretnini/:kiviRealEstateId", getPublishInputs);
router.post("/podacionekretnini/:kiviRealEstateId", postPublishInputs);

router.get("/preglednekretnine/:realEstateId", getViewRealEstate);

router.get("/lokacija/:searchRequestId", getLocation);
router.post("/lokacija/:searchRequestId", postLocation);

router.get("/filteri/:searchRequestId", getFilters);
router.post("/filteri/:searchRequestId", postFilters);

router.get("/pregled/:searchRequestId", getQueryReview);
router.post("/pregled/:searchRequestId", postQueryReview);

router.get("/odjava/:searchRequestId", getUnsubscribe);

router.get("/obrisioglas/:kiviRealEstateId", getDeletePublishedAd);

router.get("/ponovo", getGoAgain);

router.get("/uspjesnaobjava", publishSuccess);

router.get("/uspjesnaizmjena", editSuccess);

router.get("/nekretnine/:searchRequestId", getRealEstates);

router.get("/redirect/:id", getRedirect);

module.exports = router;
