/**
 * Paypal Server SDKLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { lazy, object, optional, Schema } from '../schema';
import { Money, moneySchema } from './money';

/** The breakdown of the amount. Breakdown provides details such as total item amount, total tax amount, shipping, handling, insurance, and discounts, if any. */
export interface AmountBreakdown {
  /** The currency and amount for a financial transaction, such as a balance or payment due. */
  itemTotal?: Money;
  /** The currency and amount for a financial transaction, such as a balance or payment due. */
  shipping?: Money;
  /** The currency and amount for a financial transaction, such as a balance or payment due. */
  handling?: Money;
  /** The currency and amount for a financial transaction, such as a balance or payment due. */
  taxTotal?: Money;
  /** The currency and amount for a financial transaction, such as a balance or payment due. */
  insurance?: Money;
  /** The currency and amount for a financial transaction, such as a balance or payment due. */
  shippingDiscount?: Money;
  /** The currency and amount for a financial transaction, such as a balance or payment due. */
  discount?: Money;
}

export const amountBreakdownSchema: Schema<AmountBreakdown> = object({
  itemTotal: ['item_total', optional(lazy(() => moneySchema))],
  shipping: ['shipping', optional(lazy(() => moneySchema))],
  handling: ['handling', optional(lazy(() => moneySchema))],
  taxTotal: ['tax_total', optional(lazy(() => moneySchema))],
  insurance: ['insurance', optional(lazy(() => moneySchema))],
  shippingDiscount: ['shipping_discount', optional(lazy(() => moneySchema))],
  discount: ['discount', optional(lazy(() => moneySchema))],
});
