amazon_spapi/models/vendor_invoices/total_weight.rs
1/*
2 * Selling Partner API for Retail Procurement Payments
3 *
4 * The Selling Partner API for Retail Procurement Payments provides programmatic access to vendors payments data.
5 *
6 * The version of the OpenAPI document: v1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// TotalWeight : The aggregate weight of this item being invoiced. This information will be available for items sold by weight.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TotalWeight {
17 /// The unit of measure for items sold by weight.
18 #[serde(rename = "unitOfMeasure")]
19 pub unit_of_measure: UnitOfMeasure,
20 /// A decimal number with no loss of precision. Useful when precision loss is unacceptable, as with currencies. Follows RFC7159 for number representation. <br>**Pattern** : `^-?(0|([1-9]\\d*))(\\.\\d+)?([eE][+-]?\\d+)?$`.
21 #[serde(rename = "amount")]
22 pub amount: String,
23}
24
25impl TotalWeight {
26 /// The aggregate weight of this item being invoiced. This information will be available for items sold by weight.
27 pub fn new(unit_of_measure: UnitOfMeasure, amount: String) -> TotalWeight {
28 TotalWeight {
29 unit_of_measure,
30 amount,
31 }
32 }
33}
34/// The unit of measure for items sold by weight.
35#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
36pub enum UnitOfMeasure {
37 #[serde(rename = "POUNDS")]
38 Pounds,
39 #[serde(rename = "OUNCES")]
40 Ounces,
41 #[serde(rename = "GRAMS")]
42 Grams,
43 #[serde(rename = "KILOGRAMS")]
44 Kilograms,
45}
46
47impl Default for UnitOfMeasure {
48 fn default() -> UnitOfMeasure {
49 Self::Pounds
50 }
51}
52