reactive_graph_command_model/reactive_graph/command/
num_commands.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::command::NumCommands`
8#[cfg_attr(rustfmt, rustfmt_skip)]
9pub const NUM_COMMANDS_NAMESPACE: &str = "reactive_graph::command::NumCommands";
10
11/// The [type identifier]() of EntityType `NumCommands`.
12///
13/// ### Namespace
14///
15/// The fully qualified namespace is
16/// `reactive_graph::command::NumCommands`
17pub static NUM_COMMANDS: std::sync::LazyLock<reactive_graph_graph::EntityTypeId> = std::sync::LazyLock::new(||
18std::str::FromStr::from_str(NUM_COMMANDS_NAMESPACE).unwrap());
19
20/// The properties of EntityType `NumCommands`.
21#[allow(non_camel_case_types)]
22#[derive(Debug, PartialEq, PartialOrd, Eq, Hash, Clone)]
23pub enum NumCommandsProperties {
24    
25    /// ### Property `args`
26    ///
27    /// The command arguments
28    ///
29    /// Data Type: `Array`
30    ///
31    /// Socket Type: `None`
32    ///
33    /// Mutability: `Immutable`
34    ///
35    ARGS,
36    
37    /// ### Property `cmd_ignore`
38    ///
39    /// blah
40    ///
41    /// Data Type: `Any`
42    ///
43    /// Socket Type: `None`
44    ///
45    /// Mutability: `Mutable`
46    ///
47    CMD_IGNORE,
48    
49    /// ### Property `cmd_result`
50    ///
51    /// The result of the command
52    ///
53    /// Data Type: `Any`
54    ///
55    /// Socket Type: `Output`
56    ///
57    /// Mutability: `Immutable`
58    ///
59    CMD_RESULT,
60    
61    /// ### Property `command`
62    ///
63    /// The command name
64    ///
65    /// Data Type: `String`
66    ///
67    /// Socket Type: `None`
68    ///
69    /// Mutability: `Immutable`
70    ///
71    COMMAND,
72    
73    /// ### Property `help`
74    ///
75    /// Help text which explains the command.
76    ///
77    /// Data Type: `String`
78    ///
79    /// Socket Type: `None`
80    ///
81    /// Mutability: `Immutable`
82    ///
83    HELP,
84    
85    /// ### Property `namespace`
86    ///
87    /// The command namespace
88    ///
89    /// Data Type: `String`
90    ///
91    /// Socket Type: `None`
92    ///
93    /// Mutability: `Immutable`
94    ///
95    NAMESPACE,
96}
97impl NumCommandsProperties {
98    pub fn len() -> usize {
99        6usize
100    }
101    
102    pub fn property_types() -> reactive_graph_graph::PropertyTypes {
103        let property_types = reactive_graph_graph::PropertyTypes::new();
104        property_types.push(NumCommandsProperties::ARGS);
105        property_types.push(NumCommandsProperties::CMD_IGNORE);
106        property_types.push(NumCommandsProperties::CMD_RESULT);
107        property_types.push(NumCommandsProperties::COMMAND);
108        property_types.push(NumCommandsProperties::HELP);
109        property_types.push(NumCommandsProperties::NAMESPACE);
110        property_types
111    }
112}
113
114impl AsRef<str> for NumCommandsProperties {
115    #[inline]
116    fn as_ref(&self) -> &str {
117        match *self {
118            NumCommandsProperties::ARGS => "args",
119            NumCommandsProperties::CMD_IGNORE => "cmd_ignore",
120            NumCommandsProperties::CMD_RESULT => "cmd_result",
121            NumCommandsProperties::COMMAND => "command",
122            NumCommandsProperties::HELP => "help",
123            NumCommandsProperties::NAMESPACE => "namespace",
124        }
125    }
126}
127
128impl From<NumCommandsProperties> for &'static str {
129    #[inline]
130    fn from(properties: NumCommandsProperties) -> &'static str {
131        match properties {
132            NumCommandsProperties::ARGS => "args",
133            NumCommandsProperties::CMD_IGNORE => "cmd_ignore",
134            NumCommandsProperties::CMD_RESULT => "cmd_result",
135            NumCommandsProperties::COMMAND => "command",
136            NumCommandsProperties::HELP => "help",
137            NumCommandsProperties::NAMESPACE => "namespace",
138        }
139    }
140}
141
142impl From<NumCommandsProperties> for String {
143    #[inline]
144    fn from(properties: NumCommandsProperties) -> String {
145        match properties {
146            NumCommandsProperties::ARGS => "args".to_owned(),
147            NumCommandsProperties::CMD_IGNORE => "cmd_ignore".to_owned(),
148            NumCommandsProperties::CMD_RESULT => "cmd_result".to_owned(),
149            NumCommandsProperties::COMMAND => "command".to_owned(),
150            NumCommandsProperties::HELP => "help".to_owned(),
151            NumCommandsProperties::NAMESPACE => "namespace".to_owned(),
152        }
153    }
154}
155
156impl From<NumCommandsProperties> for reactive_graph_graph::PropertyType {
157    #[inline]
158    fn from(properties: NumCommandsProperties) -> reactive_graph_graph::PropertyType {
159        match properties {
160            NumCommandsProperties::ARGS => {
161                reactive_graph_graph::PropertyType::new_with_all(
162                    "args",
163                    "The command arguments",
164                    reactive_graph_graph::DataType::Array,
165                    reactive_graph_graph::SocketType::None,
166                    reactive_graph_graph::Mutability::Immutable,
167                    reactive_graph_graph::Extensions::new(),
168                )
169            }
170            NumCommandsProperties::CMD_IGNORE => {
171                reactive_graph_graph::PropertyType::new_with_all(
172                    "cmd_ignore",
173                    "blah",
174                    reactive_graph_graph::DataType::Any,
175                    reactive_graph_graph::SocketType::None,
176                    reactive_graph_graph::Mutability::Mutable,
177                    reactive_graph_graph::Extensions::new(),
178                )
179            }
180            NumCommandsProperties::CMD_RESULT => {
181                reactive_graph_graph::PropertyType::new_with_all(
182                    "cmd_result",
183                    "The result of the command",
184                    reactive_graph_graph::DataType::Any,
185                    reactive_graph_graph::SocketType::Output,
186                    reactive_graph_graph::Mutability::Immutable,
187                    reactive_graph_graph::Extensions::new(),
188                )
189            }
190            NumCommandsProperties::COMMAND => {
191                reactive_graph_graph::PropertyType::new_with_all(
192                    "command",
193                    "The command name",
194                    reactive_graph_graph::DataType::String,
195                    reactive_graph_graph::SocketType::None,
196                    reactive_graph_graph::Mutability::Immutable,
197                    reactive_graph_graph::Extensions::new(),
198                )
199            }
200            NumCommandsProperties::HELP => {
201                reactive_graph_graph::PropertyType::new_with_all(
202                    "help",
203                    "Help text which explains the command.",
204                    reactive_graph_graph::DataType::String,
205                    reactive_graph_graph::SocketType::None,
206                    reactive_graph_graph::Mutability::Immutable,
207                    reactive_graph_graph::Extensions::new(),
208                )
209            }
210            NumCommandsProperties::NAMESPACE => {
211                reactive_graph_graph::PropertyType::new_with_all(
212                    "namespace",
213                    "The command namespace",
214                    reactive_graph_graph::DataType::String,
215                    reactive_graph_graph::SocketType::None,
216                    reactive_graph_graph::Mutability::Immutable,
217                    reactive_graph_graph::Extensions::new(),
218                )
219            }
220        }
221    }
222}
223
224pub struct NumCommandsPropertiesIterator(Option<NumCommandsProperties>);
225
226impl NumCommandsProperties {
227    pub fn into_iter() -> NumCommandsPropertiesIterator {
228        NumCommandsPropertiesIterator(None)
229    }
230}
231
232impl Iterator for NumCommandsPropertiesIterator {
233    type Item = NumCommandsProperties;
234    fn next(&mut self) -> Option<Self::Item> {
235        self.0 = match self.0 {
236            None => Some(NumCommandsProperties::ARGS),
237            Some(NumCommandsProperties::ARGS) => Some(NumCommandsProperties::CMD_IGNORE),
238            Some(NumCommandsProperties::CMD_IGNORE) => {
239                Some(NumCommandsProperties::CMD_RESULT)
240            }
241            Some(NumCommandsProperties::CMD_RESULT) => {
242                Some(NumCommandsProperties::COMMAND)
243            }
244            Some(NumCommandsProperties::COMMAND) => Some(NumCommandsProperties::HELP),
245            Some(NumCommandsProperties::HELP) => Some(NumCommandsProperties::NAMESPACE),
246            Some(NumCommandsProperties::NAMESPACE) => None,
247        };
248        self.0.clone()
249    }
250}
251
252impl IntoIterator for NumCommandsProperties {
253    type Item = NumCommandsProperties;
254    type IntoIter = NumCommandsPropertiesIterator;
255    fn into_iter(self) -> Self::IntoIter {
256        NumCommandsPropertiesIterator(None)
257    }
258}
259
260impl core::fmt::Display for NumCommandsProperties {
261    fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
262        match *self {
263            NumCommandsProperties::ARGS => core::fmt::Display::fmt("args", f),
264            NumCommandsProperties::CMD_IGNORE => core::fmt::Display::fmt("cmd_ignore", f),
265            NumCommandsProperties::CMD_RESULT => core::fmt::Display::fmt("cmd_result", f),
266            NumCommandsProperties::COMMAND => core::fmt::Display::fmt("command", f),
267            NumCommandsProperties::HELP => core::fmt::Display::fmt("help", f),
268            NumCommandsProperties::NAMESPACE => core::fmt::Display::fmt("namespace", f),
269        }
270    }
271}
272
273/// ## Components
274///
275/// | Component                          | Description                                                                             | Properties                                                                                                                      |
276/// |------------------------------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
277/// | `reactive_graph::command::Command` | A command which can be executed. The command has a name and can have command arguments. | <ul compact><li>`args`</li><li>`cmd_ignore`</li><li>`cmd_result`</li><li>`command`</li><li>`help`</li><li>`namespace`</li></ul> |
278///
279pub static NUM_COMMANDS_COMPONENTS: std::sync::LazyLock<
280    reactive_graph_graph::ComponentTypeIds,
281> = std::sync::LazyLock::new(|| {
282    reactive_graph_graph::ComponentTypeIds::new()
283        .component(
284            std::ops::Deref::deref(&crate::reactive_graph::command::command::COMMAND),
285        )
286});
287
288///
289pub static NUM_COMMANDS_EXTENSIONS: std::sync::LazyLock<
290    reactive_graph_graph::Extensions,
291> = std::sync::LazyLock::new(|| { reactive_graph_graph::Extensions::new() });
292
293pub static NUM_COMMANDS_TYPE: std::sync::LazyLock<reactive_graph_graph::EntityType> = std::sync::LazyLock::new(||
294{
295    reactive_graph_graph::EntityType::builder()
296        .ty(core::ops::Deref::deref(&NUM_COMMANDS))
297        .description("The number of commands")
298        .components(NUM_COMMANDS_COMPONENTS.clone())
299        .properties(NumCommandsProperties::property_types())
300        .extensions(NUM_COMMANDS_EXTENSIONS.clone())
301        .build()
302});
303
304/// # EntityType `NumCommands`
305///
306/// ## Fully Qualified Namespace
307///
308/// `reactive_graph::command::NumCommands`
309///
310/// ## Description
311///
312/// The number of commands
313///
314/// ## Components
315///
316/// | Component                          | Description                                                                             | Properties                                                                                                                      |
317/// |------------------------------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
318/// | `reactive_graph::command::Command` | A command which can be executed. The command has a name and can have command arguments. | <ul compact><li>`args`</li><li>`cmd_ignore`</li><li>`cmd_result`</li><li>`command`</li><li>`help`</li><li>`namespace`</li></ul> |
319///
320/// ### Properties from components
321///
322/// - args
323/// - cmd_ignore
324/// - cmd_result
325/// - command
326/// - help
327/// - namespace
328///
329/// ## JSON Schema
330///
331/// [https://schema.reactive-graph.io/schema/json/dynamic_graph/types/entity/reactive_graph/command/NumCommands.schema.json]()
332///
333#[derive(
334    Debug,
335    Clone,
336    PartialEq,
337    Eq,
338    serde::Serialize,
339    serde::Deserialize,
340    typed_builder::TypedBuilder
341)]
342pub struct NumCommands {
343    #[builder(default, setter(into))]
344    pub id: uuid::Uuid,
345    
346    /// ### Property `args`
347    ///
348    /// The command arguments
349    ///
350    /// Data Type: `Array`
351    ///
352    /// Socket Type: `None`
353    ///
354    /// Mutability: `Immutable`
355    ///
356    #[builder(setter(into))]
357    pub args: Vec<serde_json::Value>,
358    
359    /// ### Property `cmd_ignore`
360    ///
361    /// blah
362    ///
363    /// Data Type: `Any`
364    ///
365    /// Socket Type: `None`
366    ///
367    /// Mutability: `Mutable`
368    ///
369    pub cmd_ignore: serde_json::Value,
370    
371    /// ### Property `cmd_result`
372    ///
373    /// The result of the command
374    ///
375    /// Data Type: `Any`
376    ///
377    /// Socket Type: `Output`
378    ///
379    /// Mutability: `Immutable`
380    ///
381    pub cmd_result: serde_json::Value,
382    
383    /// ### Property `command`
384    ///
385    /// The command name
386    ///
387    /// Data Type: `String`
388    ///
389    /// Socket Type: `None`
390    ///
391    /// Mutability: `Immutable`
392    ///
393    #[builder(setter(into))]
394    pub command: String,
395    
396    /// ### Property `help`
397    ///
398    /// Help text which explains the command.
399    ///
400    /// Data Type: `String`
401    ///
402    /// Socket Type: `None`
403    ///
404    /// Mutability: `Immutable`
405    ///
406    #[builder(setter(into))]
407    pub help: String,
408    
409    /// ### Property `namespace`
410    ///
411    /// The command namespace
412    ///
413    /// Data Type: `String`
414    ///
415    /// Socket Type: `None`
416    ///
417    /// Mutability: `Immutable`
418    ///
419    #[builder(setter(into))]
420    pub namespace: String,
421    #[builder(default, setter(into))]
422    pub extensions: reactive_graph_graph::Extensions,
423}
424
425impl NumCommands {
426    pub fn new(
427        args: Vec<serde_json::Value>,
428        cmd_ignore: serde_json::Value,
429        cmd_result: serde_json::Value,
430        command: String,
431        help: String,
432        namespace: String,
433    ) -> Self {
434        Self {
435            id: uuid::Uuid::new_v4(),
436            args,
437            cmd_ignore,
438            cmd_result,
439            command,
440            help,
441            namespace,
442            extensions: reactive_graph_graph::Extensions::new(),
443        }
444    }
445    pub fn new_with_id(
446        id: uuid::Uuid,
447        args: Vec<serde_json::Value>,
448        cmd_ignore: serde_json::Value,
449        cmd_result: serde_json::Value,
450        command: String,
451        help: String,
452        namespace: String,
453    ) -> Self {
454        Self {
455            id,
456            args,
457            cmd_ignore,
458            cmd_result,
459            command,
460            help,
461            namespace,
462            extensions: reactive_graph_graph::Extensions::new(),
463        }
464    }
465    pub fn new_with_extensions(
466        id: uuid::Uuid,
467        args: Vec<serde_json::Value>,
468        cmd_ignore: serde_json::Value,
469        cmd_result: serde_json::Value,
470        command: String,
471        help: String,
472        namespace: String,
473        extensions: reactive_graph_graph::Extensions,
474    ) -> Self {
475        Self {
476            id,
477            args,
478            cmd_ignore,
479            cmd_result,
480            command,
481            help,
482            namespace,
483            extensions,
484        }
485    }
486    
487    pub fn id(&self) -> uuid::Uuid {
488        self.id
489    }
490    
491    /// ### Property `args`
492    ///
493    /// The command arguments
494    ///
495    /// Data Type: `Array`
496    ///
497    /// Socket Type: `None`
498    ///
499    /// Mutability: `Immutable`
500    ///
501    pub fn args(&self) -> Vec<serde_json::Value> {
502        self.args.clone()
503    }
504    
505    /// ### Property `cmd_ignore`
506    ///
507    /// blah
508    ///
509    /// Data Type: `Any`
510    ///
511    /// Socket Type: `None`
512    ///
513    /// Mutability: `Mutable`
514    ///
515    pub fn cmd_ignore(&self) -> serde_json::Value {
516        self.cmd_ignore.clone()
517    }
518    
519    /// ### Property `cmd_ignore`
520    ///
521    /// blah
522    ///
523    /// Data Type: `Any`
524    ///
525    /// Socket Type: `None`
526    ///
527    /// Mutability: `Mutable`
528    ///
529    pub fn set_cmd_ignore(&mut self, cmd_ignore: serde_json::Value) {
530        self.cmd_ignore = cmd_ignore;
531    }
532    
533    /// ### Property `cmd_result`
534    ///
535    /// The result of the command
536    ///
537    /// Data Type: `Any`
538    ///
539    /// Socket Type: `Output`
540    ///
541    /// Mutability: `Immutable`
542    ///
543    pub fn cmd_result(&self) -> serde_json::Value {
544        self.cmd_result.clone()
545    }
546    
547    /// ### Property `command`
548    ///
549    /// The command name
550    ///
551    /// Data Type: `String`
552    ///
553    /// Socket Type: `None`
554    ///
555    /// Mutability: `Immutable`
556    ///
557    pub fn command(&self) -> String {
558        self.command.clone()
559    }
560    
561    /// ### Property `help`
562    ///
563    /// Help text which explains the command.
564    ///
565    /// Data Type: `String`
566    ///
567    /// Socket Type: `None`
568    ///
569    /// Mutability: `Immutable`
570    ///
571    pub fn help(&self) -> String {
572        self.help.clone()
573    }
574    
575    /// ### Property `namespace`
576    ///
577    /// The command namespace
578    ///
579    /// Data Type: `String`
580    ///
581    /// Socket Type: `None`
582    ///
583    /// Mutability: `Immutable`
584    ///
585    pub fn namespace(&self) -> String {
586        self.namespace.clone()
587    }
588    
589    pub fn properties(&self) -> reactive_graph_graph::PropertyInstances {
590        reactive_graph_graph::PropertyInstances::new()
591            .property(NumCommandsProperties::ARGS, self.args.clone())
592            .property(NumCommandsProperties::CMD_IGNORE, self.cmd_ignore.clone())
593            .property(NumCommandsProperties::CMD_RESULT, self.cmd_result.clone())
594            .property(NumCommandsProperties::COMMAND, self.command.clone())
595            .property(NumCommandsProperties::HELP, self.help.clone())
596            .property(NumCommandsProperties::NAMESPACE, self.namespace.clone())
597    }
598    
599    pub fn extensions(&self) -> reactive_graph_graph::Extensions {
600        self.extensions.clone()
601    }
602}
603
604impl From<NumCommands> for reactive_graph_graph::EntityInstance {
605    fn from(num_commands: NumCommands) -> Self {
606        reactive_graph_graph::EntityInstance::builder()
607            .ty(std::ops::Deref::deref(&NUM_COMMANDS))
608            .id(num_commands.id())
609            .components(NUM_COMMANDS_COMPONENTS.clone())
610            .properties(num_commands.properties())
611            .build()
612    }
613}
614
615impl TryFrom<reactive_graph_graph::EntityInstance> for NumCommands {
616    type Error = ();
617    fn try_from(
618        entity_instance: reactive_graph_graph::EntityInstance,
619    ) -> Result<Self, Self::Error> {
620        Err(())
621    }
622}
623impl crate::reactive_graph::command::command::Command for NumCommands {
624    
625    /// ### Property `args`
626    ///
627    /// The command arguments
628    ///
629    /// Data Type: `Array`
630    ///
631    /// Socket Type: `None`
632    ///
633    /// Mutability: `Immutable`
634    ///
635    fn args(&self) -> Vec<serde_json::Value> {
636        self.args.clone()
637    }
638    
639    /// ### Property `cmd_ignore`
640    ///
641    /// blah
642    ///
643    /// Data Type: `Any`
644    ///
645    /// Socket Type: `None`
646    ///
647    /// Mutability: `Mutable`
648    ///
649    fn cmd_ignore(&self) -> serde_json::Value {
650        self.cmd_ignore.clone()
651    }
652    
653    /// ### Property `cmd_ignore`
654    ///
655    /// blah
656    ///
657    /// Data Type: `Any`
658    ///
659    /// Socket Type: `None`
660    ///
661    /// Mutability: `Mutable`
662    ///
663    fn set_cmd_ignore(&mut self, cmd_ignore: serde_json::Value) {
664        self.cmd_ignore = cmd_ignore;
665    }
666    
667    /// ### Property `cmd_result`
668    ///
669    /// The result of the command
670    ///
671    /// Data Type: `Any`
672    ///
673    /// Socket Type: `Output`
674    ///
675    /// Mutability: `Immutable`
676    ///
677    fn cmd_result(&self) -> serde_json::Value {
678        self.cmd_result.clone()
679    }
680    
681    /// ### Property `command`
682    ///
683    /// The command name
684    ///
685    /// Data Type: `String`
686    ///
687    /// Socket Type: `None`
688    ///
689    /// Mutability: `Immutable`
690    ///
691    fn command(&self) -> String {
692        self.command.clone()
693    }
694    
695    /// ### Property `help`
696    ///
697    /// Help text which explains the command.
698    ///
699    /// Data Type: `String`
700    ///
701    /// Socket Type: `None`
702    ///
703    /// Mutability: `Immutable`
704    ///
705    fn help(&self) -> String {
706        self.help.clone()
707    }
708    
709    /// ### Property `namespace`
710    ///
711    /// The command namespace
712    ///
713    /// Data Type: `String`
714    ///
715    /// Socket Type: `None`
716    ///
717    /// Mutability: `Immutable`
718    ///
719    fn namespace(&self) -> String {
720        self.namespace.clone()
721    }
722}