import { array , bigint , dict , lazy , object , optional , Schema , string , } from '../schema' ; import { Money , moneySchema } from './money' ; import { OrderLineItemAppliedDiscount , orderLineItemAppliedDiscountSchema , } from './orderLineItemAppliedDiscount' ; import { OrderLineItemAppliedTax , orderLineItemAppliedTaxSchema , } from './orderLineItemAppliedTax' ; import { OrderLineItemModifier , orderLineItemModifierSchema , } from './orderLineItemModifier' ; import { OrderLineItemPricingBlocklists , orderLineItemPricingBlocklistsSchema , } from './orderLineItemPricingBlocklists' ; import { OrderQuantityUnit , orderQuantityUnitSchema , } from './orderQuantityUnit' ; /**
 * Represents a line item in an order. Each line item describes a different
 * product to purchase, with its own quantity and price details.
 */ export interface OrderLineItem { /** A unique ID that identifies the line item only within this order. */ uid ? : string ; /** The name of the line item. */ name ? : string ; /**
     * The quantity purchased, formatted as a decimal number.
     * For example, `"3"`.
     * Line items with a quantity of `"0"` are automatically removed
     * when paying for or otherwise completing the order.
     * Line items with a `quantity_unit` can have non-integer quantities.
     * For example, `"1.70000"`.
     */ quantity : string ; /**
     * Contains the measurement unit for a quantity and a precision that
     * specifies the number of digits after the decimal point for decimal quantities.
     */ quantityUnit ? : OrderQuantityUnit ; /** The note of the line item. */ note ? : string ; /** The [CatalogItemVariation]($m/CatalogItemVariation) ID applied to this line item. */ catalogObjectId ? : string ; /** The version of the catalog object that this line item references. */ catalogVersion ? : bigint ; /** The name of the variation applied to this line item. */ variationName ? : string ; /** Represents the line item type. */ itemType ? : string ; /**
     * Application-defined data attached to this line item. Metadata fields are intended
     * to store descriptive references or associations with an entity in another system or store brief
     * information about the object. Square does not process this field; it only stores and returns it
     * in relevant API calls. Do not use metadata to store any sensitive information (such as personally
     * identifiable information or card details).
     * Keys written by applications must be 60 characters or less and must be in the character set
     * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
     * with a namespace, separated from the key with a ':' character.
     * Values have a maximum length of 255 characters.
     * An application can have up to 10 entries per metadata field.
     * Entries written by applications are private and can only be read or modified by the same
     * application.
     * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
     */ metadata ? : Record < string , string > ; /** The [CatalogModifier]($m/CatalogModifier)s applied to this line item. */ modifiers ? : OrderLineItemModifier [ ] ; /**
     * The list of references to taxes applied to this line item. Each
     * `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a
     * top-level `OrderLineItemTax` applied to the line item. On reads, the
     * amount applied is populated.
     * An `OrderLineItemAppliedTax` is automatically created on every line
     * item for all `ORDER` scoped taxes added to the order. `OrderLineItemAppliedTax`
     * records for `LINE_ITEM` scoped taxes must be added in requests for the tax
     * to apply to any line items.
     * To change the amount of a tax, modify the referenced top-level tax.
     */ appliedTaxes ? : OrderLineItemAppliedTax [ ] ; /**
     * The list of references to discounts applied to this line item. Each
     * `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level
     * `OrderLineItemDiscounts` applied to the line item. On reads, the amount
     * applied is populated.
     * An `OrderLineItemAppliedDiscount` is automatically created on every line item for all
     * `ORDER` scoped discounts that are added to the order. `OrderLineItemAppliedDiscount` records
     * for `LINE_ITEM` scoped discounts must be added in requests for the discount to apply to any
     * line items.
     * To change the amount of a discount, modify the referenced top-level discount.
     */ appliedDiscounts ? : OrderLineItemAppliedDiscount [ ] ; /**
     * Represents an amount of money. `Money` fields can be signed or unsigned.
     * Fields that do not explicitly define whether they are signed or unsigned are
     * considered unsigned and can only hold positive amounts. For signed fields, the
     * sign of the value indicates the purpose of the money transfer. See
     * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
     * for more information.
     */ basePriceMoney ? : Money ; /**
     * Represents an amount of money. `Money` fields can be signed or unsigned.
     * Fields that do not explicitly define whether they are signed or unsigned are
     * considered unsigned and can only hold positive amounts. For signed fields, the
     * sign of the value indicates the purpose of the money transfer. See
     * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
     * for more information.
     */ variationTotalPriceMoney ? : Money ; /**
     * Represents an amount of money. `Money` fields can be signed or unsigned.
     * Fields that do not explicitly define whether they are signed or unsigned are
     * considered unsigned and can only hold positive amounts. For signed fields, the
     * sign of the value indicates the purpose of the money transfer. See
     * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
     * for more information.
     */ grossSalesMoney ? : Money ; /**
     * Represents an amount of money. `Money` fields can be signed or unsigned.
     * Fields that do not explicitly define whether they are signed or unsigned are
     * considered unsigned and can only hold positive amounts. For signed fields, the
     * sign of the value indicates the purpose of the money transfer. See
     * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
     * for more information.
     */ totalTaxMoney ? : Money ; /**
     * Represents an amount of money. `Money` fields can be signed or unsigned.
     * Fields that do not explicitly define whether they are signed or unsigned are
     * considered unsigned and can only hold positive amounts. For signed fields, the
     * sign of the value indicates the purpose of the money transfer. See
     * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
     * for more information.
     */ totalDiscountMoney ? : Money ; /**
     * Represents an amount of money. `Money` fields can be signed or unsigned.
     * Fields that do not explicitly define whether they are signed or unsigned are
     * considered unsigned and can only hold positive amounts. For signed fields, the
     * sign of the value indicates the purpose of the money transfer. See
     * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
     * for more information.
     */ totalMoney ? : Money ; /**
     * Describes pricing adjustments that are blocked from manual and
     * automatic application to a line item. For more information, see
     * [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts).
     */ pricingBlocklists ? : OrderLineItemPricingBlocklists ; } export const orderLineItemSchema = object ( { uid : [ 'uid' , optional ( string ( ) ) ] , name : [ 'name' , optional ( string ( ) ) ] , quantity : [ 'quantity' , string ( ) ] , quantityUnit : [ 'quantity_unit' , optional ( lazy ( ( ) => orderQuantityUnitSchema ) ) , ] , note : [ 'note' , optional ( string ( ) ) ] , catalogObjectId : [ 'catalog_object_id' , optional ( string ( ) ) ] , catalogVersion : [ 'catalog_version' , optional ( bigint ( ) ) ] , variationName : [ 'variation_name' , optional ( string ( ) ) ] , itemType : [ 'item_type' , optional ( string ( ) ) ] , metadata : [ 'metadata' , optional ( dict ( string ( ) ) ) ] , modifiers : [ 'modifiers' , optional ( array ( lazy ( ( ) => orderLineItemModifierSchema ) ) ) , ] , appliedTaxes : [ 'applied_taxes' , optional ( array ( lazy ( ( ) => orderLineItemAppliedTaxSchema ) ) ) , ] , appliedDiscounts : [ 'applied_discounts' , optional ( array ( lazy ( ( ) => orderLineItemAppliedDiscountSchema ) ) ) , ] , basePriceMoney : [ 'base_price_money' , optional ( lazy ( ( ) => moneySchema ) ) ] , variationTotalPriceMoney : [ 'variation_total_price_money' , optional ( lazy ( ( ) => moneySchema ) ) , ] , grossSalesMoney : [ 'gross_sales_money' , optional ( lazy ( ( ) => moneySchema ) ) ] , totalTaxMoney : [ 'total_tax_money' , optional ( lazy ( ( ) => moneySchema ) ) ] , totalDiscountMoney : [ 'total_discount_money' , optional ( lazy ( ( ) => moneySchema ) ) , ] , totalMoney : [ 'total_money' , optional ( lazy ( ( ) => moneySchema ) ) ] , pricingBlocklists : [ 'pricing_blocklists' , optional ( lazy ( ( ) => orderLineItemPricingBlocklistsSchema ) ) , ] , } ) ;