1use crate::primitives::{
2 Annotation, DataType, Link, LocalizedText, Meta, SdmxMessage, SentinelValue, StatusMessage,
3};
4use crate::structure::{CommonArtefactType, DataConstraint, MetadataConstraint};
5use serde::{Deserialize, Serialize};
6use serde_json::Value;
7use std::collections::HashMap;
8use std::str::FromStr;
9
10#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
51pub struct StructureMessage {
52 #[serde(skip_serializing_if = "Option::is_none")]
53 pub meta: Option<Meta>,
54 #[serde(skip_serializing_if = "Option::is_none")]
55 pub data: Option<Data>,
56 #[serde(skip_serializing_if = "Option::is_none")]
57 pub errors: Option<Vec<StatusMessage>>,
58 #[serde(skip_serializing_if = "Option::is_none")]
59 #[serde(flatten)]
60 pub other: Option<HashMap<String, Value>>,
61}
62
63impl SdmxMessage for StructureMessage {
64 type Data = Data;
65 fn meta(&self) -> Option<&Meta> {
66 self.meta.as_ref()
67 }
68
69 fn data(&self) -> Option<&Self::Data> {
70 self.data.as_ref()
71 }
72
73 fn errors(&self) -> Option<&Vec<StatusMessage>> {
74 self.errors.as_ref()
75 }
76}
77impl<'a> TryFrom<&'a [u8]> for StructureMessage {
78 type Error = serde_json::Error;
79 fn try_from(slice: &'a [u8]) -> Result<Self, Self::Error> {
80 serde_json::from_slice(slice)
81 }
82}
83
84impl FromStr for StructureMessage {
85 type Err = serde_json::Error;
86 fn from_str(s: &str) -> Result<Self, Self::Err> {
87 serde_json::from_str(s)
88 }
89}
90
91impl TryFrom<Value> for StructureMessage {
92 type Error = serde_json::Error;
93 fn try_from(value: Value) -> Result<Self, Self::Error> {
94 serde_json::from_value(value)
95 }
96}
97
98#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
100pub struct Data {
101 #[serde(skip_serializing_if = "Option::is_none")]
102 pub data_structures: Option<Vec<DataStructure>>,
103 #[serde(skip_serializing_if = "Option::is_none")]
104 pub metadata_structures: Option<Vec<MetadataStructure>>,
105 #[serde(skip_serializing_if = "Option::is_none")]
106 pub category_schemas: Option<Vec<CategoryScheme>>,
107 #[serde(skip_serializing_if = "Option::is_none")]
108 pub concept_schemas: Option<Vec<ConceptScheme>>,
109 #[serde(skip_serializing_if = "Option::is_none")]
110 pub concepts: Option<Vec<Codelist>>,
111 #[serde(skip_serializing_if = "Option::is_none")]
112 pub geographic_codelists: Option<Vec<Codelist>>,
113 #[serde(skip_serializing_if = "Option::is_none")]
114 pub geo_grid_codelists: Option<Vec<Codelist>>,
115 #[serde(skip_serializing_if = "Option::is_none")]
116 pub value_lists: Option<Vec<CommonArtefactType>>,
117 #[serde(skip_serializing_if = "Option::is_none")]
118 pub hierarchies: Option<Vec<CommonArtefactType>>,
119 #[serde(skip_serializing_if = "Option::is_none")]
120 pub hierarchy_associations: Option<Vec<CommonArtefactType>>,
121 #[serde(skip_serializing_if = "Option::is_none")]
122 pub agency_schemes: Option<Vec<AgencyScheme>>,
123 #[serde(skip_serializing_if = "Option::is_none")]
124 pub data_provider_schemes: Option<Vec<DataProviderScheme>>,
125 #[serde(skip_serializing_if = "Option::is_none")]
126 pub data_consumer_schemes: Option<Vec<DataConsumerScheme>>,
127 #[serde(skip_serializing_if = "Option::is_none")]
128 pub metadata_provider_schemes: Option<Vec<MetadataProviderScheme>>,
129 #[serde(skip_serializing_if = "Option::is_none")]
130 pub organisation_unit_schemes: Option<Vec<OrganizationUnitScheme>>,
131 #[serde(skip_serializing_if = "Option::is_none")]
132 pub dataflows: Option<Vec<Dataflow>>,
133 #[serde(skip_serializing_if = "Option::is_none")]
134 pub metadataflows: Option<Vec<CommonArtefactType>>,
135 #[serde(skip_serializing_if = "Option::is_none")]
136 pub reporting_taxonomies: Option<Vec<ReportingTaxonomy>>,
137 #[serde(skip_serializing_if = "Option::is_none")]
138 pub provision_agreements: Option<Vec<CommonArtefactType>>,
139 #[serde(skip_serializing_if = "Option::is_none")]
140 pub metadata_provision_agreements: Option<Vec<CommonArtefactType>>,
141 #[serde(skip_serializing_if = "Option::is_none")]
142 pub structure_maps: Option<Vec<CommonArtefactType>>,
143 #[serde(skip_serializing_if = "Option::is_none")]
144 pub representation_maps: Option<Vec<CommonArtefactType>>,
145 #[serde(skip_serializing_if = "Option::is_none")]
146 pub concept_scheme_maps: Option<Vec<CommonArtefactType>>,
147 #[serde(skip_serializing_if = "Option::is_none")]
148 pub category_scheme_maps: Option<Vec<CommonArtefactType>>,
149 #[serde(skip_serializing_if = "Option::is_none")]
150 pub organisation_scheme_maps: Option<Vec<CommonArtefactType>>,
151 #[serde(skip_serializing_if = "Option::is_none")]
152 pub reporting_taxonomy_maps: Option<Vec<CommonArtefactType>>,
153 #[serde(skip_serializing_if = "Option::is_none")]
154 pub processes: Option<Vec<CommonArtefactType>>,
155 #[serde(skip_serializing_if = "Option::is_none")]
156 pub categorisations: Option<Vec<Categorization>>,
157 #[serde(skip_serializing_if = "Option::is_none")]
158 pub data_constraints: Option<Vec<DataConstraint>>,
159 #[serde(skip_serializing_if = "Option::is_none")]
160 pub metadata_constraints: Option<Vec<MetadataConstraint>>,
161 #[serde(skip_serializing_if = "Option::is_none")]
162 pub custom_type_schemes: Option<Vec<CustomTypeScheme>>,
163 #[serde(skip_serializing_if = "Option::is_none")]
164 pub vtl_mapping_schemes: Option<Vec<VtlMappingScheme>>,
165 #[serde(skip_serializing_if = "Option::is_none")]
166 pub name_personalisation_schemes: Option<Vec<NamePersonalizationScheme>>,
167 #[serde(skip_serializing_if = "Option::is_none")]
168 pub ruleset_schemes: Option<Vec<RulesetScheme>>,
169 #[serde(skip_serializing_if = "Option::is_none")]
170 pub transformation_schemes: Option<Vec<TransformationScheme>>,
171 #[serde(skip_serializing_if = "Option::is_none")]
172 pub user_defined_operator_schemes: Option<Vec<UserDefinedOperatorsScheme>>,
173 #[serde(skip_serializing_if = "Option::is_none")]
174 #[serde(flatten)]
175 pub other: Option<HashMap<String, Value>>,
176}
177
178#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
180pub struct Item {
181 pub id: String,
182 #[serde(skip_serializing_if = "Option::is_none")]
183 pub name: Option<String>,
184 #[serde(skip_serializing_if = "Option::is_none")]
185 pub names: Option<LocalizedText>,
186 #[serde(skip_serializing_if = "Option::is_none")]
187 pub description: Option<String>,
188 #[serde(skip_serializing_if = "Option::is_none")]
189 pub descriptions: Option<LocalizedText>,
190 #[serde(skip_serializing_if = "Option::is_none")]
191 pub annotations: Option<Vec<Annotation>>,
192 #[serde(skip_serializing_if = "Option::is_none")]
193 pub links: Option<Vec<Link>>,
194 #[serde(skip_serializing_if = "Option::is_none")]
195 #[serde(flatten)]
196 pub other: Option<HashMap<String, Value>>,
197}
198
199#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
202#[serde(rename_all = "camelCase")]
203pub struct DataStructure {
204 #[serde(flatten)]
205 pub common: CommonArtefactType,
206 #[serde(skip_serializing_if = "Option::is_none")]
207 pub data_structure_components: Option<DataStructureComponents>,
208 #[serde(skip_serializing_if = "Option::is_none")]
209 pub metadata: Option<String>,
210 #[serde(skip_serializing_if = "Option::is_none")]
211 #[serde(flatten)]
212 pub other: Option<HashMap<String, Value>>,
213}
214
215#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
218#[serde(rename_all = "camelCase")]
219pub struct DataStructureComponents {
220 #[serde(skip_serializing_if = "Option::is_none")]
221 pub attribute_list: Option<AttributeList>,
222 pub dimension_list: DimensionList,
223 #[serde(skip_serializing_if = "Option::is_none")]
224 pub groups: Option<Vec<Group>>,
225 #[serde(skip_serializing_if = "Option::is_none")]
226 pub measure_list: Option<MeasureList>,
227 #[serde(skip_serializing_if = "Option::is_none")]
228 #[serde(flatten)]
229 pub other: Option<HashMap<String, Value>>,
230}
231
232#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
234#[serde(rename_all = "camelCase")]
235pub struct AttributeList {
236 pub id: String,
237 #[serde(skip_serializing_if = "Option::is_none")]
238 pub annotations: Option<Vec<Annotation>>,
239 #[serde(skip_serializing_if = "Option::is_none")]
240 pub links: Option<Vec<Link>>,
241 #[serde(skip_serializing_if = "Option::is_none")]
242 pub attributes: Option<Vec<Attribute>>,
243 #[serde(skip_serializing_if = "Option::is_none")]
244 pub metadata_attribute_usages: Option<Vec<MetadataAttributeUsage>>,
245 #[serde(skip_serializing_if = "Option::is_none")]
246 #[serde(flatten)]
247 pub other: Option<HashMap<String, Value>>,
248}
249
250#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
252#[serde(rename_all = "camelCase")]
253pub struct Attribute {
254 pub id: String,
255 #[serde(skip_serializing_if = "Option::is_none")]
256 pub annotations: Option<Vec<Annotation>>,
257 pub links: Option<Vec<Link>>,
258 pub usage: Usage,
259 pub attribute_relationship: AttributeRelationship,
260 #[serde(skip_serializing_if = "Option::is_none")]
261 pub measure_relationship: Option<Vec<String>>,
262 pub concept_identity: String,
263 #[serde(skip_serializing_if = "Option::is_none")]
264 pub concept_roles: Option<Vec<String>>,
265 pub local_representation: LocalRepresentation,
266 #[serde(skip_serializing_if = "Option::is_none")]
267 #[serde(flatten)]
268 pub other: Option<HashMap<String, Value>>,
269}
270
271#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
273#[serde(rename_all = "lowercase")]
274pub enum Usage {
275 Mandatory,
276 Optional,
277}
278
279#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
282#[serde(rename_all = "camelCase")]
283pub enum AttributeRelationship {
284 DataFlow(AttributeRelationshipDataflow),
285 Dimensions(AttributeRelationshipDimensions),
286 Groups(AttributeRelationshipGroups),
287 Observations(AttributeRelationshipObservations),
288}
289
290#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
292pub struct AttributeRelationshipDataflow {
293 pub dataflow: (),
295 #[serde(flatten)]
296 pub other: Option<HashMap<String, Value>>,
297}
298
299#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
303pub struct AttributeRelationshipDimensions {
304 pub dimensions: Option<Vec<String>>,
305 pub are_dimensions_optional: Option<Vec<bool>>,
306 #[serde(flatten)]
307 pub other: Option<HashMap<String, Value>>,
308}
309
310#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
313pub struct AttributeRelationshipGroups {
314 pub group: String,
315 #[serde(flatten)]
316 pub other: Option<HashMap<String, Value>>,
317}
318
319#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
323pub struct AttributeRelationshipObservations {
324 pub observation: (),
326 #[serde(flatten)]
327 pub other: Option<HashMap<String, Value>>,
328}
329
330#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
332#[serde(rename_all = "camelCase")]
333pub struct LocalRepresentation {
334 #[serde(skip_serializing_if = "Option::is_none")]
335 pub enumeration: Option<String>,
336 #[serde(skip_serializing_if = "Option::is_none")]
337 pub enumeration_format: Option<EnumerationFormat>,
338 #[serde(skip_serializing_if = "Option::is_none")]
339 pub format: Option<Format>,
340 #[serde(skip_serializing_if = "Option::is_none")]
341 pub min_occurs: Option<usize>,
342 #[serde(skip_serializing_if = "Option::is_none")]
343 pub max_occurs: Option<Occurrence>,
344 #[serde(skip_serializing_if = "Option::is_none")]
345 #[serde(flatten)]
346 pub other: Option<HashMap<String, Value>>,
347}
348
349#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
353pub enum Occurrence {
354 Signed(usize),
355 Unbounded,
356}
357
358impl From<usize> for Occurrence {
359 fn from(value: usize) -> Self {
360 Self::Signed(value)
361 }
362}
363
364#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
367#[serde(rename_all = "camelCase")]
368pub struct EnumerationFormat {
369 #[serde(skip_serializing_if = "Option::is_none")]
370 pub data_type: Option<DataType>,
371 #[serde(skip_serializing_if = "Option::is_none")]
372 pub is_sequence: Option<bool>,
373 #[serde(skip_serializing_if = "Option::is_none")]
374 pub interval: Option<isize>,
375 #[serde(skip_serializing_if = "Option::is_none")]
376 pub start_value: Option<isize>,
377 #[serde(skip_serializing_if = "Option::is_none")]
378 pub end_value: Option<isize>,
379 #[serde(skip_serializing_if = "Option::is_none")]
380 pub time_interval: Option<String>,
381 #[serde(skip_serializing_if = "Option::is_none")]
382 pub start_time: Option<String>,
383 #[serde(skip_serializing_if = "Option::is_none")]
384 pub end_time: Option<String>,
385 #[serde(skip_serializing_if = "Option::is_none")]
386 pub min_length: Option<usize>,
387 #[serde(skip_serializing_if = "Option::is_none")]
388 pub max_length: Option<usize>,
389 #[serde(skip_serializing_if = "Option::is_none")]
390 pub min_value: Option<isize>,
391 #[serde(skip_serializing_if = "Option::is_none")]
392 pub max_value: Option<isize>,
393 #[serde(skip_serializing_if = "Option::is_none")]
394 pub pattern: Option<String>,
395 #[serde(skip_serializing_if = "Option::is_none")]
396 #[serde(flatten)]
397 pub other: Option<HashMap<String, Value>>,
398}
399
400#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
404#[serde(rename_all = "camelCase")]
405pub struct Format {
406 #[serde(skip_serializing_if = "Option::is_none")]
407 pub data_type: Option<DataType>,
408 #[serde(skip_serializing_if = "Option::is_none")]
409 pub is_sequence: Option<bool>,
410 #[serde(skip_serializing_if = "Option::is_none")]
411 pub interval: Option<isize>,
412 #[serde(skip_serializing_if = "Option::is_none")]
413 pub start_value: Option<isize>,
414 #[serde(skip_serializing_if = "Option::is_none")]
415 pub end_value: Option<isize>,
416 #[serde(skip_serializing_if = "Option::is_none")]
417 pub time_interval: Option<String>,
418 #[serde(skip_serializing_if = "Option::is_none")]
419 pub start_time: Option<String>,
420 #[serde(skip_serializing_if = "Option::is_none")]
421 pub end_time: Option<String>,
422 #[serde(skip_serializing_if = "Option::is_none")]
423 pub min_length: Option<usize>,
424 #[serde(skip_serializing_if = "Option::is_none")]
425 pub max_length: Option<usize>,
426 #[serde(skip_serializing_if = "Option::is_none")]
427 pub min_value: Option<isize>,
428 #[serde(skip_serializing_if = "Option::is_none")]
429 pub max_value: Option<isize>,
430 pub is_multilingual: bool,
431 #[serde(skip_serializing_if = "Option::is_none")]
432 pub sentinel_value: Option<Vec<SentinelValue>>,
433 #[serde(skip_serializing_if = "Option::is_none")]
434 #[serde(flatten)]
435 pub other: Option<HashMap<String, Value>>,
436}
437
438#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
441#[serde(rename_all = "camelCase")]
442pub struct MetadataAttributeUsage {
443 #[serde(skip_serializing_if = "Option::is_none")]
444 pub annotations: Option<Vec<Annotation>>,
445 #[serde(skip_serializing_if = "Option::is_none")]
446 pub links: Option<Vec<Link>>,
447 pub metadata_attribute_reference: String,
448 pub attribute_relationship: AttributeRelationship,
449 #[serde(skip_serializing_if = "Option::is_none")]
450 #[serde(flatten)]
451 pub other: Option<HashMap<String, Value>>,
452}
453
454#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
457#[serde(rename_all = "camelCase")]
458pub struct DimensionList {
459 #[serde(skip_serializing_if = "Option::is_none")]
460 pub id: Option<String>,
461 #[serde(skip_serializing_if = "Option::is_none")]
462 pub annotations: Option<Vec<String>>,
463 #[serde(skip_serializing_if = "Option::is_none")]
464 pub links: Option<Vec<Link>>,
465 #[serde(skip_serializing_if = "Option::is_none")]
466 pub dimensions: Option<Vec<Dimension>>,
467 #[serde(skip_serializing_if = "Option::is_none")]
468 pub time_dimensions: Option<TimeDimension>,
469 #[serde(skip_serializing_if = "Option::is_none")]
470 #[serde(flatten)]
471 pub other: Option<HashMap<String, Value>>,
472}
473
474#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
477#[serde(rename_all = "camelCase")]
478pub struct Dimension {
479 #[serde(skip_serializing_if = "Option::is_none")]
480 pub id: Option<String>,
481 #[serde(skip_serializing_if = "Option::is_none")]
482 pub annotations: Option<Vec<Annotation>>,
483 #[serde(skip_serializing_if = "Option::is_none")]
484 pub links: Option<Vec<Link>>,
485 pub position: usize,
486 pub concept_identity: String,
487 #[serde(skip_serializing_if = "Option::is_none")]
488 pub concept_roles: Option<Vec<String>>,
489 #[serde(skip_serializing_if = "Option::is_none")]
490 pub local_representation: Option<LocalRepresentation>,
491 #[serde(skip_serializing_if = "Option::is_none")]
492 #[serde(flatten)]
493 pub other: Option<HashMap<String, Value>>,
494}
495
496#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
498#[serde(rename_all = "camelCase")]
499pub struct TimeDimension {
500 #[serde(skip_serializing_if = "Option::is_none")]
501 pub id: Option<String>,
502 #[serde(skip_serializing_if = "Option::is_none")]
503 pub annotations: Option<Vec<Annotation>>,
504 #[serde(skip_serializing_if = "Option::is_none")]
505 pub links: Option<Vec<Link>>,
506 pub concept_identity: String,
507 pub local_representation: LocalRepresentation,
508 #[serde(skip_serializing_if = "Option::is_none")]
509 #[serde(flatten)]
510 pub other: Option<HashMap<String, Value>>,
511}
512
513#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
516#[serde(rename_all = "camelCase")]
517pub struct TimeDimensionFormat {
518 #[serde(skip_serializing_if = "Option::is_none")]
519 pub start_time: Option<String>,
520 #[serde(skip_serializing_if = "Option::is_none")]
521 pub end_time: Option<String>,
522 pub data_type: TimeDataType,
523 pub sentinel_values: Option<Vec<SentinelValue>>,
524 #[serde(skip_serializing_if = "Option::is_none")]
525 #[serde(flatten)]
526 pub other: Option<HashMap<String, Value>>,
527}
528
529#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
531pub enum TimeDataType {
532 ObservationalTimePeriod,
533 StandardTimePeriod,
534 BasicTimePeriod,
535 GregorianTimePeriod,
536 GregorianYear,
537 GregorianYearMonth,
538 GregorianDay,
539 ReportingTimePeriod,
540 ReportingYear,
541 ReportingSemester,
542 ReportingTrimester,
543 ReportingQuarter,
544 ReportingMonth,
545 ReportingWeek,
546 ReportingDay,
547 DateTime,
548 TimeRange,
549}
550
551impl TimeDataType {
552 pub const fn is_reporting(&self) -> bool {
553 matches!(
554 self,
555 Self::ReportingDay
556 | Self::ReportingWeek
557 | Self::ReportingMonth
558 | Self::ReportingYear
559 | Self::ReportingQuarter
560 | Self::ReportingSemester
561 | Self::ReportingTrimester
562 | Self::ReportingTimePeriod
563 )
564 }
565
566 pub const fn is_gregorian(&self) -> bool {
567 matches!(
568 self,
569 Self::GregorianTimePeriod
570 | Self::GregorianYear
571 | Self::GregorianYearMonth
572 | Self::GregorianDay
573 )
574 }
575}
576
577impl TryFrom<DataType> for TimeDataType {
578 type Error = ();
579 fn try_from(value: DataType) -> Result<Self, Self::Error> {
580 match value {
581 DataType::ObservationalTimePeriod => Ok(Self::ObservationalTimePeriod),
582 DataType::StandardTimePeriod => Ok(Self::StandardTimePeriod),
583 DataType::BasicTimePeriod => Ok(Self::BasicTimePeriod),
584 DataType::GregorianTimePeriod => Ok(Self::GregorianTimePeriod),
585 DataType::GregorianYear => Ok(Self::GregorianYear),
586 DataType::GregorianYearMonth => Ok(Self::GregorianYearMonth),
587 DataType::GregorianDay => Ok(Self::GregorianDay),
588 DataType::ReportingTimePeriod => Ok(Self::ReportingTimePeriod),
589 DataType::ReportingYear => Ok(Self::ReportingYear),
590 DataType::ReportingSemester => Ok(Self::ReportingSemester),
591 DataType::ReportingTrimester => Ok(Self::ReportingTrimester),
592 DataType::ReportingQuarter => Ok(Self::ReportingQuarter),
593 DataType::ReportingMonth => Ok(Self::ReportingMonth),
594 DataType::ReportingWeek => Ok(Self::ReportingWeek),
595 DataType::ReportingDay => Ok(Self::ReportingDay),
596 DataType::DateTime => Ok(Self::DateTime),
597 DataType::TimeRange => Ok(Self::TimeRange),
598 _ => Err(()),
599 }
600 }
601}
602
603#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
606#[serde(rename_all = "camelCase")]
607pub struct Group {
608 pub id: String,
609 #[serde(skip_serializing_if = "Option::is_none")]
610 pub annotations: Option<Vec<Annotation>>,
611 #[serde(skip_serializing_if = "Option::is_none")]
612 pub links: Option<Vec<Link>>,
613 #[serde(skip_serializing_if = "Option::is_none")]
614 pub group_dimensions: Option<Vec<String>>,
615 #[serde(skip_serializing_if = "Option::is_none")]
616 #[serde(flatten)]
617 pub other: Option<HashMap<String, Value>>,
618}
619
620#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
623pub struct MeasureList {
624 pub id: String,
625 #[serde(skip_serializing_if = "Option::is_none")]
626 pub annotations: Option<Vec<Annotation>>,
627 #[serde(skip_serializing_if = "Option::is_none")]
628 pub links: Option<Vec<Link>>,
629 #[serde(skip_serializing_if = "Option::is_none")]
630 pub measures: Option<Vec<Measure>>,
631 #[serde(skip_serializing_if = "Option::is_none")]
632 #[serde(flatten)]
633 pub other: Option<HashMap<String, Value>>,
634}
635
636#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
639#[serde(rename_all = "camelCase")]
640pub struct Measure {
641 pub id: String,
642 #[serde(skip_serializing_if = "Option::is_none")]
643 pub annotations: Option<Vec<Annotation>>,
644 #[serde(skip_serializing_if = "Option::is_none")]
645 pub links: Option<Vec<Link>>,
646 pub concept_identity: String,
647 #[serde(skip_serializing_if = "Option::is_none")]
648 pub concept_roles: Option<Vec<String>>,
649 pub local_representation: LocalRepresentation,
650 pub usage: Usage,
651 #[serde(skip_serializing_if = "Option::is_none")]
652 #[serde(flatten)]
653 pub other: Option<HashMap<String, Value>>,
654}
655
656#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
659#[serde(rename_all = "camelCase")]
660pub struct MetadataStructure {
661 #[serde(flatten)]
662 pub common: CommonArtefactType,
663 #[serde(skip_serializing_if = "Option::is_none")]
664 pub metadata_structure_components: Option<MetadataStructureComponents>,
665 #[serde(skip_serializing_if = "Option::is_none")]
666 #[serde(flatten)]
667 pub other: Option<HashMap<String, Value>>,
668}
669
670#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
672#[serde(rename_all = "camelCase")]
673pub struct MetadataStructureComponents {
674 #[serde(skip_serializing_if = "Option::is_none")]
675 pub metadata_attribute_list: Option<MetadataAttributeList>,
676 #[serde(skip_serializing_if = "Option::is_none")]
677 #[serde(flatten)]
678 pub other: Option<HashMap<String, Value>>,
679}
680
681#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
684#[serde(rename_all = "camelCase")]
685pub struct MetadataAttributeList {
686 pub id: String,
687 #[serde(skip_serializing_if = "Option::is_none")]
688 pub annotations: Option<Vec<Annotation>>,
689 #[serde(skip_serializing_if = "Option::is_none")]
690 pub links: Option<Vec<Link>>,
691 #[serde(skip_serializing_if = "Option::is_none")]
692 pub metadata_attributes: Option<Vec<MetadataAttribute>>,
693 #[serde(skip_serializing_if = "Option::is_none")]
694 #[serde(flatten)]
695 pub other: Option<HashMap<String, Value>>,
696}
697
698#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
700#[serde(rename_all = "camelCase")]
701pub struct MetadataAttribute {
702 pub id: String,
703 #[serde(skip_serializing_if = "Option::is_none")]
704 pub annotations: Option<Vec<Annotation>>,
705 #[serde(skip_serializing_if = "Option::is_none")]
706 pub links: Option<Vec<Link>>,
707 pub concept_identity: String,
708 #[serde(skip_serializing_if = "Option::is_none")]
709 pub local_representation: Option<MetadataAttributeRepresentation>,
710 pub min_occurs: usize,
711 #[serde(skip_serializing_if = "Option::is_none")]
712 pub max_occurs: Option<Occurrence>,
713 #[serde(skip_serializing_if = "Option::is_none")]
714 pub is_presentational: Option<bool>,
715 #[serde(skip_serializing_if = "Option::is_none")]
716 pub metadata_attributes: Option<Vec<MetadataAttribute>>,
717 #[serde(skip_serializing_if = "Option::is_none")]
718 #[serde(flatten)]
719 pub other: Option<HashMap<String, Value>>,
720}
721
722#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
724pub enum MetadataAttributeRepresentation {
725 Enumeration(MetadataAttributeEnumeration),
726 Format(MetadataAttributeFormat),
727}
728
729#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
731#[serde(rename_all = "camelCase")]
732pub struct MetadataAttributeEnumeration {
733 pub enumeration: String,
734 #[serde(skip_serializing_if = "Option::is_none")]
735 pub enumeration_format: Option<EnumerationFormat>,
736}
737
738#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
740pub struct MetadataAttributeFormat {
741 pub format: Format,
742}
743
744#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
746#[serde(rename_all = "camelCase")]
747pub struct CategoryScheme {
748 #[serde(flatten)]
749 pub artefact: CommonArtefactType,
750 #[serde(skip_serializing_if = "Option::is_none")]
751 pub is_partial: Option<bool>,
752 #[serde(skip_serializing_if = "Option::is_none")]
753 pub categories: Option<Vec<Item>>,
754 #[serde(skip_serializing_if = "Option::is_none")]
755 #[serde(flatten)]
756 pub other: Option<HashMap<String, Value>>,
757}
758
759#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
761#[serde(rename_all = "camelCase")]
762pub struct ConceptScheme {
763 #[serde(flatten)]
764 pub artefact: CommonArtefactType,
765 #[serde(skip_serializing_if = "Option::is_none")]
766 pub is_partial: Option<bool>,
767 #[serde(skip_serializing_if = "Option::is_none")]
768 pub concepts: Option<Vec<Item>>,
769 #[serde(skip_serializing_if = "Option::is_none")]
770 pub core_representation: Option<CoreRepresentation>,
771 #[serde(skip_serializing_if = "Option::is_none")]
772 pub iso_concept_reference: Option<IsoConceptReference>,
773 #[serde(skip_serializing_if = "Option::is_none")]
774 pub parent: Option<String>,
775 #[serde(skip_serializing_if = "Option::is_none")]
776 #[serde(flatten)]
777 pub other: Option<HashMap<String, Value>>,
778}
779
780#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
782#[serde(rename_all = "camelCase")]
783pub struct CoreRepresentation {
784 #[serde(skip_serializing_if = "Option::is_none")]
785 pub enumeration: Option<String>,
786 #[serde(skip_serializing_if = "Option::is_none")]
787 pub enumeration_format: Option<EnumerationFormat>,
788 #[serde(skip_serializing_if = "Option::is_none")]
789 pub format: Option<Format>,
790 #[serde(skip_serializing_if = "Option::is_none")]
791 pub min_occurs: Option<usize>,
792 #[serde(skip_serializing_if = "Option::is_none")]
793 pub max_occurs: Option<Occurrence>,
794 #[serde(skip_serializing_if = "Option::is_none")]
795 #[serde(flatten)]
796 pub other: Option<HashMap<String, Value>>,
797}
798
799#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
801#[serde(rename_all = "camelCase")]
802pub struct IsoConceptReference {
803 pub concept_agency: String,
804 pub concept_id: String,
805 pub concept_scheme_id: String,
806 #[serde(skip_serializing_if = "Option::is_none")]
807 #[serde(flatten)]
808 pub other: Option<HashMap<String, Value>>,
809}
810
811#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
813#[serde(rename_all = "camelCase")]
814pub struct Codelist {
815 #[serde(flatten)]
816 pub artefact: CommonArtefactType,
817 #[serde(skip_serializing_if = "Option::is_none")]
818 pub is_partial: Option<bool>,
819 #[serde(skip_serializing_if = "Option::is_none")]
820 pub codes: Option<Vec<Item>>,
821 #[serde(skip_serializing_if = "Option::is_none")]
822 pub parent: Option<String>,
823 #[serde(skip_serializing_if = "Option::is_none")]
824 #[serde(flatten)]
825 pub other: Option<HashMap<String, Value>>,
826}
827
828#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
830#[serde(rename_all = "camelCase")]
831pub struct GeographyCodelist {
832 #[serde(flatten)]
833 pub artefact: CommonArtefactType,
834 #[serde(skip_serializing_if = "Option::is_none")]
835 pub is_partial: Option<bool>,
836 #[serde(skip_serializing_if = "Option::is_none")]
837 pub geo_feature_set_codes: Option<Vec<Item>>,
838 #[serde(skip_serializing_if = "Option::is_none")]
839 #[serde(flatten)]
840 pub other: Option<HashMap<String, Value>>,
841}
842
843#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
845#[serde(rename_all = "camelCase")]
846pub struct GeoGridCodelist {
847 #[serde(flatten)]
848 pub artefact: CommonArtefactType,
849 #[serde(skip_serializing_if = "Option::is_none")]
850 pub is_partial: Option<bool>,
851 #[serde(skip_serializing_if = "Option::is_none")]
852 pub geo_grid_codes: Option<Vec<Item>>,
853 #[serde(skip_serializing_if = "Option::is_none")]
854 #[serde(flatten)]
855 pub other: Option<HashMap<String, Value>>,
856}
857
858#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
860#[serde(rename_all = "camelCase")]
861pub struct AgencyScheme {
862 #[serde(flatten)]
863 pub artefact: CommonArtefactType,
864 #[serde(skip_serializing_if = "Option::is_none")]
865 pub is_partial: Option<bool>,
866 #[serde(skip_serializing_if = "Option::is_none")]
867 pub agencies: Option<Vec<Item>>,
868 #[serde(skip_serializing_if = "Option::is_none")]
869 #[serde(flatten)]
870 pub other: Option<HashMap<String, Value>>,
871}
872
873#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
875#[serde(rename_all = "camelCase")]
876pub struct DataProviderScheme {
877 #[serde(flatten)]
878 pub artefact: CommonArtefactType,
879 #[serde(skip_serializing_if = "Option::is_none")]
880 pub is_partial: Option<bool>,
881 #[serde(skip_serializing_if = "Option::is_none")]
882 pub data_providers: Option<Vec<Item>>,
883 #[serde(skip_serializing_if = "Option::is_none")]
884 #[serde(flatten)]
885 pub other: Option<HashMap<String, Value>>,
886}
887
888#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
890#[serde(rename_all = "camelCase")]
891pub struct DataConsumerScheme {
892 #[serde(flatten)]
893 pub artefact: CommonArtefactType,
894 #[serde(skip_serializing_if = "Option::is_none")]
895 pub is_partial: Option<bool>,
896 #[serde(skip_serializing_if = "Option::is_none")]
897 pub data_consumers: Option<Vec<Item>>,
898 #[serde(skip_serializing_if = "Option::is_none")]
899 #[serde(flatten)]
900 pub other: Option<HashMap<String, Value>>,
901}
902
903#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
905#[serde(rename_all = "camelCase")]
906pub struct MetadataProviderScheme {
907 #[serde(flatten)]
908 pub artefact: CommonArtefactType,
909 #[serde(skip_serializing_if = "Option::is_none")]
910 pub is_partial: Option<bool>,
911 #[serde(skip_serializing_if = "Option::is_none")]
912 pub metadata_providers: Option<Vec<Item>>,
913 #[serde(skip_serializing_if = "Option::is_none")]
914 #[serde(flatten)]
915 pub other: Option<HashMap<String, Value>>,
916}
917
918#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
920#[serde(rename_all = "camelCase")]
921pub struct OrganizationUnitScheme {
922 #[serde(flatten)]
923 pub artefact: CommonArtefactType,
924 #[serde(skip_serializing_if = "Option::is_none")]
925 pub is_partial: Option<bool>,
926 #[serde(alias = "organisationUnits")]
927 pub organization_units: Option<Vec<Item>>,
928 #[serde(skip_serializing_if = "Option::is_none")]
929 #[serde(flatten)]
930 pub other: Option<HashMap<String, Value>>,
931}
932
933#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
936#[serde(rename_all = "camelCase")]
937pub struct Dataflow {
938 #[serde(flatten)]
939 pub artefact: CommonArtefactType,
940 #[serde(skip_serializing_if = "Option::is_none")]
941 pub structure: Option<String>,
942 #[serde(skip_serializing_if = "Option::is_none")]
943 #[serde(flatten)]
944 pub other: Option<HashMap<String, Value>>,
945}
946
947#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
949#[serde(rename_all = "camelCase")]
950pub struct NamePersonalizationScheme {
951 #[serde(flatten)]
952 pub artefact: CommonArtefactType,
953 #[serde(skip_serializing_if = "Option::is_none")]
954 pub is_partial: Option<bool>,
955 #[serde(alias = "namePersonalisations")]
956 pub name_personalizations: Option<Vec<Item>>,
957 #[serde(skip_serializing_if = "Option::is_none")]
958 #[serde(flatten)]
959 pub other: Option<HashMap<String, Value>>,
960}
961
962#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
964#[serde(rename_all = "camelCase")]
965pub struct ReportingTaxonomy {
966 #[serde(flatten)]
967 pub artefact: CommonArtefactType,
968 #[serde(skip_serializing_if = "Option::is_none")]
969 pub is_partial: Option<bool>,
970 #[serde(skip_serializing_if = "Option::is_none")]
971 pub reporting_categories: Option<Vec<Item>>,
972 #[serde(skip_serializing_if = "Option::is_none")]
973 #[serde(flatten)]
974 pub other: Option<HashMap<String, Value>>,
975}
976
977#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
979#[serde(rename_all = "camelCase")]
980pub struct Categorization {
981 #[serde(flatten)]
982 pub artefact: CommonArtefactType,
983 #[serde(skip_serializing_if = "Option::is_none")]
984 pub source: Option<String>,
985 #[serde(skip_serializing_if = "Option::is_none")]
986 pub target: Option<String>,
987 #[serde(skip_serializing_if = "Option::is_none")]
988 #[serde(flatten)]
989 pub other: Option<HashMap<String, Value>>,
990}
991
992#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
994#[serde(rename_all = "camelCase")]
995pub struct CustomTypeScheme {
996 #[serde(flatten)]
997 pub artefact: CommonArtefactType,
998 #[serde(skip_serializing_if = "Option::is_none")]
999 pub is_partial: Option<bool>,
1000 #[serde(skip_serializing_if = "Option::is_none")]
1001 pub custom_types: Option<Vec<Item>>,
1002 #[serde(skip_serializing_if = "Option::is_none")]
1003 #[serde(flatten)]
1004 pub other: Option<HashMap<String, Value>>,
1005}
1006
1007#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
1010#[serde(rename_all = "camelCase")]
1011pub struct VtlMappingScheme {
1012 #[serde(flatten)]
1013 pub artefact: CommonArtefactType,
1014 #[serde(skip_serializing_if = "Option::is_none")]
1015 pub is_partial: Option<bool>,
1016 #[serde(skip_serializing_if = "Option::is_none")]
1017 pub vtl_mappings: Option<Vec<Item>>,
1018 #[serde(skip_serializing_if = "Option::is_none")]
1019 #[serde(flatten)]
1020 pub other: Option<HashMap<String, Value>>,
1021}
1022
1023#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
1025#[serde(rename_all = "camelCase")]
1026pub struct RulesetScheme {
1027 #[serde(flatten)]
1028 pub artefact: CommonArtefactType,
1029 #[serde(skip_serializing_if = "Option::is_none")]
1030 pub is_partial: Option<bool>,
1031 #[serde(skip_serializing_if = "Option::is_none")]
1032 pub rulesets: Option<Vec<Item>>,
1033 #[serde(skip_serializing_if = "Option::is_none")]
1034 #[serde(flatten)]
1035 pub other: Option<HashMap<String, Value>>,
1036}
1037
1038#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
1040#[serde(rename_all = "camelCase")]
1041pub struct TransformationScheme {
1042 #[serde(flatten)]
1043 pub artefact: CommonArtefactType,
1044 #[serde(skip_serializing_if = "Option::is_none")]
1045 pub is_partial: Option<bool>,
1046 #[serde(skip_serializing_if = "Option::is_none")]
1047 pub transformations: Option<Vec<Item>>,
1048 #[serde(skip_serializing_if = "Option::is_none")]
1049 #[serde(flatten)]
1050 pub other: Option<HashMap<String, Value>>,
1051}
1052
1053#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
1055#[serde(rename_all = "camelCase")]
1056pub struct UserDefinedOperatorsScheme {
1057 #[serde(flatten)]
1058 pub artefact: CommonArtefactType,
1059 #[serde(skip_serializing_if = "Option::is_none")]
1060 pub is_partial: Option<bool>,
1061 #[serde(skip_serializing_if = "Option::is_none")]
1062 pub user_defined_operators: Option<Vec<Item>>,
1063 #[serde(skip_serializing_if = "Option::is_none")]
1064 #[serde(flatten)]
1065 pub other: Option<HashMap<String, Value>>,
1066}
1067
1068impl_extendable!(
1069 StructureMessage,
1070 Data,
1071 Item,
1072 DataStructure,
1073 DataStructureComponents,
1074 AttributeList,
1075 Attribute,
1076 AttributeRelationshipDataflow,
1077 AttributeRelationshipDimensions,
1078 AttributeRelationshipGroups,
1079 AttributeRelationshipObservations,
1080 EnumerationFormat,
1081 Format,
1082 MetadataAttributeUsage,
1083 Dimension,
1084 TimeDimension,
1085 TimeDimensionFormat,
1086 Group,
1087 MeasureList,
1088 Measure,
1089 MetadataStructure,
1090 MetadataAttributeList,
1091 MetadataAttribute,
1092 CategoryScheme,
1093 ConceptScheme,
1094 CoreRepresentation,
1095 IsoConceptReference,
1096 Codelist,
1097 GeographyCodelist,
1098 GeoGridCodelist,
1099 AgencyScheme,
1100 DataProviderScheme,
1101 DataConsumerScheme,
1102 MetadataProviderScheme,
1103 OrganizationUnitScheme,
1104 Dataflow,
1105 NamePersonalizationScheme,
1106 ReportingTaxonomy,
1107 Categorization,
1108 CustomTypeScheme,
1109 VtlMappingScheme,
1110 RulesetScheme,
1111 TransformationScheme,
1112 UserDefinedOperatorsScheme,
1113);
1114
1115impl_artefact! {
1116 CategoryScheme,
1117 ConceptScheme,
1118 Codelist,
1119 GeographyCodelist,
1120 GeoGridCodelist,
1121 AgencyScheme,
1122 DataProviderScheme,
1123 DataConsumerScheme,
1124 MetadataProviderScheme,
1125 OrganizationUnitScheme,
1126 Dataflow,
1127 NamePersonalizationScheme,
1128 ReportingTaxonomy,
1129 Categorization,
1130 CustomTypeScheme,
1131 VtlMappingScheme,
1132 RulesetScheme,
1133 TransformationScheme,
1134 UserDefinedOperatorsScheme,
1135}
1136
1137impl_item_scheme! {
1138 (ConceptScheme, concepts),
1139 (CategoryScheme, categories),
1140 (Codelist, codes),
1141 (GeographyCodelist, geo_feature_set_codes),
1142 (GeoGridCodelist, geo_grid_codes),
1143 (AgencyScheme, agencies),
1144 (DataProviderScheme, data_providers),
1145 (DataConsumerScheme, data_consumers),
1146 (MetadataProviderScheme, metadata_providers),
1147 (OrganizationUnitScheme, organization_units),
1148 (NamePersonalizationScheme, name_personalizations),
1149 (ReportingTaxonomy, reporting_categories),
1150 (CustomTypeScheme, custom_types),
1151 (VtlMappingScheme, vtl_mappings),
1152 (RulesetScheme, rulesets),
1153 (TransformationScheme, transformations),
1154 (UserDefinedOperatorsScheme, user_defined_operators),
1155}