openehr-its 0.0.128

openEHR ITS (Implementation Technology Specifications): canonical JSON + canonical XML serialization of the RM, the generated ITS-REST 1.1.0 API contract, and the OPT 1.4 and AOM2 archetype XML codecs
Documentation
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
// @generated by openehr-codegen (emit-opt) — DO NOT EDIT.
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-FileCopyrightText: openEHR Foundation
// SPDX-License-Identifier: Apache-2.0
//! Typed Rust model for openEHR OPT 1.4 operational templates.

#![allow(
    dead_code,
    non_snake_case,
    non_camel_case_types,
    clippy::all,
    clippy::pedantic,
    clippy::nursery,
    reason = "mechanically generated model text: the XSD is emitted in full under its own spec-owned element/attribute spellings, so naming, style and dead-code lints do not apply — the hand-written runtime carries the lint bar"
)]

/// Text outside the `xs:enumeration` facet set of one of this module's
/// generated XSD simple types.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UnknownFacetValue {
    /// The XSD simple type whose declared facet set refused the text.
    pub simple_type: &'static str,
    /// The refused text, verbatim as it appeared on the wire.
    pub value: String,
}

impl std::fmt::Display for UnknownFacetValue {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "{:?} is not a declared xs:enumeration value of {}",
            self.value, self.simple_type
        )
    }
}

impl std::error::Error for UnknownFacetValue {}

/// openEHR AOM/OPT `OPERATOR_KIND` — an `xs:enumeration`-faceted XSD simple type
/// restricting `xs:integer`.
///
/// The wire form is the facet value verbatim; text outside the declared set
/// is refused by [`OperatorKind::from_wire`].
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum OperatorKind {
    /// The `2001` facet value (XSD facet id `equal`).
    Equal,
    /// The `2002` facet value (XSD facet id `not_equal`).
    NotEqual,
    /// The `2003` facet value (XSD facet id `less_than_or_equal`).
    LessThanOrEqual,
    /// The `2004` facet value (XSD facet id `less_than`).
    LessThan,
    /// The `2005` facet value (XSD facet id `greater_than_or_equal`).
    GreaterThanOrEqual,
    /// The `2006` facet value (XSD facet id `greater_than`).
    GreaterThan,
    /// The `2007` facet value (XSD facet id `matches`).
    Matches,
    /// The `2010` facet value (XSD facet id `not`).
    Not,
    /// The `2011` facet value (XSD facet id `and`).
    And,
    /// The `2012` facet value (XSD facet id `or`).
    Or,
    /// The `2013` facet value (XSD facet id `xor`).
    Xor,
    /// The `2014` facet value (XSD facet id `implies`).
    Implies,
    /// The `2015` facet value (XSD facet id `for_all`).
    ForAll,
    /// The `2016` facet value (XSD facet id `exists`).
    Exists,
    /// The `2020` facet value (XSD facet id `plus`).
    Plus,
    /// The `2021` facet value (XSD facet id `minus`).
    Minus,
    /// The `2022` facet value (XSD facet id `multiply`).
    Multiply,
    /// The `2023` facet value (XSD facet id `divide`).
    Divide,
    /// The `2024` facet value (XSD facet id `exponent`).
    Exponent,
}

impl OperatorKind {
    /// Returns the `xs:enumeration` facet value this variant carries on the wire.
    pub const fn as_wire(&self) -> &'static str {
        match self {
            Self::Equal => "2001",
            Self::NotEqual => "2002",
            Self::LessThanOrEqual => "2003",
            Self::LessThan => "2004",
            Self::GreaterThanOrEqual => "2005",
            Self::GreaterThan => "2006",
            Self::Matches => "2007",
            Self::Not => "2010",
            Self::And => "2011",
            Self::Or => "2012",
            Self::Xor => "2013",
            Self::Implies => "2014",
            Self::ForAll => "2015",
            Self::Exists => "2016",
            Self::Plus => "2020",
            Self::Minus => "2021",
            Self::Multiply => "2022",
            Self::Divide => "2023",
            Self::Exponent => "2024",
        }
    }

    /// Parses one declared `xs:enumeration` facet value of `OPERATOR_KIND`.
    ///
    /// # Errors
    /// Returns [`UnknownFacetValue`] when `text` is outside the declared facet set.
    pub fn from_wire(text: &str) -> Result<Self, UnknownFacetValue> {
        match text {
            "2001" => Ok(Self::Equal),
            "2002" => Ok(Self::NotEqual),
            "2003" => Ok(Self::LessThanOrEqual),
            "2004" => Ok(Self::LessThan),
            "2005" => Ok(Self::GreaterThanOrEqual),
            "2006" => Ok(Self::GreaterThan),
            "2007" => Ok(Self::Matches),
            "2010" => Ok(Self::Not),
            "2011" => Ok(Self::And),
            "2012" => Ok(Self::Or),
            "2013" => Ok(Self::Xor),
            "2014" => Ok(Self::Implies),
            "2015" => Ok(Self::ForAll),
            "2016" => Ok(Self::Exists),
            "2020" => Ok(Self::Plus),
            "2021" => Ok(Self::Minus),
            "2022" => Ok(Self::Multiply),
            "2023" => Ok(Self::Divide),
            "2024" => Ok(Self::Exponent),
            _ => Err(UnknownFacetValue {
                simple_type: "OPERATOR_KIND",
                value: text.to_owned(),
            }),
        }
    }
}

impl std::fmt::Display for OperatorKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_wire())
    }
}

/// openEHR AOM/OPT `PROPORTION_KIND` — an `xs:enumeration`-faceted XSD simple type
/// restricting `xs:integer`.
///
/// The wire form is the facet value verbatim; text outside the declared set
/// is refused by [`ProportionKind::from_wire`].
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ProportionKind {
    /// The `0` facet value (XSD facet id `pk_ratio`).
    PkRatio,
    /// The `1` facet value (XSD facet id `pk_unitary`).
    PkUnitary,
    /// The `2` facet value (XSD facet id `pk_percent`).
    PkPercent,
    /// The `3` facet value (XSD facet id `pk_fraction`).
    PkFraction,
    /// The `4` facet value (XSD facet id `pk_integer_fraction`).
    PkIntegerFraction,
}

impl ProportionKind {
    /// Returns the `xs:enumeration` facet value this variant carries on the wire.
    pub const fn as_wire(&self) -> &'static str {
        match self {
            Self::PkRatio => "0",
            Self::PkUnitary => "1",
            Self::PkPercent => "2",
            Self::PkFraction => "3",
            Self::PkIntegerFraction => "4",
        }
    }

    /// Parses one declared `xs:enumeration` facet value of `PROPORTION_KIND`.
    ///
    /// # Errors
    /// Returns [`UnknownFacetValue`] when `text` is outside the declared facet set.
    pub fn from_wire(text: &str) -> Result<Self, UnknownFacetValue> {
        match text {
            "0" => Ok(Self::PkRatio),
            "1" => Ok(Self::PkUnitary),
            "2" => Ok(Self::PkPercent),
            "3" => Ok(Self::PkFraction),
            "4" => Ok(Self::PkIntegerFraction),
            _ => Err(UnknownFacetValue {
                simple_type: "PROPORTION_KIND",
                value: text.to_owned(),
            }),
        }
    }
}

impl std::fmt::Display for ProportionKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_wire())
    }
}

/// openEHR AOM/OPT `VALIDITY_KIND` — an `xs:enumeration`-faceted XSD simple type
/// restricting `xs:integer`.
///
/// The wire form is the facet value verbatim; text outside the declared set
/// is refused by [`ValidityKind::from_wire`].
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ValidityKind {
    /// The `1001` facet value (XSD facet id `mandatory`).
    Mandatory,
    /// The `1002` facet value (XSD facet id `optional`).
    Optional,
    /// The `1003` facet value (XSD facet id `disallowed`).
    Disallowed,
}

impl ValidityKind {
    /// Returns the `xs:enumeration` facet value this variant carries on the wire.
    pub const fn as_wire(&self) -> &'static str {
        match self {
            Self::Mandatory => "1001",
            Self::Optional => "1002",
            Self::Disallowed => "1003",
        }
    }

    /// Parses one declared `xs:enumeration` facet value of `VALIDITY_KIND`.
    ///
    /// # Errors
    /// Returns [`UnknownFacetValue`] when `text` is outside the declared facet set.
    pub fn from_wire(text: &str) -> Result<Self, UnknownFacetValue> {
        match text {
            "1001" => Ok(Self::Mandatory),
            "1002" => Ok(Self::Optional),
            "1003" => Ok(Self::Disallowed),
            _ => Err(UnknownFacetValue {
                simple_type: "VALIDITY_KIND",
                value: text.to_owned(),
            }),
        }
    }
}

impl std::fmt::Display for ValidityKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.as_wire())
    }
}

/// openEHR AOM/OPT `ANNOTATION`.
#[derive(Debug, Clone, PartialEq)]
pub struct Annotation {
    /// The `path` attribute/element of the OPT `ANNOTATION` XSD type.
    pub path: String,
    /// The `items` attribute/element of the OPT `ANNOTATION` XSD type.
    pub items: indexmap::IndexMap<String, String>,
}

/// openEHR AOM/OPT `ARCHETYPE`.
#[derive(Debug, Clone, PartialEq)]
pub struct Archetype {
    /// The `original_language` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub original_language: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
    /// The `is_controlled` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub is_controlled: Option<bool>,
    /// The `description` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub description: Option<ResourceDescription>,
    /// The `translations` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub translations: Vec<TranslationDetails>,
    /// The `revision_history` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub revision_history:
        Option<openehr_rm::v1_2::common::generic::revision_history::RevisionHistory>,
    /// The `uid` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub uid: Option<openehr_base::v1_3::base_types::identification::hier_object_id::HierObjectId>,
    /// The `archetype_id` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub archetype_id: openehr_base::v1_3::base_types::identification::archetype_id::ArchetypeId,
    /// The `adl_version` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub adl_version: Option<String>,
    /// The `concept` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub concept: String,
    /// The `parent_archetype_id` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub parent_archetype_id:
        Option<openehr_base::v1_3::base_types::identification::archetype_id::ArchetypeId>,
    /// The `definition` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub definition: CComplexObject,
    /// The `invariants` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub invariants: Vec<Assertion>,
    /// The `ontology` attribute/element of the OPT `ARCHETYPE` XSD type.
    pub ontology: ArchetypeOntology,
}

/// openEHR AOM/OPT `ARCHETYPE_CONSTRAINT`.
#[derive(Debug, Clone, PartialEq)]
pub enum ArchetypeConstraint {
    /// The OPT `ARCHETYPE_INTERNAL_REF` subtype of `ARCHETYPE_CONSTRAINT`.
    ArchetypeInternalRef(ArchetypeInternalRef),
    /// The OPT `ARCHETYPE_SLOT` subtype of `ARCHETYPE_CONSTRAINT`.
    ArchetypeSlot(ArchetypeSlot),
    /// The OPT `CONSTRAINT_REF` subtype of `ARCHETYPE_CONSTRAINT`.
    ConstraintRef(ConstraintRef),
    /// The OPT `C_ARCHETYPE_ROOT` subtype of `ARCHETYPE_CONSTRAINT`.
    CArchetypeRoot(CArchetypeRoot),
    /// The OPT `C_CODE_PHRASE` subtype of `ARCHETYPE_CONSTRAINT`.
    CCodePhrase(CCodePhrase),
    /// The OPT `C_CODE_REFERENCE` subtype of `ARCHETYPE_CONSTRAINT`.
    CCodeReference(CCodeReference),
    /// The OPT `C_COMPLEX_OBJECT` subtype of `ARCHETYPE_CONSTRAINT`.
    CComplexObject(CComplexObject),
    /// The OPT `C_DEFINED_OBJECT` subtype of `ARCHETYPE_CONSTRAINT`.
    CDefinedObject(CDefinedObject),
    /// The OPT `C_DV_ORDINAL` subtype of `ARCHETYPE_CONSTRAINT`.
    CDvOrdinal(CDvOrdinal),
    /// The OPT `C_DV_QUANTITY` subtype of `ARCHETYPE_CONSTRAINT`.
    CDvQuantity(CDvQuantity),
    /// The OPT `C_DV_STATE` subtype of `ARCHETYPE_CONSTRAINT`.
    CDvState(CDvState),
    /// The OPT `C_MULTIPLE_ATTRIBUTE` subtype of `ARCHETYPE_CONSTRAINT`.
    CMultipleAttribute(CMultipleAttribute),
    /// The OPT `C_PRIMITIVE_OBJECT` subtype of `ARCHETYPE_CONSTRAINT`.
    CPrimitiveObject(CPrimitiveObject),
    /// The OPT `C_SINGLE_ATTRIBUTE` subtype of `ARCHETYPE_CONSTRAINT`.
    CSingleAttribute(CSingleAttribute),
    /// The OPT `T_COMPLEX_OBJECT` subtype of `ARCHETYPE_CONSTRAINT`.
    TComplexObject(TComplexObject),
}

/// openEHR AOM/OPT `ARCHETYPE_INTERNAL_REF`.
#[derive(Debug, Clone, PartialEq)]
pub struct ArchetypeInternalRef {
    /// The `rm_type_name` attribute/element of the OPT `ARCHETYPE_INTERNAL_REF` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `ARCHETYPE_INTERNAL_REF` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `ARCHETYPE_INTERNAL_REF` XSD type.
    pub node_id: String,
    /// The `target_path` attribute/element of the OPT `ARCHETYPE_INTERNAL_REF` XSD type.
    pub target_path: String,
}

/// openEHR AOM/OPT `ARCHETYPE_ONTOLOGY`.
#[derive(Debug, Clone, PartialEq)]
pub struct ArchetypeOntology {
    /// The `term_definitions` attribute/element of the OPT `ARCHETYPE_ONTOLOGY` XSD type.
    pub term_definitions: Vec<Codedefinitionset>,
    /// The `constraint_definitions` attribute/element of the OPT `ARCHETYPE_ONTOLOGY` XSD type.
    pub constraint_definitions: Vec<Codedefinitionset>,
    /// The `term_bindings` attribute/element of the OPT `ARCHETYPE_ONTOLOGY` XSD type.
    pub term_bindings: Vec<Termbindingset>,
    /// The `constraint_bindings` attribute/element of the OPT `ARCHETYPE_ONTOLOGY` XSD type.
    pub constraint_bindings: Vec<Constraintbindingset>,
}

/// openEHR AOM/OPT `ARCHETYPE_SLOT`.
#[derive(Debug, Clone, PartialEq)]
pub struct ArchetypeSlot {
    /// The `rm_type_name` attribute/element of the OPT `ARCHETYPE_SLOT` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `ARCHETYPE_SLOT` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `ARCHETYPE_SLOT` XSD type.
    pub node_id: String,
    /// The `includes` attribute/element of the OPT `ARCHETYPE_SLOT` XSD type.
    pub includes: Vec<Assertion>,
    /// The `excludes` attribute/element of the OPT `ARCHETYPE_SLOT` XSD type.
    pub excludes: Vec<Assertion>,
}

/// openEHR AOM/OPT `ARCHETYPE_TERM`.
#[derive(Debug, Clone, PartialEq)]
pub struct ArchetypeTerm {
    /// The `code` attribute/element of the OPT `ARCHETYPE_TERM` XSD type.
    pub code: String,
    /// The `items` attribute/element of the OPT `ARCHETYPE_TERM` XSD type.
    pub items: indexmap::IndexMap<String, String>,
}

/// openEHR AOM/OPT `ASSERTION`.
#[derive(Debug, Clone, PartialEq)]
pub struct Assertion {
    /// The `tag` attribute/element of the OPT `ASSERTION` XSD type.
    pub tag: Option<String>,
    /// The `string_expression` attribute/element of the OPT `ASSERTION` XSD type.
    pub string_expression: Option<String>,
    /// The `expression` attribute/element of the OPT `ASSERTION` XSD type.
    pub expression: Box<ExprItem>,
    /// The `variables` attribute/element of the OPT `ASSERTION` XSD type.
    pub variables: Vec<AssertionVariable>,
}

/// openEHR AOM/OPT `ASSERTION_VARIABLE`.
#[derive(Debug, Clone, PartialEq)]
pub struct AssertionVariable {
    /// The `name` attribute/element of the OPT `ASSERTION_VARIABLE` XSD type.
    pub name: String,
    /// The `definition` attribute/element of the OPT `ASSERTION_VARIABLE` XSD type.
    pub definition: String,
}

/// openEHR AOM/OPT `AUTHORED_RESOURCE`.
#[derive(Debug, Clone, PartialEq)]
pub enum AuthoredResource {
    /// The OPT `ARCHETYPE` subtype of `AUTHORED_RESOURCE`.
    Archetype(Archetype),
}

/// openEHR AOM/OPT `CARDINALITY`.
#[derive(Debug, Clone, PartialEq)]
pub struct Cardinality {
    /// The `is_ordered` attribute/element of the OPT `CARDINALITY` XSD type.
    pub is_ordered: bool,
    /// The `is_unique` attribute/element of the OPT `CARDINALITY` XSD type.
    pub is_unique: bool,
    /// The `interval` attribute/element of the OPT `CARDINALITY` XSD type.
    pub interval: Intervalofinteger,
}

/// openEHR AOM/OPT `CONSTRAINT_BINDING_ITEM`.
#[derive(Debug, Clone, PartialEq)]
pub struct ConstraintBindingItem {
    /// The `code` attribute/element of the OPT `CONSTRAINT_BINDING_ITEM` XSD type.
    pub code: String,
    /// The `value` attribute/element of the OPT `CONSTRAINT_BINDING_ITEM` XSD type.
    pub value: String,
}

/// openEHR AOM/OPT `CONSTRAINT_REF`.
#[derive(Debug, Clone, PartialEq)]
pub struct ConstraintRef {
    /// The `rm_type_name` attribute/element of the OPT `CONSTRAINT_REF` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `CONSTRAINT_REF` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `CONSTRAINT_REF` XSD type.
    pub node_id: String,
    /// The `reference` attribute/element of the OPT `CONSTRAINT_REF` XSD type.
    pub reference: String,
}

/// openEHR AOM/OPT `C_ARCHETYPE_ROOT`.
#[derive(Debug, Clone, PartialEq)]
pub struct CArchetypeRoot {
    /// The `rm_type_name` attribute/element of the OPT `C_ARCHETYPE_ROOT` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `C_ARCHETYPE_ROOT` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `C_ARCHETYPE_ROOT` XSD type.
    pub node_id: String,
    /// The `attributes` attribute/element of the OPT `C_ARCHETYPE_ROOT` XSD type.
    pub attributes: Vec<CAttribute>,
    /// The `archetype_id` attribute/element of the OPT `C_ARCHETYPE_ROOT` XSD type.
    pub archetype_id: openehr_base::v1_3::base_types::identification::archetype_id::ArchetypeId,
    /// The `template_id` attribute/element of the OPT `C_ARCHETYPE_ROOT` XSD type.
    pub template_id:
        Option<openehr_base::v1_3::base_types::identification::template_id::TemplateId>,
    /// The `term_definitions` attribute/element of the OPT `C_ARCHETYPE_ROOT` XSD type.
    pub term_definitions: Vec<ArchetypeTerm>,
    /// The `term_bindings` attribute/element of the OPT `C_ARCHETYPE_ROOT` XSD type.
    pub term_bindings: Vec<Termbindingset>,
}

/// openEHR AOM/OPT `C_ATTRIBUTE`.
#[derive(Debug, Clone, PartialEq)]
pub enum CAttribute {
    /// The OPT `C_MULTIPLE_ATTRIBUTE` subtype of `C_ATTRIBUTE`.
    CMultipleAttribute(CMultipleAttribute),
    /// The OPT `C_SINGLE_ATTRIBUTE` subtype of `C_ATTRIBUTE`.
    CSingleAttribute(CSingleAttribute),
}

/// openEHR AOM/OPT `C_BOOLEAN`.
#[derive(Debug, Clone, PartialEq)]
pub struct CBoolean {
    /// The `true_valid` attribute/element of the OPT `C_BOOLEAN` XSD type.
    pub true_valid: bool,
    /// The `false_valid` attribute/element of the OPT `C_BOOLEAN` XSD type.
    pub false_valid: bool,
    /// The `assumed_value` attribute/element of the OPT `C_BOOLEAN` XSD type.
    pub assumed_value: Option<bool>,
}

/// openEHR AOM/OPT `C_CODE_PHRASE`.
#[derive(Debug, Clone, PartialEq)]
pub struct CCodePhrase {
    /// The `rm_type_name` attribute/element of the OPT `C_CODE_PHRASE` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `C_CODE_PHRASE` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `C_CODE_PHRASE` XSD type.
    pub node_id: String,
    /// The `assumed_value` attribute/element of the OPT `C_CODE_PHRASE` XSD type.
    pub assumed_value: Option<openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase>,
    /// The `terminology_id` attribute/element of the OPT `C_CODE_PHRASE` XSD type.
    pub terminology_id:
        Option<openehr_base::v1_3::base_types::identification::terminology_id::TerminologyId>,
    /// The `code_list` attribute/element of the OPT `C_CODE_PHRASE` XSD type.
    pub code_list: Vec<String>,
}

/// openEHR AOM/OPT `C_CODE_REFERENCE`.
#[derive(Debug, Clone, PartialEq)]
pub struct CCodeReference {
    /// The `rm_type_name` attribute/element of the OPT `C_CODE_REFERENCE` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `C_CODE_REFERENCE` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `C_CODE_REFERENCE` XSD type.
    pub node_id: String,
    /// The `assumed_value` attribute/element of the OPT `C_CODE_REFERENCE` XSD type.
    pub assumed_value: Option<openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase>,
    /// The `terminology_id` attribute/element of the OPT `C_CODE_REFERENCE` XSD type.
    pub terminology_id:
        Option<openehr_base::v1_3::base_types::identification::terminology_id::TerminologyId>,
    /// The `code_list` attribute/element of the OPT `C_CODE_REFERENCE` XSD type.
    pub code_list: Vec<String>,
    /// The `referenceSetUri` attribute/element of the OPT `C_CODE_REFERENCE` XSD type.
    pub referenceSetUri: String,
}

/// openEHR AOM/OPT `C_COMPLEX_OBJECT`.
#[derive(Debug, Clone, PartialEq)]
pub struct CComplexObject {
    /// The `rm_type_name` attribute/element of the OPT `C_COMPLEX_OBJECT` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `C_COMPLEX_OBJECT` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `C_COMPLEX_OBJECT` XSD type.
    pub node_id: String,
    /// The `attributes` attribute/element of the OPT `C_COMPLEX_OBJECT` XSD type.
    pub attributes: Vec<CAttribute>,
}

/// openEHR AOM/OPT `C_DATE`.
#[derive(Debug, Clone, PartialEq)]
pub struct CDate {
    /// The `pattern` attribute/element of the OPT `C_DATE` XSD type.
    pub pattern: Option<String>,
    /// The `timezone_validity` attribute/element of the OPT `C_DATE` XSD type.
    pub timezone_validity: Option<ValidityKind>,
    /// The `range` attribute/element of the OPT `C_DATE` XSD type.
    pub range: Option<Intervalofdate>,
    /// The `assumed_value` attribute/element of the OPT `C_DATE` XSD type.
    pub assumed_value: Option<String>,
}

/// openEHR AOM/OPT `C_DATE_TIME`.
#[derive(Debug, Clone, PartialEq)]
pub struct CDateTime {
    /// The `pattern` attribute/element of the OPT `C_DATE_TIME` XSD type.
    pub pattern: Option<String>,
    /// The `timezone_validity` attribute/element of the OPT `C_DATE_TIME` XSD type.
    pub timezone_validity: Option<ValidityKind>,
    /// The `range` attribute/element of the OPT `C_DATE_TIME` XSD type.
    pub range: Option<Intervalofdatetime>,
    /// The `assumed_value` attribute/element of the OPT `C_DATE_TIME` XSD type.
    pub assumed_value: Option<String>,
}

/// openEHR AOM/OPT `C_DEFINED_OBJECT`.
#[derive(Debug, Clone, PartialEq)]
pub struct CDefinedObject {
    /// The `rm_type_name` attribute/element of the OPT `C_DEFINED_OBJECT` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `C_DEFINED_OBJECT` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `C_DEFINED_OBJECT` XSD type.
    pub node_id: String,
}

/// openEHR AOM/OPT `C_DOMAIN_TYPE`.
#[derive(Debug, Clone, PartialEq)]
pub enum CDomainType {
    /// The OPT `C_CODE_PHRASE` subtype of `C_DOMAIN_TYPE`.
    CCodePhrase(CCodePhrase),
    /// The OPT `C_CODE_REFERENCE` subtype of `C_DOMAIN_TYPE`.
    CCodeReference(CCodeReference),
    /// The OPT `C_DV_ORDINAL` subtype of `C_DOMAIN_TYPE`.
    CDvOrdinal(CDvOrdinal),
    /// The OPT `C_DV_QUANTITY` subtype of `C_DOMAIN_TYPE`.
    CDvQuantity(CDvQuantity),
    /// The OPT `C_DV_STATE` subtype of `C_DOMAIN_TYPE`.
    CDvState(CDvState),
}

/// openEHR AOM/OPT `C_DURATION`.
#[derive(Debug, Clone, PartialEq)]
pub struct CDuration {
    /// The `pattern` attribute/element of the OPT `C_DURATION` XSD type.
    pub pattern: Option<String>,
    /// The `range` attribute/element of the OPT `C_DURATION` XSD type.
    pub range: Option<Intervalofduration>,
    /// The `assumed_value` attribute/element of the OPT `C_DURATION` XSD type.
    pub assumed_value: Option<String>,
}

/// openEHR AOM/OPT `C_DV_ORDINAL`.
#[derive(Debug, Clone, PartialEq)]
pub struct CDvOrdinal {
    /// The `rm_type_name` attribute/element of the OPT `C_DV_ORDINAL` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `C_DV_ORDINAL` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `C_DV_ORDINAL` XSD type.
    pub node_id: String,
    /// The `assumed_value` attribute/element of the OPT `C_DV_ORDINAL` XSD type.
    pub assumed_value: Option<openehr_rm::v1_2::data_types::quantity::dv_ordinal::DvOrdinal>,
    /// The `list` attribute/element of the OPT `C_DV_ORDINAL` XSD type.
    pub list: Vec<openehr_rm::v1_2::data_types::quantity::dv_ordinal::DvOrdinal>,
}

/// openEHR AOM/OPT `C_DV_QUANTITY`.
#[derive(Debug, Clone, PartialEq)]
pub struct CDvQuantity {
    /// The `rm_type_name` attribute/element of the OPT `C_DV_QUANTITY` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `C_DV_QUANTITY` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `C_DV_QUANTITY` XSD type.
    pub node_id: String,
    /// The `assumed_value` attribute/element of the OPT `C_DV_QUANTITY` XSD type.
    pub assumed_value: Option<openehr_rm::v1_2::data_types::quantity::dv_quantity::DvQuantity>,
    /// The `property` attribute/element of the OPT `C_DV_QUANTITY` XSD type.
    pub property: Option<openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase>,
    /// The `list` attribute/element of the OPT `C_DV_QUANTITY` XSD type.
    pub list: Vec<CQuantityItem>,
}

/// openEHR AOM/OPT `C_DV_STATE`.
#[derive(Debug, Clone, PartialEq)]
pub struct CDvState {
    /// The `rm_type_name` attribute/element of the OPT `C_DV_STATE` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `C_DV_STATE` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `C_DV_STATE` XSD type.
    pub node_id: String,
    /// The `assumed_value` attribute/element of the OPT `C_DV_STATE` XSD type.
    pub assumed_value: Option<openehr_rm::v1_2::data_types::basic::dv_state::DvState>,
    /// The `value` attribute/element of the OPT `C_DV_STATE` XSD type.
    pub value: StateMachine,
}

/// openEHR AOM/OPT `C_INTEGER`.
#[derive(Debug, Clone, PartialEq)]
pub struct CInteger {
    /// The `list` attribute/element of the OPT `C_INTEGER` XSD type.
    pub list: Vec<i32>,
    /// The `range` attribute/element of the OPT `C_INTEGER` XSD type.
    pub range: Option<Intervalofinteger>,
    /// The `assumed_value` attribute/element of the OPT `C_INTEGER` XSD type.
    pub assumed_value: Option<i32>,
}

/// openEHR AOM/OPT `C_MULTIPLE_ATTRIBUTE`.
#[derive(Debug, Clone, PartialEq)]
pub struct CMultipleAttribute {
    /// The `rm_attribute_name` attribute/element of the OPT `C_MULTIPLE_ATTRIBUTE` XSD type.
    pub rm_attribute_name: String,
    /// The `existence` attribute/element of the OPT `C_MULTIPLE_ATTRIBUTE` XSD type.
    pub existence: Intervalofinteger,
    /// The `children` attribute/element of the OPT `C_MULTIPLE_ATTRIBUTE` XSD type.
    pub children: Vec<CObject>,
    /// The `cardinality` attribute/element of the OPT `C_MULTIPLE_ATTRIBUTE` XSD type.
    pub cardinality: Cardinality,
}

/// openEHR AOM/OPT `C_OBJECT`.
#[derive(Debug, Clone, PartialEq)]
pub enum CObject {
    /// The OPT `ARCHETYPE_INTERNAL_REF` subtype of `C_OBJECT`.
    ArchetypeInternalRef(ArchetypeInternalRef),
    /// The OPT `ARCHETYPE_SLOT` subtype of `C_OBJECT`.
    ArchetypeSlot(ArchetypeSlot),
    /// The OPT `CONSTRAINT_REF` subtype of `C_OBJECT`.
    ConstraintRef(ConstraintRef),
    /// The OPT `C_ARCHETYPE_ROOT` subtype of `C_OBJECT`.
    CArchetypeRoot(CArchetypeRoot),
    /// The OPT `C_CODE_PHRASE` subtype of `C_OBJECT`.
    CCodePhrase(CCodePhrase),
    /// The OPT `C_CODE_REFERENCE` subtype of `C_OBJECT`.
    CCodeReference(CCodeReference),
    /// The OPT `C_COMPLEX_OBJECT` subtype of `C_OBJECT`.
    CComplexObject(CComplexObject),
    /// The OPT `C_DEFINED_OBJECT` subtype of `C_OBJECT`.
    CDefinedObject(CDefinedObject),
    /// The OPT `C_DV_ORDINAL` subtype of `C_OBJECT`.
    CDvOrdinal(CDvOrdinal),
    /// The OPT `C_DV_QUANTITY` subtype of `C_OBJECT`.
    CDvQuantity(CDvQuantity),
    /// The OPT `C_DV_STATE` subtype of `C_OBJECT`.
    CDvState(CDvState),
    /// The OPT `C_PRIMITIVE_OBJECT` subtype of `C_OBJECT`.
    CPrimitiveObject(CPrimitiveObject),
    /// The OPT `T_COMPLEX_OBJECT` subtype of `C_OBJECT`.
    TComplexObject(TComplexObject),
}

/// openEHR AOM/OPT `C_PRIMITIVE`.
#[derive(Debug, Clone, PartialEq)]
pub enum CPrimitive {
    /// The OPT `C_BOOLEAN` subtype of `C_PRIMITIVE`.
    CBoolean(CBoolean),
    /// The OPT `C_DATE` subtype of `C_PRIMITIVE`.
    CDate(CDate),
    /// The OPT `C_DATE_TIME` subtype of `C_PRIMITIVE`.
    CDateTime(CDateTime),
    /// The OPT `C_DURATION` subtype of `C_PRIMITIVE`.
    CDuration(CDuration),
    /// The OPT `C_INTEGER` subtype of `C_PRIMITIVE`.
    CInteger(CInteger),
    /// The OPT `C_REAL` subtype of `C_PRIMITIVE`.
    CReal(CReal),
    /// The OPT `C_STRING` subtype of `C_PRIMITIVE`.
    CString(CString),
    /// The OPT `C_TIME` subtype of `C_PRIMITIVE`.
    CTime(CTime),
}

/// openEHR AOM/OPT `C_PRIMITIVE_OBJECT`.
#[derive(Debug, Clone, PartialEq)]
pub struct CPrimitiveObject {
    /// The `rm_type_name` attribute/element of the OPT `C_PRIMITIVE_OBJECT` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `C_PRIMITIVE_OBJECT` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `C_PRIMITIVE_OBJECT` XSD type.
    pub node_id: String,
    /// The `item` attribute/element of the OPT `C_PRIMITIVE_OBJECT` XSD type.
    pub item: Option<Box<CPrimitive>>,
}

/// openEHR AOM/OPT `C_QUANTITY_ITEM`.
#[derive(Debug, Clone, PartialEq)]
pub struct CQuantityItem {
    /// The `magnitude` attribute/element of the OPT `C_QUANTITY_ITEM` XSD type.
    pub magnitude: Option<Intervalofreal>,
    /// The `precision` attribute/element of the OPT `C_QUANTITY_ITEM` XSD type.
    pub precision: Option<Intervalofinteger>,
    /// The `units` attribute/element of the OPT `C_QUANTITY_ITEM` XSD type.
    pub units: String,
}

/// openEHR AOM/OPT `C_REAL`.
#[derive(Debug, Clone, PartialEq)]
pub struct CReal {
    /// The `list` attribute/element of the OPT `C_REAL` XSD type.
    pub list: Vec<f64>,
    /// The `range` attribute/element of the OPT `C_REAL` XSD type.
    pub range: Option<Intervalofreal>,
    /// The `assumed_value` attribute/element of the OPT `C_REAL` XSD type.
    pub assumed_value: Option<f64>,
}

/// openEHR AOM/OPT `C_SINGLE_ATTRIBUTE`.
#[derive(Debug, Clone, PartialEq)]
pub struct CSingleAttribute {
    /// The `rm_attribute_name` attribute/element of the OPT `C_SINGLE_ATTRIBUTE` XSD type.
    pub rm_attribute_name: String,
    /// The `existence` attribute/element of the OPT `C_SINGLE_ATTRIBUTE` XSD type.
    pub existence: Intervalofinteger,
    /// The `children` attribute/element of the OPT `C_SINGLE_ATTRIBUTE` XSD type.
    pub children: Vec<CObject>,
}

/// openEHR AOM/OPT `C_STRING`.
#[derive(Debug, Clone, PartialEq)]
pub struct CString {
    /// The `pattern` attribute/element of the OPT `C_STRING` XSD type.
    pub pattern: Option<String>,
    /// The `list` attribute/element of the OPT `C_STRING` XSD type.
    pub list: Vec<String>,
    /// The `list_open` attribute/element of the OPT `C_STRING` XSD type.
    pub list_open: Option<bool>,
    /// The `assumed_value` attribute/element of the OPT `C_STRING` XSD type.
    pub assumed_value: Option<String>,
}

/// openEHR AOM/OPT `C_TIME`.
#[derive(Debug, Clone, PartialEq)]
pub struct CTime {
    /// The `pattern` attribute/element of the OPT `C_TIME` XSD type.
    pub pattern: Option<String>,
    /// The `timezone_validity` attribute/element of the OPT `C_TIME` XSD type.
    pub timezone_validity: Option<ValidityKind>,
    /// The `range` attribute/element of the OPT `C_TIME` XSD type.
    pub range: Option<Intervaloftime>,
    /// The `assumed_value` attribute/element of the OPT `C_TIME` XSD type.
    pub assumed_value: Option<String>,
}

/// openEHR AOM/OPT `CodeDefinitionSet`.
#[derive(Debug, Clone, PartialEq)]
pub struct Codedefinitionset {
    /// The `language` attribute/element of the OPT `CodeDefinitionSet` XSD type.
    pub language: String,
    /// The `items` attribute/element of the OPT `CodeDefinitionSet` XSD type.
    pub items: Vec<ArchetypeTerm>,
}

/// openEHR AOM/OPT `ConstraintBindingSet`.
#[derive(Debug, Clone, PartialEq)]
pub struct Constraintbindingset {
    /// The `terminology` attribute/element of the OPT `ConstraintBindingSet` XSD type.
    pub terminology: String,
    /// The `items` attribute/element of the OPT `ConstraintBindingSet` XSD type.
    pub items: Vec<ConstraintBindingItem>,
}

/// openEHR AOM/OPT `EXPR_BINARY_OPERATOR`.
#[derive(Debug, Clone, PartialEq)]
pub struct ExprBinaryOperator {
    /// The `type` attribute/element of the OPT `EXPR_BINARY_OPERATOR` XSD type.
    pub r#type: String,
    /// The `operator` attribute/element of the OPT `EXPR_BINARY_OPERATOR` XSD type.
    pub operator: OperatorKind,
    /// The `precedence_overridden` attribute/element of the OPT `EXPR_BINARY_OPERATOR` XSD type.
    pub precedence_overridden: bool,
    /// The `left_operand` attribute/element of the OPT `EXPR_BINARY_OPERATOR` XSD type.
    pub left_operand: Box<ExprItem>,
    /// The `right_operand` attribute/element of the OPT `EXPR_BINARY_OPERATOR` XSD type.
    pub right_operand: Box<ExprItem>,
}

/// openEHR AOM/OPT `EXPR_ITEM`.
#[derive(Debug, Clone, PartialEq)]
pub enum ExprItem {
    /// The OPT `EXPR_BINARY_OPERATOR` subtype of `EXPR_ITEM`.
    ExprBinaryOperator(ExprBinaryOperator),
    /// The OPT `EXPR_LEAF` subtype of `EXPR_ITEM`.
    ExprLeaf(ExprLeaf),
    /// The OPT `EXPR_UNARY_OPERATOR` subtype of `EXPR_ITEM`.
    ExprUnaryOperator(ExprUnaryOperator),
}

/// openEHR AOM/OPT `EXPR_LEAF`.
#[derive(Debug, Clone, PartialEq)]
pub struct ExprLeaf {
    /// The `type` attribute/element of the OPT `EXPR_LEAF` XSD type.
    pub r#type: String,
    /// The `item` attribute/element of the OPT `EXPR_LEAF` XSD type.
    pub item: crate::xml::runtime::XmlAny,
    /// The `reference_type` attribute/element of the OPT `EXPR_LEAF` XSD type.
    pub reference_type: String,
}

/// openEHR AOM/OPT `EXPR_OPERATOR`.
#[derive(Debug, Clone, PartialEq)]
pub enum ExprOperator {
    /// The OPT `EXPR_BINARY_OPERATOR` subtype of `EXPR_OPERATOR`.
    ExprBinaryOperator(ExprBinaryOperator),
    /// The OPT `EXPR_UNARY_OPERATOR` subtype of `EXPR_OPERATOR`.
    ExprUnaryOperator(ExprUnaryOperator),
}

/// openEHR AOM/OPT `EXPR_UNARY_OPERATOR`.
#[derive(Debug, Clone, PartialEq)]
pub struct ExprUnaryOperator {
    /// The `type` attribute/element of the OPT `EXPR_UNARY_OPERATOR` XSD type.
    pub r#type: String,
    /// The `operator` attribute/element of the OPT `EXPR_UNARY_OPERATOR` XSD type.
    pub operator: OperatorKind,
    /// The `precedence_overridden` attribute/element of the OPT `EXPR_UNARY_OPERATOR` XSD type.
    pub precedence_overridden: bool,
    /// The `operand` attribute/element of the OPT `EXPR_UNARY_OPERATOR` XSD type.
    pub operand: Box<ExprItem>,
}

/// openEHR AOM/OPT `FLAT_ARCHETYPE_ONTOLOGY`.
#[derive(Debug, Clone, PartialEq)]
pub struct FlatArchetypeOntology {
    /// The `archetype_id` attribute/element of the OPT `FLAT_ARCHETYPE_ONTOLOGY` XSD type.
    pub archetype_id: String,
    /// The `term_definitions` attribute/element of the OPT `FLAT_ARCHETYPE_ONTOLOGY` XSD type.
    pub term_definitions: Vec<Codedefinitionset>,
    /// The `constraint_definitions` attribute/element of the OPT `FLAT_ARCHETYPE_ONTOLOGY` XSD type.
    pub constraint_definitions: Vec<Codedefinitionset>,
    /// The `term_bindings` attribute/element of the OPT `FLAT_ARCHETYPE_ONTOLOGY` XSD type.
    pub term_bindings: Vec<Termbindingset>,
    /// The `constraint_bindings` attribute/element of the OPT `FLAT_ARCHETYPE_ONTOLOGY` XSD type.
    pub constraint_bindings: Vec<Constraintbindingset>,
}

/// openEHR AOM/OPT `IntervalOfDate`.
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofdate {
    /// The `lower_included` attribute/element of the OPT `IntervalOfDate` XSD type.
    pub lower_included: Option<bool>,
    /// The `upper_included` attribute/element of the OPT `IntervalOfDate` XSD type.
    pub upper_included: Option<bool>,
    /// The `lower_unbounded` attribute/element of the OPT `IntervalOfDate` XSD type.
    pub lower_unbounded: bool,
    /// The `upper_unbounded` attribute/element of the OPT `IntervalOfDate` XSD type.
    pub upper_unbounded: bool,
    /// The `lower` attribute/element of the OPT `IntervalOfDate` XSD type.
    pub lower: Option<String>,
    /// The `upper` attribute/element of the OPT `IntervalOfDate` XSD type.
    pub upper: Option<String>,
}

/// openEHR AOM/OPT `IntervalOfDateTime`.
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofdatetime {
    /// The `lower_included` attribute/element of the OPT `IntervalOfDateTime` XSD type.
    pub lower_included: Option<bool>,
    /// The `upper_included` attribute/element of the OPT `IntervalOfDateTime` XSD type.
    pub upper_included: Option<bool>,
    /// The `lower_unbounded` attribute/element of the OPT `IntervalOfDateTime` XSD type.
    pub lower_unbounded: bool,
    /// The `upper_unbounded` attribute/element of the OPT `IntervalOfDateTime` XSD type.
    pub upper_unbounded: bool,
    /// The `lower` attribute/element of the OPT `IntervalOfDateTime` XSD type.
    pub lower: Option<String>,
    /// The `upper` attribute/element of the OPT `IntervalOfDateTime` XSD type.
    pub upper: Option<String>,
}

/// openEHR AOM/OPT `IntervalOfDuration`.
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofduration {
    /// The `lower_included` attribute/element of the OPT `IntervalOfDuration` XSD type.
    pub lower_included: Option<bool>,
    /// The `upper_included` attribute/element of the OPT `IntervalOfDuration` XSD type.
    pub upper_included: Option<bool>,
    /// The `lower_unbounded` attribute/element of the OPT `IntervalOfDuration` XSD type.
    pub lower_unbounded: bool,
    /// The `upper_unbounded` attribute/element of the OPT `IntervalOfDuration` XSD type.
    pub upper_unbounded: bool,
    /// The `lower` attribute/element of the OPT `IntervalOfDuration` XSD type.
    pub lower: Option<String>,
    /// The `upper` attribute/element of the OPT `IntervalOfDuration` XSD type.
    pub upper: Option<String>,
}

/// openEHR AOM/OPT `IntervalOfInteger`.
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofinteger {
    /// The `lower_included` attribute/element of the OPT `IntervalOfInteger` XSD type.
    pub lower_included: Option<bool>,
    /// The `upper_included` attribute/element of the OPT `IntervalOfInteger` XSD type.
    pub upper_included: Option<bool>,
    /// The `lower_unbounded` attribute/element of the OPT `IntervalOfInteger` XSD type.
    pub lower_unbounded: bool,
    /// The `upper_unbounded` attribute/element of the OPT `IntervalOfInteger` XSD type.
    pub upper_unbounded: bool,
    /// The `lower` attribute/element of the OPT `IntervalOfInteger` XSD type.
    pub lower: Option<i32>,
    /// The `upper` attribute/element of the OPT `IntervalOfInteger` XSD type.
    pub upper: Option<i32>,
}

/// openEHR AOM/OPT `IntervalOfReal`.
#[derive(Debug, Clone, PartialEq)]
pub struct Intervalofreal {
    /// The `lower_included` attribute/element of the OPT `IntervalOfReal` XSD type.
    pub lower_included: Option<bool>,
    /// The `upper_included` attribute/element of the OPT `IntervalOfReal` XSD type.
    pub upper_included: Option<bool>,
    /// The `lower_unbounded` attribute/element of the OPT `IntervalOfReal` XSD type.
    pub lower_unbounded: bool,
    /// The `upper_unbounded` attribute/element of the OPT `IntervalOfReal` XSD type.
    pub upper_unbounded: bool,
    /// The `lower` attribute/element of the OPT `IntervalOfReal` XSD type.
    pub lower: Option<f64>,
    /// The `upper` attribute/element of the OPT `IntervalOfReal` XSD type.
    pub upper: Option<f64>,
}

/// openEHR AOM/OPT `IntervalOfTime`.
#[derive(Debug, Clone, PartialEq)]
pub struct Intervaloftime {
    /// The `lower_included` attribute/element of the OPT `IntervalOfTime` XSD type.
    pub lower_included: Option<bool>,
    /// The `upper_included` attribute/element of the OPT `IntervalOfTime` XSD type.
    pub upper_included: Option<bool>,
    /// The `lower_unbounded` attribute/element of the OPT `IntervalOfTime` XSD type.
    pub lower_unbounded: bool,
    /// The `upper_unbounded` attribute/element of the OPT `IntervalOfTime` XSD type.
    pub upper_unbounded: bool,
    /// The `lower` attribute/element of the OPT `IntervalOfTime` XSD type.
    pub lower: Option<String>,
    /// The `upper` attribute/element of the OPT `IntervalOfTime` XSD type.
    pub upper: Option<String>,
}

/// openEHR AOM/OPT `NON_TERMINAL_STATE`.
#[derive(Debug, Clone, PartialEq)]
pub struct NonTerminalState {
    /// The `name` attribute/element of the OPT `NON_TERMINAL_STATE` XSD type.
    pub name: String,
    /// The `transitions` attribute/element of the OPT `NON_TERMINAL_STATE` XSD type.
    pub transitions: Vec<Transition>,
}

/// openEHR AOM/OPT `OPERATIONAL_TEMPLATE`.
#[derive(Debug, Clone, PartialEq)]
pub struct OperationalTemplate {
    /// The `language` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub language: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
    /// The `is_controlled` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub is_controlled: Option<bool>,
    /// The `description` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub description: Option<ResourceDescription>,
    /// The `revision_history` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub revision_history:
        Option<openehr_rm::v1_2::common::generic::revision_history::RevisionHistory>,
    /// The `uid` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub uid: Option<openehr_base::v1_3::base_types::identification::hier_object_id::HierObjectId>,
    /// The `template_id` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub template_id: openehr_base::v1_3::base_types::identification::template_id::TemplateId,
    /// The `concept` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub concept: String,
    /// The `definition` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub definition: CArchetypeRoot,
    /// The `ontology` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub ontology: Option<FlatArchetypeOntology>,
    /// The `component_ontologies` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub component_ontologies: Vec<FlatArchetypeOntology>,
    /// The `annotations` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub annotations: Vec<Annotation>,
    /// The `constraints` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub constraints: Option<TConstraint>,
    /// The `view` attribute/element of the OPT `OPERATIONAL_TEMPLATE` XSD type.
    pub view: Option<crate::xml::runtime::XmlAny>,
}

/// openEHR AOM/OPT `RESOURCE_DESCRIPTION`.
#[derive(Debug, Clone, PartialEq)]
pub struct ResourceDescription {
    /// The `original_author` attribute/element of the OPT `RESOURCE_DESCRIPTION` XSD type.
    pub original_author: indexmap::IndexMap<String, String>,
    /// The `other_contributors` attribute/element of the OPT `RESOURCE_DESCRIPTION` XSD type.
    pub other_contributors: Vec<String>,
    /// The `lifecycle_state` attribute/element of the OPT `RESOURCE_DESCRIPTION` XSD type.
    pub lifecycle_state: String,
    /// The `resource_package_uri` attribute/element of the OPT `RESOURCE_DESCRIPTION` XSD type.
    pub resource_package_uri: Option<String>,
    /// The `other_details` attribute/element of the OPT `RESOURCE_DESCRIPTION` XSD type.
    pub other_details: Option<indexmap::IndexMap<String, String>>,
    /// The `details` attribute/element of the OPT `RESOURCE_DESCRIPTION` XSD type.
    pub details: Vec<ResourceDescriptionItem>,
    /// The `parent_resource` attribute/element of the OPT `RESOURCE_DESCRIPTION` XSD type.
    pub parent_resource: Option<Box<AuthoredResource>>,
}

/// openEHR AOM/OPT `RESOURCE_DESCRIPTION_ITEM`.
#[derive(Debug, Clone, PartialEq)]
pub struct ResourceDescriptionItem {
    /// The `language` attribute/element of the OPT `RESOURCE_DESCRIPTION_ITEM` XSD type.
    pub language: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
    /// The `purpose` attribute/element of the OPT `RESOURCE_DESCRIPTION_ITEM` XSD type.
    pub purpose: String,
    /// The `keywords` attribute/element of the OPT `RESOURCE_DESCRIPTION_ITEM` XSD type.
    pub keywords: Vec<String>,
    /// The `use` attribute/element of the OPT `RESOURCE_DESCRIPTION_ITEM` XSD type.
    pub use_: Option<String>,
    /// The `misuse` attribute/element of the OPT `RESOURCE_DESCRIPTION_ITEM` XSD type.
    pub misuse: Option<String>,
    /// The `copyright` attribute/element of the OPT `RESOURCE_DESCRIPTION_ITEM` XSD type.
    pub copyright: Option<String>,
    /// The `original_resource_uri` attribute/element of the OPT `RESOURCE_DESCRIPTION_ITEM` XSD type.
    pub original_resource_uri: Option<indexmap::IndexMap<String, String>>,
    /// The `other_details` attribute/element of the OPT `RESOURCE_DESCRIPTION_ITEM` XSD type.
    pub other_details: Option<indexmap::IndexMap<String, String>>,
}

/// openEHR AOM/OPT `STATE`.
#[derive(Debug, Clone, PartialEq)]
pub enum State {
    /// The OPT `NON_TERMINAL_STATE` subtype of `STATE`.
    NonTerminalState(NonTerminalState),
    /// The OPT `TERMINAL_STATE` subtype of `STATE`.
    TerminalState(TerminalState),
}

/// openEHR AOM/OPT `STATE_MACHINE`.
#[derive(Debug, Clone, PartialEq)]
pub struct StateMachine {
    /// The `states` attribute/element of the OPT `STATE_MACHINE` XSD type.
    pub states: Vec<State>,
}

/// openEHR AOM/OPT `TERMINAL_STATE`.
#[derive(Debug, Clone, PartialEq)]
pub struct TerminalState {
    /// The `name` attribute/element of the OPT `TERMINAL_STATE` XSD type.
    pub name: String,
}

/// openEHR AOM/OPT `TERM_BINDING_ITEM`.
#[derive(Debug, Clone, PartialEq)]
pub struct TermBindingItem {
    /// The `code` attribute/element of the OPT `TERM_BINDING_ITEM` XSD type.
    pub code: String,
    /// The `value` attribute/element of the OPT `TERM_BINDING_ITEM` XSD type.
    pub value: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
}

/// openEHR AOM/OPT `TRANSITION`.
#[derive(Debug, Clone, PartialEq)]
pub struct Transition {
    /// The `event` attribute/element of the OPT `TRANSITION` XSD type.
    pub event: String,
    /// The `action` attribute/element of the OPT `TRANSITION` XSD type.
    pub action: Option<String>,
    /// The `guard` attribute/element of the OPT `TRANSITION` XSD type.
    pub guard: Option<String>,
    /// The `next_state` attribute/element of the OPT `TRANSITION` XSD type.
    pub next_state: Option<Box<State>>,
}

/// openEHR AOM/OPT `TRANSLATION_DETAILS`.
#[derive(Debug, Clone, PartialEq)]
pub struct TranslationDetails {
    /// The `language` attribute/element of the OPT `TRANSLATION_DETAILS` XSD type.
    pub language: openehr_base::v1_3::base_types::terminology::code_phrase::CodePhrase,
    /// The `author` attribute/element of the OPT `TRANSLATION_DETAILS` XSD type.
    pub author: indexmap::IndexMap<String, String>,
    /// The `accreditation` attribute/element of the OPT `TRANSLATION_DETAILS` XSD type.
    pub accreditation: Option<String>,
    /// The `other_details` attribute/element of the OPT `TRANSLATION_DETAILS` XSD type.
    pub other_details: Option<indexmap::IndexMap<String, String>>,
}

/// openEHR AOM/OPT `T_ATTRIBUTE`.
#[derive(Debug, Clone, PartialEq)]
pub struct TAttribute {
    /// The `rm_attribute_name` attribute/element of the OPT `T_ATTRIBUTE` XSD type.
    pub rm_attribute_name: String,
    /// The `children` attribute/element of the OPT `T_ATTRIBUTE` XSD type.
    pub children: Vec<TComplexObject>,
    /// The `differential_path` attribute/element of the OPT `T_ATTRIBUTE` XSD type.
    pub differential_path: String,
}

/// openEHR AOM/OPT `T_COMPLEX_OBJECT`.
#[derive(Debug, Clone, PartialEq)]
pub struct TComplexObject {
    /// The `rm_type_name` attribute/element of the OPT `T_COMPLEX_OBJECT` XSD type.
    pub rm_type_name: String,
    /// The `occurrences` attribute/element of the OPT `T_COMPLEX_OBJECT` XSD type.
    pub occurrences: Intervalofinteger,
    /// The `node_id` attribute/element of the OPT `T_COMPLEX_OBJECT` XSD type.
    pub node_id: String,
    /// The `attributes` attribute/element of the OPT `T_COMPLEX_OBJECT` XSD type.
    pub attributes: Vec<CAttribute>,
    /// The `default_value` attribute/element of the OPT `T_COMPLEX_OBJECT` XSD type.
    pub default_value: Option<openehr_rm::v1_2::data_types::basic::data_value::DataValue>,
}

/// openEHR AOM/OPT `T_CONSTRAINT`.
#[derive(Debug, Clone, PartialEq)]
pub struct TConstraint {
    /// The `attributes` attribute/element of the OPT `T_CONSTRAINT` XSD type.
    pub attributes: Vec<TAttribute>,
}

/// openEHR AOM/OPT `TermBindingSet`.
#[derive(Debug, Clone, PartialEq)]
pub struct Termbindingset {
    /// The `terminology` attribute/element of the OPT `TermBindingSet` XSD type.
    pub terminology: String,
    /// The `items` attribute/element of the OPT `TermBindingSet` XSD type.
    pub items: Vec<TermBindingItem>,
}