pipedrive_rs/models/
list_products_response200_all_of_data_inner.rs

1/*
2 * Pipedrive API v1
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ListProductsResponse200AllOfDataInner {
16    /// The ID of the deal-product (the ID of the product attached to the deal)
17    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
18    pub id: Option<i32>,
19    /// The ID of the deal
20    #[serde(rename = "deal_id", skip_serializing_if = "Option::is_none")]
21    pub deal_id: Option<i32>,
22    /// The order number of the product
23    #[serde(rename = "order_nr", skip_serializing_if = "Option::is_none")]
24    pub order_nr: Option<i32>,
25    /// The ID of the product
26    #[serde(rename = "product_id", skip_serializing_if = "Option::is_none")]
27    pub product_id: Option<i32>,
28    /// The ID of the product variation
29    #[serde(rename = "product_variation_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub product_variation_id: Option<Option<i32>>,
31    /// The price value of the product
32    #[serde(rename = "item_price", skip_serializing_if = "Option::is_none")]
33    pub item_price: Option<i32>,
34    /// The value of the discount. The `discount_type` field can be used to specify whether the value is an amount or a percentage.
35    #[serde(rename = "discount", skip_serializing_if = "Option::is_none")]
36    pub discount: Option<f32>,
37    /// The type of the discount's value.
38    #[serde(rename = "discount_type", skip_serializing_if = "Option::is_none")]
39    pub discount_type: Option<DiscountType>,
40    /// The duration of the product
41    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
42    pub duration: Option<i32>,
43    /// The type of the duration. (For example hourly, daily, etc.)
44    #[serde(rename = "duration_unit", skip_serializing_if = "Option::is_none")]
45    pub duration_unit: Option<String>,
46    /// The sum of all the products attached to the deal
47    #[serde(rename = "sum", skip_serializing_if = "Option::is_none")]
48    pub sum: Option<f32>,
49    /// The currency associated with the deal product
50    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
51    pub currency: Option<String>,
52    /// Whether the product is enabled or not
53    #[serde(rename = "enabled_flag", skip_serializing_if = "Option::is_none")]
54    pub enabled_flag: Option<bool>,
55    /// The date and time when the product was added to the deal
56    #[serde(rename = "add_time", skip_serializing_if = "Option::is_none")]
57    pub add_time: Option<String>,
58    /// The date and time when the deal product was last edited
59    #[serde(rename = "last_edit", skip_serializing_if = "Option::is_none")]
60    pub last_edit: Option<String>,
61    /// The comments of the product
62    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
63    pub comments: Option<String>,
64    /// Whether the product is active or not
65    #[serde(rename = "active_flag", skip_serializing_if = "Option::is_none")]
66    pub active_flag: Option<bool>,
67    /// The product tax
68    #[serde(rename = "tax", skip_serializing_if = "Option::is_none")]
69    pub tax: Option<f32>,
70    /// The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal.
71    #[serde(rename = "tax_method", skip_serializing_if = "Option::is_none")]
72    pub tax_method: Option<TaxMethod>,
73    /// The product name
74    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
75    pub name: Option<String>,
76    /// The formatted sum of the product
77    #[serde(rename = "sum_formatted", skip_serializing_if = "Option::is_none")]
78    pub sum_formatted: Option<String>,
79    /// The formatted quantity of the product
80    #[serde(rename = "quantity_formatted", skip_serializing_if = "Option::is_none")]
81    pub quantity_formatted: Option<String>,
82    /// The quantity of the product
83    #[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
84    pub quantity: Option<i32>,
85    #[serde(rename = "product", skip_serializing_if = "Option::is_none")]
86    pub product: Option<Box<crate::models::ListProductsResponse200AllOfDataInnerProduct>>,
87}
88
89impl ListProductsResponse200AllOfDataInner {
90    pub fn new() -> ListProductsResponse200AllOfDataInner {
91        ListProductsResponse200AllOfDataInner {
92            id: None,
93            deal_id: None,
94            order_nr: None,
95            product_id: None,
96            product_variation_id: None,
97            item_price: None,
98            discount: None,
99            discount_type: None,
100            duration: None,
101            duration_unit: None,
102            sum: None,
103            currency: None,
104            enabled_flag: None,
105            add_time: None,
106            last_edit: None,
107            comments: None,
108            active_flag: None,
109            tax: None,
110            tax_method: None,
111            name: None,
112            sum_formatted: None,
113            quantity_formatted: None,
114            quantity: None,
115            product: None,
116        }
117    }
118}
119
120/// The type of the discount's value.
121#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
122pub enum DiscountType {
123    #[serde(rename = "percentage")]
124    Percentage,
125    #[serde(rename = "amount")]
126    Amount,
127}
128
129impl Default for DiscountType {
130    fn default() -> DiscountType {
131        Self::Percentage
132    }
133}
134/// The tax option to be applied to the products. When using `inclusive`, the tax percentage will already be included in the price. When using `exclusive`, the tax will not be included in the price. When using `none`, no tax will be added. Use the `tax` field for defining the tax percentage amount. By default, the user setting value for tax options will be used. Changing this in one product affects the rest of the products attached to the deal.
135#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
136pub enum TaxMethod {
137    #[serde(rename = "exclusive")]
138    Exclusive,
139    #[serde(rename = "inclusive")]
140    Inclusive,
141    #[serde(rename = "none")]
142    None,
143}
144
145impl Default for TaxMethod {
146    fn default() -> TaxMethod {
147        Self::Exclusive
148    }
149}
150