"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getRatesPriceRange = void 0;
var _getRoomPriceRange = require("./getRoomPriceRange");
const getRatesPriceRange = function () {
  let roomTypes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  let currencyInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  let min;
  let max;
  Object.keys(roomTypes).forEach(roomType => {
    const {
      minRate,
      maxRate
    } = (0, _getRoomPriceRange.getRoomPriceRange)(roomTypes[roomType], currencyInfo);
    if (minRate != null && (!min || parseInt(minRate.priceAsLong) < parseInt(min.priceAsLong))) min = minRate;
    if (maxRate != null && (!max || parseInt(maxRate.priceAsLong) > parseInt(max.priceAsLong))) max = maxRate;
  });
  return {
    minRate: min || {},
    maxRate: max || {}
  };
};
exports.getRatesPriceRange = getRatesPriceRange;
//# sourceMappingURL=getRatesPriceRange.js.map