/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Copyright (c) 2018 Mobify Research & Development Inc. All rights reserved. */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
import PropTypes from 'prop-types'
import {CustomerInformation} from './customer-info'
import {CartItem} from './cart-item'
import {OrderAddress} from './order-address'
import {ShippingMethod} from './shipping-method'
import {Payment} from './payment'
import {PaymentMethod} from './payment-method'
/**
* @memberOf module:types
* @typedef {Object} Cart
* @property {String} id The cart id.
* @property {module:type.CustomerInformation} customerInfo The information about the cart owner.
* @property {Array.<module:type.CartItem>} items The cart items.
* @property {module:type.OrderAddress} shippingAddress The address to ship to.
* @property {module:type.OrderAddress} billingAddress The address to bill to.
* @property {Array.<module:type.ShippingMethod>} shippingMethods All the possible shipping methods for the cart.
* @property {Array.<module:type.PaymentMethod>} paymentMethods All the possible payment methods for the cart.
* @property {String} selectedShippingMethodId The currently selected shipping method for the cart.
* @property {Array.<module:type.Payment>} payments All the current payments on the cart (i.e. credit card, gift card etc).
* @property {Number} subtotal The subtotal before shipping, discounts, and tax.
* @property {Number} shipping The shipping cost.
* @property {Number} discounts The total of all the discounts applied to the cart.
* @property {Number} tax The total tax of the cart.
* @property {Number} total The total cost of all the items in the cart after discounts, shipping, tax.
*
*/
export const Cart = {
id: PropTypes.string.isRequired,
customerInfo: PropTypes.shape(CustomerInformation),
items: PropTypes.arrayOf(PropTypes.shape(CartItem)),
shippingAddress: PropTypes.shape(OrderAddress),
billingAddress: PropTypes.shape(OrderAddress),
shippingMethods: PropTypes.arrayOf(PropTypes.shape(ShippingMethod)),
paymentMethods: PropTypes.arrayOf(PropTypes.shape(PaymentMethod)),
selectedShippingMethodId: PropTypes.string,
payments: PropTypes.arrayOf(PropTypes.shape(Payment)),
subtotal: PropTypes.number.isRequired,
shipping: PropTypes.number.isRequired,
discounts: PropTypes.number.isRequired,
tax: PropTypes.number.isRequired,
total: PropTypes.number.isRequired
}