const { AD_CATEGORY, ACCESS_ROAD_TYPE, HEATING_TYPE } = require("./enums");

const ADVANCED_BOOLEAN_FILTERS = [
  {
    dbField: "balcony",
    title: "Balkon",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE
    ]
  },
  {
    dbField: "elevator",
    title: "Lift",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "newBuilding",
    title: "Novogradnja",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  }
];

const ADVANCED_SEGMENT_SELECT_FILTERS = [
  {
    dbField: "accessRoadType",
    title: "Pristupni put",
    values: Object.keys(ACCESS_ROAD_TYPE).map(key => ACCESS_ROAD_TYPE[key]),
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ]
  }
  // {
  //   dbField: "heatingType",
  //   title: "Vrsta grijanja",
  //   values: Object.keys(HEATING_TYPE).map(key => HEATING_TYPE[key]),
  //   categoriesToShow: [
  //     AD_CATEGORY.FLAT,
  //     AD_CATEGORY.HOUSE,
  //     AD_CATEGORY.APARTMENT,
  //     AD_CATEGORY.COTTAGE,
  //     AD_CATEGORY.OFFICE
  //   ]
  // }
];

const ADVANCED_RANGE_FILTERS = [
  {
    id: "numberOfFloors",
    title: "Broj spratova",
    dbFieldMin: "numberOfFloorsMin",
    dbFieldMax: "numberOfFloorsMax",
    validValueMin: -1,
    validValueMax: 50,
    categoriesToShow: [AD_CATEGORY.HOUSE, AD_CATEGORY.COTTAGE]
  },
  {
    id: "floor",
    title: "Sprat",
    dbFieldMin: "floorMin",
    dbFieldMax: "floorMax",
    validValueMin: -10,
    validValueMax: 50,
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    id: "numberOfRooms",
    title: "Broj soba",
    dbFieldMin: "numberOfRoomsMin",
    dbFieldMax: "numberOfRoomsMax",
    decimalPlaces: 1,
    validValueMin: 0,
    validValueMax: 200,
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  }
];

module.exports = {
  ADVANCED_BOOLEAN_FILTERS,
  ADVANCED_SEGMENT_SELECT_FILTERS,
  ADVANCED_RANGE_FILTERS
};
