1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Model struct for InventoryAdjustment type

use serde::{Deserialize, Serialize};

use super::{enums::InventoryState, InventoryAdjustmentGroup, Money, SourceApplication};

/// Represents a change in state or quantity of product inventory at a particular time and location.
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct InventoryAdjustment {
    /// A unique ID generated by Square for the InventoryAdjustment.
    pub id: String,
    /// An optional ID provided by the application to tie the InventoryAdjustment
    pub reference_id: String,
    /// The current inventory state for the related quantity of items.
    pub from_state: InventoryState,
    /// The current inventory state for the related quantity of items.
    pub to_state: InventoryState,
    /// The Square-generated ID of the Location where the related quantity of items is being tracked.
    pub location_id: String,
    /// The Square-generated ID of the CatalogObject being tracked.
    pub catalog_object_id: String,
    /// The type of the CatalogObject being tracked.
    /// The Inventory API supports setting and reading the "catalog_object_type": "ITEM_VARIATION"
    /// In addition, it can also read the "catalog_object_type": "ITEM"
    pub catalog_object_type: String,
    ///The number of items affected by the estimated count as a decimal string.
    pub quantity: String,
    /// Read only The total price paid for goods associated with the adjustment.
    /// Present if and only if to_state is SOLD. Always non-negative.
    pub total_price_money: Option<Money>,
    /// Read only An RFC 3339-formatted timestamp that indicates when the most recent physical
    /// count or adjustment affecting the estimated count is received.
    pub occurred_at: String,
    ///Read only RFC 3339-formatted timestamp that indicates when the inventory adjustment is received.
    pub created_at: String,
    /// The current inventory state for the related quantity of items.
    pub source: SourceApplication,
    /// The Square-generated ID of the Employee responsible for the inventory adjustment.
    pub employee_id: String,
    /// The Square-generated ID of the Team Member responsible for the inventory adjustment.
    pub team_member_id: String,
    /// Read only The Square-generated ID of the Transaction that caused the adjustment.
    /// Only relevant for payment-related state transitions.
    pub transaction_id: String,
    /// Read only The Square-generated ID of the Refund that caused the adjustment.
    /// Only relevant for refund-related state transitions.
    pub refund_id: String,
    /// Read only The Square-generated ID of the purchase order that caused the adjustment.
    /// Only relevant for state transitions from the Square for Retail app.
    pub purchase_order_id: String,
    /// Read only The Square-generated ID of the goods receipt that caused the adjustment.
    /// Only relevant for state transitions from the Square for Retail app.
    pub goods_receipt_id: String,
    /// Read only An adjustment group bundling the related adjustments of item variations
    /// through stock conversions in a single inventory event.
    pub adjustment_group: InventoryAdjustmentGroup,
}