import { lazy , object , optional , Schema , string } from '../schema' ; import { InventoryAdjustmentGroup , inventoryAdjustmentGroupSchema , } from './inventoryAdjustmentGroup' ; import { Money , moneySchema } from './money' ; import { SourceApplication , sourceApplicationSchema , } from './sourceApplication' ; /**
 * Represents a change in state or quantity of product inventory at a
 * particular time and location.
 */ export interface InventoryAdjustment { /**
     * A unique ID generated by Square for the
     * `InventoryAdjustment`.
     */ id ? : string ; /**
     * An optional ID provided by the application to tie the
     * `InventoryAdjustment` to an external
     * system.
     */ referenceId ? : string ; /** Indicates the state of a tracked item quantity in the lifecycle of goods. */ fromState ? : string ; /** Indicates the state of a tracked item quantity in the lifecycle of goods. */ toState ? : string ; /**
     * The Square-generated ID of the [Location]($m/Location) where the related
     * quantity of items is being tracked.
     */ locationId ? : string ; /**
     * The Square-generated ID of the
     * [CatalogObject]($m/CatalogObject) being tracked.
     */ catalogObjectId ? : string ; /**
     * The [type]($m/CatalogObjectType) of the
     * [CatalogObject]($m/CatalogObject) being tracked. Tracking is only
     * supported for the `ITEM_VARIATION` type.
     */ catalogObjectType ? : string ; /**
     * The number of items affected by the adjustment as a decimal string.
     * Can support up to 5 digits after the decimal point.
     */ quantity ? : string ; /**
     * 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.
     */ totalPriceMoney ? : Money ; /**
     * A client-generated RFC 3339-formatted timestamp that indicates when
     * the inventory adjustment took place. For inventory adjustment updates, the `occurred_at`
     * timestamp cannot be older than 24 hours or in the future relative to the
     * time of the request.
     */ occurredAt ? : string ; /** An RFC 3339-formatted timestamp that indicates when the inventory adjustment is received. */ createdAt ? : string ; /** Provides information about the application used to generate a change. */ source ? : SourceApplication ; /**
     * The Square-generated ID of the [Employee]($m/Employee) responsible for the
     * inventory adjustment.
     */ employeeId ? : string ; /**
     * The Square-generated ID of the [Transaction][#type-transaction] that
     * caused the adjustment. Only relevant for payment-related state
     * transitions.
     */ transactionId ? : string ; /**
     * The Square-generated ID of the [Refund][#type-refund] that
     * caused the adjustment. Only relevant for refund-related state
     * transitions.
     */ refundId ? : string ; /**
     * The Square-generated ID of the purchase order that caused the
     * adjustment. Only relevant for state transitions from the Square for Retail
     * app.
     */ purchaseOrderId ? : string ; /**
     * The Square-generated ID of the goods receipt that caused the
     * adjustment. Only relevant for state transitions from the Square for Retail
     * app.
     */ goodsReceiptId ? : string ; adjustmentGroup ? : InventoryAdjustmentGroup ; } export const inventoryAdjustmentSchema = object ( { id : [ 'id' , optional ( string ( ) ) ] , referenceId : [ 'reference_id' , optional ( string ( ) ) ] , fromState : [ 'from_state' , optional ( string ( ) ) ] , toState : [ 'to_state' , optional ( string ( ) ) ] , locationId : [ 'location_id' , optional ( string ( ) ) ] , catalogObjectId : [ 'catalog_object_id' , optional ( string ( ) ) ] , catalogObjectType : [ 'catalog_object_type' , optional ( string ( ) ) ] , quantity : [ 'quantity' , optional ( string ( ) ) ] , totalPriceMoney : [ 'total_price_money' , optional ( lazy ( ( ) => moneySchema ) ) ] , occurredAt : [ 'occurred_at' , optional ( string ( ) ) ] , createdAt : [ 'created_at' , optional ( string ( ) ) ] , source : [ 'source' , optional ( lazy ( ( ) => sourceApplicationSchema ) ) ] , employeeId : [ 'employee_id' , optional ( string ( ) ) ] , transactionId : [ 'transaction_id' , optional ( string ( ) ) ] , refundId : [ 'refund_id' , optional ( string ( ) ) ] , purchaseOrderId : [ 'purchase_order_id' , optional ( string ( ) ) ] , goodsReceiptId : [ 'goods_receipt_id' , optional ( string ( ) ) ] , adjustmentGroup : [ 'adjustment_group' , optional ( lazy ( ( ) => inventoryAdjustmentGroupSchema ) ) , ] , } ) ;