Liferay.Loader.define("commerce-frontend-js@3.0.43/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 };
    }

    /**
     * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
     * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
     */
    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