"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getDataSource = void 0;
var _getPlacesOptions = require("./getPlacesOptions");
var _Finder = require("../Finder.constants");
const getDataSource = function () {
  let {
    config: {
      accomodation: {
        calendar = {},
        occupation,
        rooms: {
          maxOccupation: maxRooms
        } = {},
        variants = []
      } = {},
      chainSelector
    } = {},
    language,
    promo,
    type = _Finder.TYPE.HOTEL
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  let places;
  let placesSource;
  if (type === _Finder.TYPE.CHAIN && chainSelector) {
    const {
      placeHolder = {},
      trees = []
    } = chainSelector;
    places = {
      options: (0, _getPlacesOptions.getPlacesOptions)(trees, language),
      placeholder: placeHolder[language]
    };
    placesSource = trees;
  }
  return {
    calendar,
    occupation,
    places,
    placesSource,
    promo: promo ? {
      code: promo.code
    } : undefined,
    maxRooms,
    variants
  };
};
exports.getDataSource = getDataSource;
//# sourceMappingURL=getDataSource.js.map