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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use crate::impl_visitable_noop;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[cfg_attr(feature = "schema", schemars(deny_unknown_fields))]
#[serde(rename_all = "camelCase")]
pub struct Commercial {
/// The instance id of the product in the configurator/basket.
pub id: String,
/// The instance id of an associated master product, e.g. a set.
pub master_id: Option<String>,
/// The (basic) article code.
pub article: Option<String>,
/// Additional article code that describes the specific variant.
pub variant: Option<String>,
/// The native id.
///
/// In case of IDM, this is <series/>|<product/>.
///
/// In case of XcalibuR, this is <model_source_id/>@@<product_source_id/>
pub native_id: Option<String>,
/// Short (one-line), localized article text.
#[serde(
deserialize_with = "crate::utils::deserialize_optional_map_without_null_values",
default
)]
pub short_text: Option<HashMap<String, String>>,
/// Long, localized article text. Key is ISO 639-1 language code.
#[serde(
deserialize_with = "crate::utils::deserialize_optional_map_without_null_values",
default
)]
pub long_text: Option<HashMap<String, Vec<String>>>,
/// Long, localized article text that describes the variant. Used as an addition
/// to the long text, not as replacement. Key is ISO 639-1 language code.
#[serde(
deserialize_with = "crate::utils::deserialize_optional_map_without_null_values",
default
)]
pub variant_text: Option<HashMap<String, Vec<String>>>,
/// The price unit, for all prices of this article. Possible values:
/// "EUR_Ct" - Euro Cent
/// "USD_Ct" - USD Cent
/// "CHF_Rp" - CHF Rappen
pub price_unit: Option<String>,
/// The article's sales price, according to the price unit.
pub sales_price: Option<i64>,
/// The article's purchase price, according to the price unit.
pub purchase_price: Option<i64>,
///
/// The properties of the article.
///
pub properties: Vec<Property>,
}
impl_visitable_noop!(Commercial);
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[cfg_attr(feature = "schema", schemars(deny_unknown_fields))]
#[serde(rename_all = "camelCase")]
pub struct Property {
/// The unique id of the property.
pub property_id: String,
/// Localized property text. Key is ISO 639-1 language code.
#[serde(deserialize_with = "crate::utils::deserialize_optional_map_without_null_values")]
pub property_text: Option<HashMap<String, String>>,
/// The optional id of the property's current value.
pub value_id: Option<String>,
/// The localized text of the value. Needed if valueId cannot be
/// resolved in Values.
#[serde(
deserialize_with = "crate::utils::deserialize_optional_map_without_null_values",
default
)]
pub value_text: Option<HashMap<String, String>>,
/// The position of the property in the product's property editor.
pub position: i32,
/// The values of the property.
pub values: Option<Vec<Value>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[cfg_attr(feature = "schema", schemars(deny_unknown_fields))]
#[serde(rename_all = "camelCase")]
/// Value of properties
pub struct Value {
/// The unique id of the property value.
pub value_id: String,
/// Localized value text. Key is ISO 639-1 language code.
#[serde(
deserialize_with = "crate::utils::deserialize_optional_map_without_null_values",
default
)]
pub value_text: Option<HashMap<String, String>>,
/// The position of the value in the property's selection list.
pub position: i32,
/// The sub values of the value.
pub values: Vec<Value>,
}