square_api_client/models/measurement_unit.rs
1//! Model struct for MeasurementUnit type
2
3use serde::{Deserialize, Serialize};
4
5use super::{
6 enums::{
7 MeasurementUnitArea, MeasurementUnitGeneric, MeasurementUnitLength, MeasurementUnitTime,
8 MeasurementUnitUnitType, MeasurementUnitVolume, MeasurementUnitWeight,
9 },
10 MeasurementUnitCustom,
11};
12
13/// Represents a unit of measurement to use with a quantity, such as ounces or inches.
14///
15/// Exactly one of the following fields are required: `custom_unit`, `area_unit`, `length_unit`,
16/// `volume_unit`, and `weight_unit`.
17#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
18pub struct MeasurementUnit {
19 /// A custom unit of measurement defined by the seller using the Point of Sale app or ad-hoc as
20 /// an order line item.
21 pub custom_unit: Option<MeasurementUnitCustom>,
22 /// Represents a standard area unit.
23 pub area_unit: Option<MeasurementUnitArea>,
24 /// Represents a standard length unit.
25 pub length_unit: Option<MeasurementUnitLength>,
26 /// Represents a standard volume unit.
27 pub volume_unit: Option<MeasurementUnitVolume>,
28 /// Represents a standard unit of weight or mass.
29 pub weight_unit: Option<MeasurementUnitWeight>,
30 /// Reserved for API integrations that lack the ability to specify a real measurement unit.
31 pub generic_unit: Option<MeasurementUnitGeneric>,
32 /// Represents a standard unit of time.
33 pub time_unit: Option<MeasurementUnitTime>,
34 /// Represents the type of the measurement unit.
35 pub r#type: Option<MeasurementUnitUnitType>,
36}