Source: types/cart-item.js

/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
/* Copyright (c) 2018 Mobify Research & Development Inc. All rights reserved. */
/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

import PropTypes from 'prop-types'
import {PositiveInteger} from './positive-integer'

/**
 * @memberOf module:types
 * @typedef {Object} CartItem
 * @property {String} id The cart id.
 * @property {String} productId The id of the product.
 * @property {String} productName The name of the product.
 * @property {module:types.PositiveInteger} quantity The number of this product that is in the cart.
 * @property {Number} baseItemPrice The price of one of this product before discounts
 * @property {Number} baseLinePrice The price of all of this product before discounts (usually baseItemPrice multiplied by quantity)
 * @property {Number} itemPrice The price of one of these items after discounts
 * @property {Number} linePrice The price of all of this product after discounts (usually baseItemPrice multiplied by quantity)
 */
export const CartItem = {
    id: PropTypes.string.isRequired,
    productId: PropTypes.string.isRequired,
    productName: PropTypes.string,
    quantity: PositiveInteger.isRequired,
    baseItemPrice: PropTypes.number.isRequired,
    baseLinePrice: PropTypes.number.isRequired,
    itemPrice: PropTypes.number.isRequired,
    linePrice: PropTypes.number.isRequired,
}