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

const BASIC_BOOLEAN_PUBLISH = [
  {
    dbField: "newBuilding",
    title: "Novogradnja",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.GARAGE
    ]
  },
  {
    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: "recentlyAdapted",
    title: "Nedavno adaptirano",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  }
];

const BASIC_INPUT_PUBLISH = [
  {
    dbField: "title",
    title: "Naslov",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ],
    constraint: ["required"]
  },
  {
    dbField: "shortDescription",
    title: "Opis",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ],
    constraint: []
  },
  {
    dbField: "price",
    title: "Cijena (KM)",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ],
    constraint: ["numerical"]
  },
  {
    dbField: "area",
    title: "Površina (m\xB2)",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ],
    constraint: ["numerical"]
  },
  {
    dbField: "gardenSize",
    title: "Površina okućnice (m\xB2)",
    categoriesToShow: [AD_CATEGORY.HOUSE, AD_CATEGORY.COTTAGE],
    constraint: ["numerical"]
  },
  {
    dbField: "streetName",
    title: "Adresa",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ],
    constraint: []
  },
  {
    dbField: "numberOfRooms",
    title: "Broj soba",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ],
    constraint: ["integer"]
  },
  {
    dbField: "numberOfFloors",
    title: "Broj spratova",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE
    ],
    constraint: ["integer"]
  },
  {
    dbField: "floor",
    title: "Sprat",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.OFFICE
    ],
    constraint: ["integer"]
  }
];

const BASIC_SEGMENT_PUBLISH = [
  {
    dbField: "furnishingType",
    title: "Namještaj",
    values: Object.keys(FURNISHING_TYPE).map(key => FURNISHING_TYPE[key]),
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  }
];

const ADDITIONAL_BOOLEAN_PUBLISH = [
  {
    dbField: "water",
    title: "Voda",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "electricity",
    title: "Struja",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.GARAGE
    ]
  },
  {
    dbField: "drainageSystem",
    title: "Kanalizacija",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "registeredInZkBooks",
    title: "Uknjiženo",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ]
  },

  {
    dbField: "parking",
    title: "Parking",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "garage",
    title: "Garaža",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "gas",
    title: "Plin",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "antiTheftDoor",
    title: "Blindirana vrata",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "airCondition",
    title: "Klimatizirano",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "phoneConnection",
    title: "Telefon",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "cableTV",
    title: "Kablovska",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "internet",
    title: "Internet",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE
    ]
  },
  {
    dbField: "basementAttic",
    title: "Podrum-Tavan",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE
    ]
  },
  {
    dbField: "storeRoom",
    title: "Ostava",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE
    ]
  },
  {
    dbField: "videoSurveillance",
    title: "Video nadzor",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.GARAGE
    ]
  },
  {
    dbField: "alarm",
    title: "Alarm",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.GARAGE
    ]
  },
  {
    dbField: "suitableForStudents",
    title: "Za studente",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE
    ]
  },
  {
    dbField: "includingBills",
    title: "Uključen trošak režija",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.GARAGE
    ]
  },
  {
    dbField: "animalsAllowed",
    title: "Kućni ljubimci dozvoljeni",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE
    ]
  },
  {
    dbField: "pool",
    title: "Bazen",
    categoriesToShow: [AD_CATEGORY.HOUSE, AD_CATEGORY.COTTAGE]
  },
  {
    dbField: "exchange",
    title: "Zamjena",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ]
  },
  {
    dbField: "urbanPlanPermit",
    title: "Urbanistička dozvola",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ]
  },
  {
    dbField: "buildingPermit",
    title: "Građevinska dozvola",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ]
  }
];

const ADDITIONAL_INPUT_PUBLISH = [
  {
    dbField: "longDescription",
    title: "Detaljan opis",
    categoriesToShow: [
      AD_CATEGORY.FLAT,
      AD_CATEGORY.HOUSE,
      AD_CATEGORY.APARTMENT,
      AD_CATEGORY.COTTAGE,
      AD_CATEGORY.OFFICE,
      AD_CATEGORY.LAND,
      AD_CATEGORY.GARAGE
    ]
  }
];

const ADDITIONAL_SEGMENT_PUBLISH = [
  {
    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: "Grijanje",
    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
    ]
  }
];

module.exports = {
  BASIC_INPUT_PUBLISH,
  BASIC_SEGMENT_PUBLISH,
  BASIC_BOOLEAN_PUBLISH,
  ADDITIONAL_BOOLEAN_PUBLISH,
  ADDITIONAL_INPUT_PUBLISH,
  ADDITIONAL_SEGMENT_PUBLISH
};
