reactive_graph_flow_model/reactive_graph/flow/
has_comment.rs

1//! ---------------------------------------------
2//! This file was generated automatically.
3//! ---------------------------------------------
4#![allow(dead_code, unused)]
5#![cfg_attr(rustfmt, rustfmt_skip)]
6
7/// Namespace `reactive_graph::flow::HasComment`
8#[cfg_attr(rustfmt, rustfmt_skip)]
9pub const HAS_COMMENT_NAMESPACE: &str = "reactive_graph::flow::HasComment";
10
11/// The [type identifier]() of RelationType `HasComment`.
12///
13/// ### Namespace
14///
15/// The fully qualified namespace is
16/// `reactive_graph::flow::HasComment`
17pub static HAS_COMMENT: std::sync::LazyLock<reactive_graph_graph::RelationTypeId> = std::sync::LazyLock::new(||
18std::str::FromStr::from_str(HAS_COMMENT_NAMESPACE).unwrap());
19
20/// The properties of RelationType `HasComment`.
21#[allow(non_camel_case_types)]
22#[derive(Debug, PartialEq, PartialOrd, Eq, Hash, Clone)]
23pub enum HasCommentProperties {}
24impl HasCommentProperties {
25    pub fn len() -> usize {
26        0usize
27    }
28    
29    pub fn property_types() -> reactive_graph_graph::PropertyTypes {
30        let property_types = reactive_graph_graph::PropertyTypes::new();
31        property_types
32    }
33}
34
35impl AsRef<str> for HasCommentProperties {
36    #[inline]
37    fn as_ref(&self) -> &str {
38        match *self {}
39    }
40}
41
42impl From<HasCommentProperties> for &'static str {
43    #[inline]
44    fn from(properties: HasCommentProperties) -> &'static str {
45        match properties {}
46    }
47}
48
49impl From<HasCommentProperties> for String {
50    #[inline]
51    fn from(properties: HasCommentProperties) -> String {
52        match properties {}
53    }
54}
55
56impl From<HasCommentProperties> for reactive_graph_graph::PropertyType {
57    #[inline]
58    fn from(properties: HasCommentProperties) -> reactive_graph_graph::PropertyType {
59        match properties {}
60    }
61}
62
63pub struct HasCommentPropertiesIterator(Option<HasCommentProperties>);
64
65impl HasCommentProperties {
66    pub fn into_iter() -> HasCommentPropertiesIterator {
67        HasCommentPropertiesIterator(None)
68    }
69}
70
71impl Iterator for HasCommentPropertiesIterator {
72    type Item = HasCommentProperties;
73    fn next(&mut self) -> Option<Self::Item> {
74        None
75    }
76}
77
78impl IntoIterator for HasCommentProperties {
79    type Item = HasCommentProperties;
80    type IntoIter = HasCommentPropertiesIterator;
81    fn into_iter(self) -> Self::IntoIter {
82        HasCommentPropertiesIterator(None)
83    }
84}
85
86impl core::fmt::Display for HasCommentProperties {
87    fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
88        match *self {}
89    }
90}
91
92///
93pub static HAS_COMMENT_COMPONENTS: std::sync::LazyLock<
94    reactive_graph_graph::ComponentTypeIds,
95> = std::sync::LazyLock::new(|| { reactive_graph_graph::ComponentTypeIds::new() });
96
97///
98pub static HAS_COMMENT_EXTENSIONS: std::sync::LazyLock<
99    reactive_graph_graph::Extensions,
100> = std::sync::LazyLock::new(|| { reactive_graph_graph::Extensions::new() });
101
102pub static HAS_COMMENT_TYPE: std::sync::LazyLock<reactive_graph_graph::RelationType> = std::sync::LazyLock::new(||
103{
104    reactive_graph_graph::RelationType::builder()
105        .outbound_type(
106            reactive_graph_graph::InboundOutboundType::EntityType(
107                reactive_graph_graph::MatchingInboundOutboundType::Any,
108            ),
109        )
110        .ty(core::ops::Deref::deref(&HAS_COMMENT))
111        .inbound_type(
112            reactive_graph_graph::InboundOutboundType::EntityType(
113                reactive_graph_graph::MatchingInboundOutboundType::NamespacedType(
114                    std::ops::Deref::deref(
115                            &crate::reactive_graph::flow::comment::COMMENT,
116                        )
117                        .clone(),
118                ),
119            ),
120        )
121        .description("Any entity within a flow can be commented")
122        .components(HAS_COMMENT_COMPONENTS.clone())
123        .properties(HasCommentProperties::property_types())
124        .extensions(HAS_COMMENT_EXTENSIONS.clone())
125        .build()
126});
127
128/// # RelationType `HasComment`
129///
130/// ## Fully Qualified Namespace
131///
132/// `reactive_graph::flow::HasComment`
133///
134/// ## Description
135///
136/// Any entity within a flow can be commented
137///
138/// ## Outbound Entity
139///
140/// `*`
141///
142/// ## Inbound Entity
143///
144/// `reactive_graph::flow::Comment`
145///
146/// ## JSON Schema
147///
148/// [https://schema.reactive-graph.io/schema/json/dynamic_graph/types/relation/reactive_graph/flow/HasComment.schema.json]()
149///
150#[derive(
151    Debug,
152    Clone,
153    PartialEq,
154    Eq,
155    serde::Serialize,
156    serde::Deserialize,
157    typed_builder::TypedBuilder
158)]
159pub struct HasComment {
160    #[builder(setter(into))]
161    outbound_id: uuid::Uuid,
162    #[builder(setter(into))]
163    id: reactive_graph_graph::RelationInstanceTypeId,
164    #[builder(setter(into))]
165    inbound_id: uuid::Uuid,
166    extensions: reactive_graph_graph::Extensions,
167}
168
169impl HasComment {
170    pub fn new(
171        outbound_id: uuid::Uuid,
172        id: reactive_graph_graph::InstanceId,
173        inbound_id: uuid::Uuid,
174    ) -> Self {
175        let id = reactive_graph_graph::RelationInstanceTypeId::new(
176            std::ops::Deref::deref(&HAS_COMMENT),
177            id,
178        );
179        Self {
180            outbound_id,
181            id,
182            inbound_id,
183            extensions: reactive_graph_graph::Extensions::new(),
184        }
185    }
186    
187    pub fn new_with_extensions(
188        outbound_id: uuid::Uuid,
189        id: reactive_graph_graph::InstanceId,
190        inbound_id: uuid::Uuid,
191        extensions: reactive_graph_graph::Extensions,
192    ) -> Self {
193        let id = reactive_graph_graph::RelationInstanceTypeId::new(
194            std::ops::Deref::deref(&HAS_COMMENT),
195            id,
196        );
197        Self {
198            outbound_id,
199            id,
200            inbound_id,
201            extensions,
202        }
203    }
204    
205    pub fn outbound_id(&self) -> uuid::Uuid {
206        self.outbound_id
207    }
208    
209    pub fn id(&self) -> reactive_graph_graph::RelationInstanceTypeId {
210        self.id.clone()
211    }
212    
213    pub fn inbound_id(&self) -> uuid::Uuid {
214        self.inbound_id
215    }
216    
217    pub fn properties(&self) -> reactive_graph_graph::PropertyInstances {
218        reactive_graph_graph::PropertyInstances::new()
219    }
220    
221    pub fn extensions(&self) -> reactive_graph_graph::Extensions {
222        self.extensions.clone()
223    }
224}
225
226impl From<HasComment> for reactive_graph_graph::RelationInstance {
227    fn from(has_comment: HasComment) -> Self {
228        reactive_graph_graph::RelationInstance::builder()
229            .outbound_id(has_comment.outbound_id())
230            .ty(has_comment.id())
231            .inbound_id(has_comment.inbound_id())
232            .components(HAS_COMMENT_COMPONENTS.clone())
233            .properties(has_comment.properties())
234            .build()
235    }
236}
237
238impl TryFrom<reactive_graph_graph::RelationInstance> for HasComment {
239    type Error = ();
240    fn try_from(
241        relation_instance: reactive_graph_graph::RelationInstance,
242    ) -> Result<Self, Self::Error> {
243        Err(())
244    }
245}