"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Order = void 0;

var _propTypes = _interopRequireDefault(require("prop-types"));

var _customerInfo = require("./customer-info");

var _cartItem = require("./cart-item");

var _orderAddress = require("./order-address");

var _payment = require("./payment");

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

/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

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

/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

/**
 * @memberOf module:types
 * @typedef {Object} Order
 * @property {String} id The order id.
 * @property {String} creationDate The date when the order was created.
 * @property {String} status The status of the order (such as validated, processed, shipped, or cancelled).
 * @property {module:types.CustomerInformation} customerInfo Information about the customer.
 * @property {Array.<module:types.CartItem>} items The order items.
 * @property {module:types.OrderAddress} shippingAddress The order's destination shipping address.
 * @property {module:types.OrderAddress} billingAddress The order's billing address.
 * @property {String} selectedShippingMethodId The selected shipping method for the order.
 * @property {Array.<module:types.Payment>} payments All the current payments for the order.
 * @property {Number} subtotal The subtotal before shipping, discounts, and tax.
 * @property {Number} shipping The shipping cost.
 * @property {Number} discounts The total discounts applied to the order.
 * @property {Number} tax The order's total tax.
 * @property {Number} total The order's total cost after discounts, shipping, and tax.
 *
 */
var Order = {
  id: _propTypes["default"].string.isRequired,
  creationDate: _propTypes["default"].instanceOf(Date),
  status: _propTypes["default"].string,
  customerInfo: _propTypes["default"].shape(_customerInfo.CustomerInformation),
  items: _propTypes["default"].arrayOf(_propTypes["default"].shape(_cartItem.CartItem)),
  shippingAddress: _propTypes["default"].shape(_orderAddress.OrderAddress),
  billingAddress: _propTypes["default"].shape(_orderAddress.OrderAddress),
  selectedShippingMethodId: _propTypes["default"].string,
  payments: _propTypes["default"].arrayOf(_propTypes["default"].shape(_payment.Payment)),
  subtotal: _propTypes["default"].number.isRequired,
  shipping: _propTypes["default"].number.isRequired,
  discounts: _propTypes["default"].number.isRequired,
  tax: _propTypes["default"].number.isRequired,
  total: _propTypes["default"].number.isRequired
};
exports.Order = Order;