use super::LocalizedText;
#[derive(Debug, Clone, PartialEq, Eq, bincode::Encode, bincode::Decode)]
pub struct PropertyDataType {
pub type_name: Option<String>,
pub unit_type: Option<String>,
}
impl PropertyDataType {
pub fn new(type_name: impl Into<String>) -> Self {
Self {
type_name: Some(type_name.into()),
unit_type: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, bincode::Encode, bincode::Decode)]
pub struct EnumerationConstant {
pub name: String,
pub definition: Option<String>,
pub name_aliases: Vec<LocalizedText>,
pub definition_aliases: Vec<LocalizedText>,
}
#[derive(Debug, Clone, PartialEq, Eq, bincode::Encode, bincode::Decode)]
pub struct PropertyTemplate {
pub name: String,
pub guid: Option<String>,
pub definition: Option<String>,
pub name_aliases: Vec<LocalizedText>,
pub definition_aliases: Vec<LocalizedText>,
pub kind: PropertyKind,
}
#[derive(Debug, Clone, PartialEq, Eq, bincode::Encode, bincode::Decode)]
#[non_exhaustive]
pub enum PropertyKind {
SingleValue {
data_type: PropertyDataType,
},
BoundedValue {
data_type: PropertyDataType,
},
EnumeratedValue {
enumeration_name: Option<String>,
data_type: Option<PropertyDataType>,
values: Vec<String>,
constants: Vec<EnumerationConstant>,
},
ListValue {
data_type: PropertyDataType,
},
ReferenceValue {
reference_type: String,
},
TableValue {
defining_type: PropertyDataType,
defined_type: PropertyDataType,
expression: Option<String>,
},
Complex {
usage_name: String,
properties: Vec<PropertyTemplate>,
},
}