Liferay.Loader.define("commerce-frontend-js@3.0.40/ServiceProvider/commerce-delivery-cart/v1.0/CartItem", ['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',
        CART_ITEMS_PATH = '/cart-items',
        ITEMS_PATH = '/items';
    var VERSION = 'v1.0';

    function resolveItemsPath() {
      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).concat(ITEMS_PATH);
    }

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

    var _default = function _default(basePath) {
      return {
        createItemsByCartId: function createItemsByCartId(cartId, json) {
          return _index.default.POST(resolveItemsPath(basePath, cartId), json);
        },
        deleteItemById: function deleteItemById(itemId) {
          return _index.default.DELETE(resolveCartItemsPath(basePath, itemId));
        },
        getItemById: function getItemById(itemId) {
          return _index.default.GET(resolveCartItemsPath(basePath, itemId));
        },
        getItemsByCartId: function getItemsByCartId(cartId) {
          return _index.default.GET(resolveItemsPath(basePath, cartId));
        },
        replaceItemById: function replaceItemById(itemId, json) {
          return _index.default.PUT(resolveCartItemsPath(basePath, itemId), json);
        },
        updateItemById: function updateItemById(itemId, jsonProps) {
          return _index.default.PATCH(resolveCartItemsPath(basePath, itemId), jsonProps);
        }
      };
    };

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