square_api_client/models/
catalog_item_variation.rs

1//! Model struct for CatalogItemVariation type.
2
3use serde::{Deserialize, Serialize};
4
5use super::{
6    enums::{CatalogPricingType, InventoryAlertType},
7    CatalogItemOptionValueForItemVariation, CatalogStockConversion, ItemVariationLocationOverrides,
8    Money,
9};
10
11/// An item variation (i.e., product) in the Catalog object model.
12///
13/// Each item may have a maximum of 250 item variations.
14#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
15pub struct CatalogItemVariation {
16    /// The ID of the `CatalogItem` associated with this item variation.
17    pub item_id: Option<String>,
18    /// The item variation's name. This is a searchable attribute for use in applicable query
19    /// filters, and its value length is of Unicode code points.
20    ///
21    /// Max Length 255
22    pub name: Option<String>,
23    /// The item variation's SKU, if any. This is a searchable attribute for use in applicable query
24    /// filters.
25    pub sku: Option<String>,
26    /// The universal product code (UPC) of the item variation, if any. This is a searchable
27    /// attribute for use in applicable query filters.
28    ///
29    /// The value of this attribute should be a number of 12-14 digits long. This restriction is
30    /// enforced on the Square Seller Dashboard, Square Point of Sale or Retail Point of Sale apps,
31    /// where this attribute shows in the GTIN field. If a non-compliant UPC value is assigned to
32    /// this attribute using the API, the value is not editable on the Seller Dashboard, Square
33    /// Point of Sale or Retail Point of Sale apps unless it is updated to fit the expected format.
34    pub upc: Option<String>,
35    /// **Read only** The order in which this item variation should be displayed. This value is
36    /// read-only. On writes, the ordinal for each item variation within a parent `CatalogItem` is
37    /// set according to the item variations's position. On reads, the value is not guaranteed to be
38    /// sequential or unique.
39    pub ordinal: Option<i32>,
40    /// Indicates whether the item variation's price is fixed or determined at the time of sale.
41    pub pricing_type: Option<CatalogPricingType>,
42    /// The item variation's price, if fixed pricing is used.
43    pub price_money: Option<Money>,
44    /// Per-location price and inventory overrides.
45    pub location_overrides: Option<Vec<ItemVariationLocationOverrides>>,
46    /// If `true`, inventory tracking is active for the variation.
47    pub track_inventory: Option<bool>,
48    /// Indicates whether the item variation displays an alert when its inventory quantity is less
49    /// than or equal to its `inventory_alert_threshold`.
50    pub inventory_alert_type: Option<InventoryAlertType>,
51    /// If the inventory quantity for the variation is less than or equal to this value and
52    /// `inventory_alert_type` is `LOW_QUANTITY`, the variation displays an alert in the merchant
53    /// dashboard.
54    ///
55    /// This value is always an integer.
56    pub inventory_alert_threshold: Option<i64>,
57    /// Arbitrary user metadata to associate with the item variation. This attribute value length is
58    /// of Unicode code points.
59    ///
60    /// Max Length 255
61    pub user_data: Option<String>,
62    /// If the `CatalogItem` that owns this item variation is of type `APPOINTMENTS_SERVICE`, then
63    /// this is the duration of the service in milliseconds. For example, a 30 minute appointment
64    /// would have the value `1800000`, which is equal to 30 (minutes) * 60 (seconds per minute) *
65    /// 1000 (milliseconds per second).
66    pub service_duration: Option<i64>,
67    /// If the `CatalogItem` that owns this item variation is of type `APPOINTMENTS_SERVICE`, a bool
68    /// representing whether this service is available for booking.
69    pub available_for_booking: Option<bool>,
70    /// List of item option values associated with this item variation. Listed in the same order as
71    /// the item options of the parent item.
72    pub item_option_values: Option<Vec<CatalogItemOptionValueForItemVariation>>,
73    /// ID of the `CatalogMeasurementUnit` that is used to measure the quantity sold of this item
74    /// variation. If left unset, the item will be sold in whole quantities.
75    pub measurement_unit_id: Option<String>,
76    /// Whether this variation can be sold.
77    pub sellable: Option<bool>,
78    /// Whether stock is counted directly on this variation (TRUE) or only on its components
79    /// (FALSE).
80    pub stockable: Option<bool>,
81    /// The IDs of images associated with this `CatalogItemVariation` instance. These images will be
82    /// shown to customers in Square Online Store.
83    pub image_ids: Option<Vec<String>>,
84    /// Tokens of employees that can perform the service represented by this variation. Only valid
85    /// for variations of type `APPOINTMENTS_SERVICE`.
86    pub team_member_ids: Option<Vec<String>>,
87    /// The rule of conversion of the [CatalogStockConversion] type that describes how this
88    /// non-stockable sellable/receivable item variation is converted to/from the stockable item
89    /// variation sharing the same parent item.
90    pub stockable_conversion: Option<CatalogStockConversion>,
91}