"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.parseRate = void 0;
var _legacy = require("../../helpers/legacy");
const parseRate = function () {
  let rate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  let hotelCurrency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  let nights = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  return {
    averagePrice: rate.price,
    // ? TODO: Why?
    boardName: rate.boardName,
    occupation: {
      numAdults: rate.adults,
      numChildren: rate.childrenFirtsRange + rate.childrenSecondRange,
      numBabies: rate.babies
    },
    priceWithoutTaxes: (0, _legacy.formatPrice)(rate.totalPriceWithoutTaxes, hotelCurrency),
    priceWithTaxes: (0, _legacy.formatPrice)(rate.totalPriceWithTaxes, hotelCurrency),
    rateName: rate.rateName,
    roomTypeName: rate.roomTypeName,
    unitaryPriceWithoutTaxes: (0, _legacy.formatPrice)((rate.totalPriceWithoutTaxes / nights).toFixed(0), hotelCurrency)
  };
};
exports.parseRate = parseRate;
//# sourceMappingURL=parseRate.js.map