"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.prepareRoom = void 0;
var _Occupation = require("../components/__shared__/Occupation/Occupation.constants");
const {
  CHILD
} = _Occupation.TYPE;
const prepareRoom = function () {
  let dataSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  const room = [];
  dataSource.forEach((_ref, index) => {
    let {
      max,
      min = 0,
      type
    } = _ref;
    if (min || type !== CHILD) {
      const amount = type !== CHILD && (max > 1 || max === undefined) && _Occupation.DEFAULT_AMOUNT >= min ? _Occupation.DEFAULT_AMOUNT : min;
      room[index] = {
        ages: Array.from({
          length: amount
        }, () => undefined),
        amount,
        type
      };
    }
  });
  return room;
};
exports.prepareRoom = prepareRoom;
//# sourceMappingURL=prepareRoom.js.map