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
use serde::{Deserialize, Serialize};
// use super::{Extensible, TimePeriod};
use crate::common::extensible::Extensible;
use crate::TimePeriod;
///A detailed description of a characteristic that can be used to define a characteristic of an entity specification. The characteristic specification may include the version of the characteristic specification. It is used to define the specification of a characteristic in a specific context, e.g. for a specific customer or in a specific environment.
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct CharacteristicValueSpecification {
///Base Extensible schema for use in `TMForum` Open-APIs - When used for in a schema it means that the Entity described by the schema MUST be extended with the @type
#[serde(flatten)]
pub extensible: Extensible,
///If true, the Boolean Indicates if the value is the default value for a characteristic
#[serde(rename = "isDefault")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_default: Option<bool>,
///An indicator that specifies the inclusion or exclusion of the valueFrom and valueTo attributes. If applicable, possible values are "open", "closed", "closedBottom" and "closedTop".
#[serde(rename = "rangeInterval")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub range_interval: Option<String>,
///A regular expression constraint for given value
#[serde(default, skip_serializing_if = "Option::is_none")]
pub regex: Option<String>,
///A length, surface, volume, dry measure, liquid measure, money, weight, time, and the like. In general, a determinate quantity or magnitude of the kind designated, taken as a standard of comparison for others of the same kind, in assigning to them numerical values, as 1 foot, 1 yard, 1 mile, 1 square foot.
#[serde(rename = "unitOfMeasure")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unit_of_measure: Option<String>,
///A period of time, either as a deadline (endDateTime only) a startDateTime only, or both
#[serde(rename = "validFor")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub valid_for: Option<TimePeriod>,
///The low range value that a characteristic can take on
#[serde(rename = "valueFrom")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub value_from: Option<i64>,
///The upper range value that a characteristic can take on
#[serde(rename = "valueTo")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub value_to: Option<i64>,
///A kind of value that the characteristic value can take on, such as numeric, text and so forth
#[serde(rename = "valueType")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub value_type: Option<String>,
}
impl std::fmt::Display for CharacteristicValueSpecification {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}
impl std::ops::Deref for CharacteristicValueSpecification {
type Target = Extensible;
fn deref(&self) -> &Self::Target {
&self.extensible
}
}
impl std::ops::DerefMut for CharacteristicValueSpecification {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.extensible
}
}