Liferay.Loader.define("commerce-frontend-js@3.0.30/ServiceProvider/commerce-delivery-cart/v1.0/Cart", ['module', 'exports', 'require', '../../../utilities/AJAX/index'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _index = _interopRequireDefault(require("../../../utilities/AJAX/index"));

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * This library is free software; you can redistribute it and/or modify it under
     * the terms of the GNU Lesser General Public License as published by the Free
     * Software Foundation; either version 2.1 of the License, or (at your option)
     * any later version.
     *
     * This library is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
     * details.
     */
    var CARTS_PATH = '/carts',
        CHANNELS_PATH = '/channels';
    var VERSION = 'v1.0';

    function resolveCartsPath() {
      var basePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
      var cartId = arguments.length > 1 ? arguments[1] : undefined;
      return "".concat(basePath).concat(VERSION).concat(CARTS_PATH, "/").concat(cartId);
    }

    function resolveChannelsPath() {
      var basePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
      var channelId = arguments.length > 1 ? arguments[1] : undefined;
      return "".concat(basePath).concat(VERSION).concat(CHANNELS_PATH, "/").concat(channelId).concat(CARTS_PATH);
    }

    var _default = function _default(basePath) {
      return {
        createCartByChannelId: function createCartByChannelId(channelId, json) {
          return _index.default.POST(resolveChannelsPath(basePath, channelId), json);
        },
        createCouponCodeByCartId: function createCouponCodeByCartId(cartId, json) {
          return _index.default.POST("".concat(resolveCartsPath(basePath, cartId), "/coupon-code"), json);
        },
        deleteCartById: function deleteCartById(cartId) {
          return _index.default.DELETE(resolveCartsPath(basePath, cartId));
        },
        getCartById: function getCartById(cartId) {
          return _index.default.GET(resolveCartsPath(basePath, cartId));
        },
        getCartByIdWithItems: function getCartByIdWithItems(cartId) {
          return _index.default.GET(resolveCartsPath(basePath, cartId) + '?nestedFields=cartItems');
        },
        getCartsByChannelId: function getCartsByChannelId(channelId) {
          return _index.default.GET(resolveChannelsPath(basePath, channelId));
        },
        replaceCartById: function replaceCartById(cartId, json) {
          return _index.default.PUT(resolveCartsPath(basePath, cartId), json);
        },
        updateCartById: function updateCartById(cartId, jsonProps) {
          return _index.default.PATCH(resolveCartsPath(basePath, cartId), jsonProps);
        }
      };
    };

    exports.default = _default;
    //# sourceMappingURL=Cart.js.map
  }
});
//# sourceMappingURL=Cart.js.map