Skip to main content

fhir_types/r6/
terminology_capabilities.rs

1// @generated by fhir-codegen from hl7.fhir.r6.core 6.0.0-ballot5. DO NOT EDIT.
2// Change the emitter (tools/fhir-codegen) and regenerate.
3// SPDX-FileCopyrightText: Cadasto B.V.
4// SPDX-License-Identifier: Apache-2.0
5//! A statement of system capabilities
6
7/// A statement of system capabilities
8///
9/// A TerminologyCapabilities resource documents a set of capabilities
10/// (behaviors) of a FHIR Terminology Server that may be used as a statement of
11/// actual server functionality or a statement of required or desired server
12/// implementation.
13#[derive(Debug, Clone, Default, PartialEq, Eq)]
14pub struct TerminologyCapabilities {
15    /// Logical id of this artifact
16    ///
17    /// The logical id of the resource, as used in the URL for the resource. Once
18    /// assigned, this value never changes.
19    pub id: Option<std::string::String>,
20    /// Metadata about the resource
21    ///
22    /// The metadata about the resource. This is content that is maintained by the
23    /// infrastructure. Changes to the content might not always be associated with
24    /// version changes to the resource.
25    pub meta: Option<super::meta::Meta>,
26    /// A set of rules under which this content was created
27    ///
28    /// A reference to a set of rules that were followed when the resource was
29    /// constructed, and which must be understood when processing the content.
30    /// Often, this is a reference to an implementation guide that defines the
31    /// special rules along with other profiles etc. For DomainResources, if more
32    /// than one implicitRules policy applies, additional policies may be conveyed
33    /// using the
34    /// \[additionalImplicitRules\](<https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-additionalImplicitRules.html>)
35    /// extension.
36    pub implicit_rules: Option<super::primitives::Uri>,
37    /// Language of the resource content
38    ///
39    /// The base language in which the resource is written.
40    pub language: Option<super::primitives::Code>,
41    /// Text summary of the resource, for human interpretation
42    ///
43    /// A human-readable narrative that contains a summary of the resource and can
44    /// be used to represent the content of the resource to a human. The narrative
45    /// need not encode all the structured data, but is required to contain
46    /// sufficient detail to make it "clinically safe" for a human to just read the
47    /// narrative. Resource definitions may define what content should be
48    /// represented in the narrative to ensure clinical safety.
49    pub text: Option<super::narrative::Narrative>,
50    /// Contained, inline Resources
51    ///
52    /// These resources do not have an independent existence apart from the resource
53    /// that contains them - they cannot be identified independently, nor can they
54    /// have their own independent transaction scope. This is allowed to be a
55    /// Parameters resource if and only if it is referenced by a resource that
56    /// provides context/meaning.
57    pub contained: Vec<super::resource::Resource>,
58    /// Additional content defined by implementations
59    ///
60    /// May be used to represent additional information that is not part of the
61    /// basic definition of the resource. To make the use of extensions safe and
62    /// managable, there is a strict set of governance applied to the definition and
63    /// use of extensions. Though any implementer can define an extension, there is
64    /// a set of requirements that SHALL be met as part of the definition of the
65    /// extension.
66    pub extension: Vec<super::extension::Extension>,
67    /// Extensions that cannot be ignored
68    ///
69    /// May be used to represent additional information that is not part of the
70    /// basic definition of the resource and that modifies the understanding of the
71    /// element that contains it and/or the understanding of the containing
72    /// element's descendants. Usually modifier elements provide negation or
73    /// qualification. To make the use of extensions safe and managable, there is a
74    /// strict set of governance applied to the definition and use of extensions.
75    /// Though any implementer is allowed to define an extension, there is a set of
76    /// requirements that SHALL be met as part of the definition of the extension.
77    /// Applications processing a resource are required to check for modifier
78    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
79    /// on Resource or DomainResource (including cannot change the meaning of
80    /// modifierExtension itself).
81    pub modifier_extension: Vec<super::extension::Extension>,
82    /// Canonical identifier for this terminology capabilities, represented as a URI
83    /// (globally unique)
84    ///
85    /// An absolute URI that is used to identify this terminology capabilities when
86    /// it is referenced in a specification, model, design or an instance; also
87    /// called its canonical identifier. This SHOULD be globally unique and SHOULD
88    /// be a literal address at which an authoritative instance of this terminology
89    /// capabilities is (or will be) published. This URL can be the target of a
90    /// canonical reference. It SHALL remain the same when the terminology
91    /// capabilities is stored on different servers.
92    pub url: Option<super::primitives::Uri>,
93    /// Additional identifier for the terminology capabilities
94    ///
95    /// A formal identifier that is used to identify this terminology capabilities
96    /// when it is represented in other formats, or referenced in a specification,
97    /// model, design or an instance.
98    pub identifier: Vec<super::identifier::Identifier>,
99    /// Business version of the terminology capabilities
100    ///
101    /// The identifier that is used to identify this version of the terminology
102    /// capabilities when it is referenced in a specification, model, design or
103    /// instance. This is an arbitrary value managed by the terminology capabilities
104    /// author and is not expected to be globally unique. For example, it might be a
105    /// timestamp (e.g. yyyymmdd) if a managed version is not available. There is
106    /// also no expectation that versions can be placed in a lexicographical
107    /// sequence.
108    pub version: Option<super::primitives::String>,
109    /// How to compare versions
110    ///
111    /// Indicates the mechanism used to compare versions to determine which is more
112    /// current.
113    pub version_algorithm: Option<TerminologyCapabilitiesVersionAlgorithm>,
114    /// Name for this terminology capabilities (computer friendly)
115    ///
116    /// A natural language name identifying the terminology capabilities. This name
117    /// should be usable as an identifier for the module by machine processing
118    /// applications such as code generation.
119    pub name: Option<super::primitives::String>,
120    /// Name for this terminology capabilities (human friendly)
121    ///
122    /// A short, descriptive, user-friendly title for the terminology capabilities.
123    pub title: Option<super::primitives::String>,
124    /// draft | active | retired | unknown
125    ///
126    /// The status of this terminology capabilities. Enables tracking the life-cycle
127    /// of the content.
128    pub status: super::primitives::Code,
129    /// For testing only - never for real usage
130    ///
131    /// A Boolean value to indicate that this terminology capabilities is authored
132    /// for testing purposes (or education/evaluation/marketing) and no version of
133    /// this resource will ever be intended for genuine usage.
134    pub experimental: Option<super::primitives::Boolean>,
135    /// Date last changed
136    ///
137    /// The date (and optionally time) when the terminology capabilities was last
138    /// significantly changed. The date must change when the business version
139    /// changes and it must change if the status code changes. In addition, it
140    /// should change when the substantive content of the terminology capabilities
141    /// changes.
142    pub date: super::primitives::DateTime,
143    /// Name of the publisher/steward (organization or individual)
144    ///
145    /// The name of the organization or individual responsible for the release and
146    /// ongoing maintenance of the terminology capabilities.
147    pub publisher: Option<super::primitives::String>,
148    /// Contact details for the publisher
149    ///
150    /// Contact details to assist a user in finding and communicating with the
151    /// publisher.
152    pub contact: Vec<super::contact_detail::ContactDetail>,
153    /// Natural language description of the terminology capabilities
154    ///
155    /// A free text natural language description of the terminology capabilities
156    /// from a consumer's perspective. Typically, this is used when the capability
157    /// statement describes a desired rather than an actual solution, for example as
158    /// a formal expression of requirements as part of an RFP.
159    pub description: Option<super::primitives::Markdown>,
160    /// The context that the content is intended to support
161    ///
162    /// The content was developed with a focus and intent of supporting the contexts
163    /// that are listed. These contexts may be general categories (gender, age, ...)
164    /// or may be references to specific programs (insurance plans, studies, ...)
165    /// and may be used to assist with indexing and searching for appropriate
166    /// terminology capabilities instances.
167    pub use_context: Vec<super::usage_context::UsageContext>,
168    /// Jurisdiction of the authority that maintains the terminology capabilities
169    /// (if applicable)
170    ///
171    /// A legal or geographic region in which the authority that maintains the
172    /// resource is operating. In general, the jurisdiction is also found in the
173    /// useContext. The useContext may reference additional jurisdictions because
174    /// the defining jurisdiction does not necessarily limit the jurisdictions of
175    /// use.
176    pub jurisdiction: Vec<super::codeable_concept::CodeableConcept>,
177    /// Why this terminology capabilities is defined
178    ///
179    /// Explanation of why this terminology capabilities is needed and why it has
180    /// been designed as it has.
181    pub purpose: Option<super::primitives::Markdown>,
182    /// Notice about intellectual property ownership, can include restrictions on
183    /// use
184    ///
185    /// A copyright statement relating to the terminology capabilities and/or its
186    /// contents. Copyright statements are notices of intellectual property
187    /// ownership and can include restrictions on the use and publishing of the
188    /// terminology capabilities.
189    pub copyright: Option<super::primitives::Markdown>,
190    /// Copyright holder and year(s)
191    ///
192    /// A short string (\<50 characters), suitable for inclusion in a page footer
193    /// that identifies the copyright holder, effective period, and optionally
194    /// whether rights are restricted. (e.g. 'All rights reserved', 'Some rights
195    /// reserved').
196    pub copyright_label: Option<super::primitives::String>,
197    /// instance | capability | requirements
198    ///
199    /// The way that this statement is intended to be used, to describe an actual
200    /// running instance of software, a particular product (kind, not instance of
201    /// software) or a class of implementation (e.g. a desired purchase).
202    pub kind: super::primitives::Code,
203    /// Software that is covered by this terminology capability statement
204    ///
205    /// Software that is covered by this terminology capability statement. It is
206    /// used when the statement describes the capabilities of a particular software
207    /// version, independent of an installation.
208    pub software: Option<TerminologyCapabilitiesSoftware>,
209    /// If this describes a specific instance
210    ///
211    /// Identifies a specific implementation instance that is described by the
212    /// terminology capability statement - i.e. a particular installation, rather
213    /// than the capabilities of a software program.
214    pub implementation: Option<TerminologyCapabilitiesImplementation>,
215    /// Whether lockedDate is supported
216    ///
217    /// Whether the server supports lockedDate.
218    pub locked_date: Option<super::primitives::Boolean>,
219    /// A code system supported by the server
220    ///
221    /// Identifies a code system that is supported by the server. If there is a no
222    /// code system URL, then this declares the general assumptions a client can
223    /// make about support for any CodeSystem resource.
224    pub code_system: Vec<TerminologyCapabilitiesCodeSystem>,
225    /// Supplement Support Information
226    ///
227    /// Information about how the system supports CodeSystem supplements.
228    pub supplements: Option<TerminologyCapabilitiesSupplements>,
229    /// Information about the \[ValueSet/$expand\](valueset-operation-expand.html)
230    /// operation.
231    pub expansion: Option<TerminologyCapabilitiesExpansion>,
232    /// in-compose | in-expansion | in-compose-or-expansion
233    ///
234    /// The degree to which the server supports the code search parameter on
235    /// ValueSet, if it is supported.
236    pub code_search: Option<super::primitives::Code>,
237    /// Information about the
238    /// \[ValueSet/$validate-code\](valueset-operation-validate-code.html)
239    /// operation.
240    pub validate_code: Option<TerminologyCapabilitiesValidateCode>,
241    /// Information about the
242    /// \[ConceptMap/$translate\](conceptmap-operation-translate.html) operation.
243    pub translation: Option<TerminologyCapabilitiesTranslation>,
244}
245
246impl super::super::codec::Json for TerminologyCapabilities {
247    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
248        let mut object = super::super::codec::Object::new();
249        object.insert(
250            std::string::String::from("resourceType"),
251            super::super::codec::Value::String(std::string::String::from(
252                "TerminologyCapabilities",
253            )),
254        );
255        if let Some(v) = &self.id {
256            object.insert(
257                std::string::String::from("id"),
258                super::super::codec::Value::String(v.clone()),
259            );
260        }
261        if let Some(item) = &self.meta {
262            object.insert(
263                std::string::String::from("meta"),
264                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
265            );
266        }
267        if let Some(item) = &self.implicit_rules {
268            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
269                object.insert(std::string::String::from("implicitRules"), v);
270            }
271            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
272                object.insert(std::string::String::from("_implicitRules"), e);
273            }
274        }
275        if let Some(item) = &self.language {
276            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
277                object.insert(std::string::String::from("language"), v);
278            }
279            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
280                object.insert(std::string::String::from("_language"), e);
281            }
282        }
283        if let Some(item) = &self.text {
284            object.insert(
285                std::string::String::from("text"),
286                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
287            );
288        }
289        if !self.contained.is_empty() {
290            let mut items = Vec::with_capacity(self.contained.len());
291            for item in &self.contained {
292                items.push(super::super::codec::Value::Object(
293                    super::super::codec::Json::to_json(item)?,
294                ));
295            }
296            object.insert(
297                std::string::String::from("contained"),
298                super::super::codec::Value::Array(items),
299            );
300        }
301        if !self.extension.is_empty() {
302            let mut items = Vec::with_capacity(self.extension.len());
303            for item in &self.extension {
304                items.push(super::super::codec::Value::Object(
305                    super::super::codec::Json::to_json(item)?,
306                ));
307            }
308            object.insert(
309                std::string::String::from("extension"),
310                super::super::codec::Value::Array(items),
311            );
312        }
313        if !self.modifier_extension.is_empty() {
314            let mut items = Vec::with_capacity(self.modifier_extension.len());
315            for item in &self.modifier_extension {
316                items.push(super::super::codec::Value::Object(
317                    super::super::codec::Json::to_json(item)?,
318                ));
319            }
320            object.insert(
321                std::string::String::from("modifierExtension"),
322                super::super::codec::Value::Array(items),
323            );
324        }
325        if let Some(item) = &self.url {
326            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
327                object.insert(std::string::String::from("url"), v);
328            }
329            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
330                object.insert(std::string::String::from("_url"), e);
331            }
332        }
333        if !self.identifier.is_empty() {
334            let mut items = Vec::with_capacity(self.identifier.len());
335            for item in &self.identifier {
336                items.push(super::super::codec::Value::Object(
337                    super::super::codec::Json::to_json(item)?,
338                ));
339            }
340            object.insert(
341                std::string::String::from("identifier"),
342                super::super::codec::Value::Array(items),
343            );
344        }
345        if let Some(item) = &self.version {
346            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
347                object.insert(std::string::String::from("version"), v);
348            }
349            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
350                object.insert(std::string::String::from("_version"), e);
351            }
352        }
353        if let Some(item) = &self.version_algorithm {
354            let (suffix, value, element) = item.to_json_parts()?;
355            if let Some(value) = value {
356                object.insert(format!("versionAlgorithm{suffix}"), value);
357            }
358            if let Some(element) = element {
359                object.insert(format!("_versionAlgorithm{suffix}"), element);
360            }
361        }
362        if let Some(item) = &self.name {
363            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
364                object.insert(std::string::String::from("name"), v);
365            }
366            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
367                object.insert(std::string::String::from("_name"), e);
368            }
369        }
370        if let Some(item) = &self.title {
371            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
372                object.insert(std::string::String::from("title"), v);
373            }
374            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
375                object.insert(std::string::String::from("_title"), e);
376            }
377        }
378        if let Some(v) = super::super::codec::Primitive::value_json(&self.status)? {
379            object.insert(std::string::String::from("status"), v);
380        }
381        if let Some(e) = super::super::codec::Primitive::element_json(&self.status)? {
382            object.insert(std::string::String::from("_status"), e);
383        }
384        if let Some(item) = &self.experimental {
385            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
386                object.insert(std::string::String::from("experimental"), v);
387            }
388            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
389                object.insert(std::string::String::from("_experimental"), e);
390            }
391        }
392        if let Some(v) = super::super::codec::Primitive::value_json(&self.date)? {
393            object.insert(std::string::String::from("date"), v);
394        }
395        if let Some(e) = super::super::codec::Primitive::element_json(&self.date)? {
396            object.insert(std::string::String::from("_date"), e);
397        }
398        if let Some(item) = &self.publisher {
399            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
400                object.insert(std::string::String::from("publisher"), v);
401            }
402            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
403                object.insert(std::string::String::from("_publisher"), e);
404            }
405        }
406        if !self.contact.is_empty() {
407            let mut items = Vec::with_capacity(self.contact.len());
408            for item in &self.contact {
409                items.push(super::super::codec::Value::Object(
410                    super::super::codec::Json::to_json(item)?,
411                ));
412            }
413            object.insert(
414                std::string::String::from("contact"),
415                super::super::codec::Value::Array(items),
416            );
417        }
418        if let Some(item) = &self.description {
419            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
420                object.insert(std::string::String::from("description"), v);
421            }
422            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
423                object.insert(std::string::String::from("_description"), e);
424            }
425        }
426        if !self.use_context.is_empty() {
427            let mut items = Vec::with_capacity(self.use_context.len());
428            for item in &self.use_context {
429                items.push(super::super::codec::Value::Object(
430                    super::super::codec::Json::to_json(item)?,
431                ));
432            }
433            object.insert(
434                std::string::String::from("useContext"),
435                super::super::codec::Value::Array(items),
436            );
437        }
438        if !self.jurisdiction.is_empty() {
439            let mut items = Vec::with_capacity(self.jurisdiction.len());
440            for item in &self.jurisdiction {
441                items.push(super::super::codec::Value::Object(
442                    super::super::codec::Json::to_json(item)?,
443                ));
444            }
445            object.insert(
446                std::string::String::from("jurisdiction"),
447                super::super::codec::Value::Array(items),
448            );
449        }
450        if let Some(item) = &self.purpose {
451            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
452                object.insert(std::string::String::from("purpose"), v);
453            }
454            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
455                object.insert(std::string::String::from("_purpose"), e);
456            }
457        }
458        if let Some(item) = &self.copyright {
459            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
460                object.insert(std::string::String::from("copyright"), v);
461            }
462            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
463                object.insert(std::string::String::from("_copyright"), e);
464            }
465        }
466        if let Some(item) = &self.copyright_label {
467            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
468                object.insert(std::string::String::from("copyrightLabel"), v);
469            }
470            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
471                object.insert(std::string::String::from("_copyrightLabel"), e);
472            }
473        }
474        if let Some(v) = super::super::codec::Primitive::value_json(&self.kind)? {
475            object.insert(std::string::String::from("kind"), v);
476        }
477        if let Some(e) = super::super::codec::Primitive::element_json(&self.kind)? {
478            object.insert(std::string::String::from("_kind"), e);
479        }
480        if let Some(item) = &self.software {
481            object.insert(
482                std::string::String::from("software"),
483                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
484            );
485        }
486        if let Some(item) = &self.implementation {
487            object.insert(
488                std::string::String::from("implementation"),
489                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
490            );
491        }
492        if let Some(item) = &self.locked_date {
493            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
494                object.insert(std::string::String::from("lockedDate"), v);
495            }
496            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
497                object.insert(std::string::String::from("_lockedDate"), e);
498            }
499        }
500        if !self.code_system.is_empty() {
501            let mut items = Vec::with_capacity(self.code_system.len());
502            for item in &self.code_system {
503                items.push(super::super::codec::Value::Object(
504                    super::super::codec::Json::to_json(item)?,
505                ));
506            }
507            object.insert(
508                std::string::String::from("codeSystem"),
509                super::super::codec::Value::Array(items),
510            );
511        }
512        if let Some(item) = &self.supplements {
513            object.insert(
514                std::string::String::from("supplements"),
515                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
516            );
517        }
518        if let Some(item) = &self.expansion {
519            object.insert(
520                std::string::String::from("expansion"),
521                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
522            );
523        }
524        if let Some(item) = &self.code_search {
525            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
526                object.insert(std::string::String::from("codeSearch"), v);
527            }
528            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
529                object.insert(std::string::String::from("_codeSearch"), e);
530            }
531        }
532        if let Some(item) = &self.validate_code {
533            object.insert(
534                std::string::String::from("validateCode"),
535                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
536            );
537        }
538        if let Some(item) = &self.translation {
539            object.insert(
540                std::string::String::from("translation"),
541                super::super::codec::Value::Object(super::super::codec::Json::to_json(item)?),
542            );
543        }
544        Ok(object)
545    }
546
547    fn from_json(
548        object: &super::super::codec::Object,
549        path: &mut super::super::codec::Path,
550    ) -> Result<Self, super::super::codec::DecodeError> {
551        let mut raw_id: Option<&super::super::codec::Value> = None;
552        let mut raw_meta: Option<&super::super::codec::Value> = None;
553        let mut raw_implicit_rules: Option<&super::super::codec::Value> = None;
554        let mut raw_implicit_rules_element: Option<&super::super::codec::Value> = None;
555        let mut raw_language: Option<&super::super::codec::Value> = None;
556        let mut raw_language_element: Option<&super::super::codec::Value> = None;
557        let mut raw_text: Option<&super::super::codec::Value> = None;
558        let mut raw_contained: Option<&super::super::codec::Value> = None;
559        let mut raw_extension: Option<&super::super::codec::Value> = None;
560        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
561        let mut raw_url: Option<&super::super::codec::Value> = None;
562        let mut raw_url_element: Option<&super::super::codec::Value> = None;
563        let mut raw_identifier: Option<&super::super::codec::Value> = None;
564        let mut raw_version: Option<&super::super::codec::Value> = None;
565        let mut raw_version_element: Option<&super::super::codec::Value> = None;
566        let mut raw_version_algorithm = super::super::codec::ChoiceSlot::default();
567        let mut raw_name: Option<&super::super::codec::Value> = None;
568        let mut raw_name_element: Option<&super::super::codec::Value> = None;
569        let mut raw_title: Option<&super::super::codec::Value> = None;
570        let mut raw_title_element: Option<&super::super::codec::Value> = None;
571        let mut raw_status: Option<&super::super::codec::Value> = None;
572        let mut raw_status_element: Option<&super::super::codec::Value> = None;
573        let mut raw_experimental: Option<&super::super::codec::Value> = None;
574        let mut raw_experimental_element: Option<&super::super::codec::Value> = None;
575        let mut raw_date: Option<&super::super::codec::Value> = None;
576        let mut raw_date_element: Option<&super::super::codec::Value> = None;
577        let mut raw_publisher: Option<&super::super::codec::Value> = None;
578        let mut raw_publisher_element: Option<&super::super::codec::Value> = None;
579        let mut raw_contact: Option<&super::super::codec::Value> = None;
580        let mut raw_description: Option<&super::super::codec::Value> = None;
581        let mut raw_description_element: Option<&super::super::codec::Value> = None;
582        let mut raw_use_context: Option<&super::super::codec::Value> = None;
583        let mut raw_jurisdiction: Option<&super::super::codec::Value> = None;
584        let mut raw_purpose: Option<&super::super::codec::Value> = None;
585        let mut raw_purpose_element: Option<&super::super::codec::Value> = None;
586        let mut raw_copyright: Option<&super::super::codec::Value> = None;
587        let mut raw_copyright_element: Option<&super::super::codec::Value> = None;
588        let mut raw_copyright_label: Option<&super::super::codec::Value> = None;
589        let mut raw_copyright_label_element: Option<&super::super::codec::Value> = None;
590        let mut raw_kind: Option<&super::super::codec::Value> = None;
591        let mut raw_kind_element: Option<&super::super::codec::Value> = None;
592        let mut raw_software: Option<&super::super::codec::Value> = None;
593        let mut raw_implementation: Option<&super::super::codec::Value> = None;
594        let mut raw_locked_date: Option<&super::super::codec::Value> = None;
595        let mut raw_locked_date_element: Option<&super::super::codec::Value> = None;
596        let mut raw_code_system: Option<&super::super::codec::Value> = None;
597        let mut raw_supplements: Option<&super::super::codec::Value> = None;
598        let mut raw_expansion: Option<&super::super::codec::Value> = None;
599        let mut raw_code_search: Option<&super::super::codec::Value> = None;
600        let mut raw_code_search_element: Option<&super::super::codec::Value> = None;
601        let mut raw_validate_code: Option<&super::super::codec::Value> = None;
602        let mut raw_translation: Option<&super::super::codec::Value> = None;
603        for (key, value) in object {
604            match key.as_str() {
605                "resourceType" => {
606                    if value.as_str() != Some("TerminologyCapabilities") {
607                        return Err(path.error(super::super::codec::DecodeErrorKind::ResourceType));
608                    }
609                }
610                "id" => {
611                    raw_id = Some(value);
612                }
613                "meta" => {
614                    raw_meta = Some(value);
615                }
616                "implicitRules" => {
617                    raw_implicit_rules = Some(value);
618                }
619                "_implicitRules" => {
620                    raw_implicit_rules_element = Some(value);
621                }
622                "language" => {
623                    raw_language = Some(value);
624                }
625                "_language" => {
626                    raw_language_element = Some(value);
627                }
628                "text" => {
629                    raw_text = Some(value);
630                }
631                "contained" => {
632                    raw_contained = Some(value);
633                }
634                "extension" => {
635                    raw_extension = Some(value);
636                }
637                "modifierExtension" => {
638                    raw_modifier_extension = Some(value);
639                }
640                "url" => {
641                    raw_url = Some(value);
642                }
643                "_url" => {
644                    raw_url_element = Some(value);
645                }
646                "identifier" => {
647                    raw_identifier = Some(value);
648                }
649                "version" => {
650                    raw_version = Some(value);
651                }
652                "_version" => {
653                    raw_version_element = Some(value);
654                }
655                "versionAlgorithmString" => {
656                    raw_version_algorithm.value("String", value, path)?;
657                }
658                "_versionAlgorithmString" => {
659                    raw_version_algorithm.element("String", value, path)?;
660                }
661                "versionAlgorithmCoding" => {
662                    raw_version_algorithm.value("Coding", value, path)?;
663                }
664                "_versionAlgorithmCoding" => {
665                    raw_version_algorithm.element("Coding", value, path)?;
666                }
667                "name" => {
668                    raw_name = Some(value);
669                }
670                "_name" => {
671                    raw_name_element = Some(value);
672                }
673                "title" => {
674                    raw_title = Some(value);
675                }
676                "_title" => {
677                    raw_title_element = Some(value);
678                }
679                "status" => {
680                    raw_status = Some(value);
681                }
682                "_status" => {
683                    raw_status_element = Some(value);
684                }
685                "experimental" => {
686                    raw_experimental = Some(value);
687                }
688                "_experimental" => {
689                    raw_experimental_element = Some(value);
690                }
691                "date" => {
692                    raw_date = Some(value);
693                }
694                "_date" => {
695                    raw_date_element = Some(value);
696                }
697                "publisher" => {
698                    raw_publisher = Some(value);
699                }
700                "_publisher" => {
701                    raw_publisher_element = Some(value);
702                }
703                "contact" => {
704                    raw_contact = Some(value);
705                }
706                "description" => {
707                    raw_description = Some(value);
708                }
709                "_description" => {
710                    raw_description_element = Some(value);
711                }
712                "useContext" => {
713                    raw_use_context = Some(value);
714                }
715                "jurisdiction" => {
716                    raw_jurisdiction = Some(value);
717                }
718                "purpose" => {
719                    raw_purpose = Some(value);
720                }
721                "_purpose" => {
722                    raw_purpose_element = Some(value);
723                }
724                "copyright" => {
725                    raw_copyright = Some(value);
726                }
727                "_copyright" => {
728                    raw_copyright_element = Some(value);
729                }
730                "copyrightLabel" => {
731                    raw_copyright_label = Some(value);
732                }
733                "_copyrightLabel" => {
734                    raw_copyright_label_element = Some(value);
735                }
736                "kind" => {
737                    raw_kind = Some(value);
738                }
739                "_kind" => {
740                    raw_kind_element = Some(value);
741                }
742                "software" => {
743                    raw_software = Some(value);
744                }
745                "implementation" => {
746                    raw_implementation = Some(value);
747                }
748                "lockedDate" => {
749                    raw_locked_date = Some(value);
750                }
751                "_lockedDate" => {
752                    raw_locked_date_element = Some(value);
753                }
754                "codeSystem" => {
755                    raw_code_system = Some(value);
756                }
757                "supplements" => {
758                    raw_supplements = Some(value);
759                }
760                "expansion" => {
761                    raw_expansion = Some(value);
762                }
763                "codeSearch" => {
764                    raw_code_search = Some(value);
765                }
766                "_codeSearch" => {
767                    raw_code_search_element = Some(value);
768                }
769                "validateCode" => {
770                    raw_validate_code = Some(value);
771                }
772                "translation" => {
773                    raw_translation = Some(value);
774                }
775                other => {
776                    return path.with(other, |path| {
777                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
778                    });
779                }
780            }
781        }
782        let field_id = raw_id
783            .map(|value| {
784                path.with("id", |path| {
785                    let value = super::super::codec::expect_single(value, path)?;
786                    super::primitives::checked_id(
787                        super::super::codec::expect_string(value, path)?,
788                        path,
789                    )
790                })
791            })
792            .transpose()?;
793        let field_meta = raw_meta
794            .map(|value| {
795                path.with("meta", |path| {
796                    super::super::codec::Json::from_json(
797                        super::super::codec::expect_object(
798                            super::super::codec::expect_single(value, path)?,
799                            path,
800                        )?,
801                        path,
802                    )
803                })
804            })
805            .transpose()?;
806        let field_implicit_rules = match (raw_implicit_rules, raw_implicit_rules_element) {
807            (None, None) => None,
808            (value, element) => Some(path.with("implicitRules", |path| {
809                super::super::codec::Primitive::from_json_parts(value, element, path)
810            })?),
811        };
812        let field_language = match (raw_language, raw_language_element) {
813            (None, None) => None,
814            (value, element) => Some(path.with("language", |path| {
815                super::super::codec::Primitive::from_json_parts(value, element, path)
816            })?),
817        };
818        let field_text = raw_text
819            .map(|value| {
820                path.with("text", |path| {
821                    super::super::codec::Json::from_json(
822                        super::super::codec::expect_object(
823                            super::super::codec::expect_single(value, path)?,
824                            path,
825                        )?,
826                        path,
827                    )
828                })
829            })
830            .transpose()?;
831        let mut field_contained = Vec::new();
832        if let Some(raw) = raw_contained {
833            for (index, value) in path
834                .with("contained", |path| {
835                    super::super::codec::expect_array(raw, path)
836                })?
837                .iter()
838                .enumerate()
839            {
840                field_contained.push(path.with_index("contained", index, |path| {
841                    super::super::codec::Json::from_json(
842                        super::super::codec::expect_object(value, path)?,
843                        path,
844                    )
845                })?);
846            }
847        }
848        let mut field_extension = Vec::new();
849        if let Some(raw) = raw_extension {
850            for (index, value) in path
851                .with("extension", |path| {
852                    super::super::codec::expect_array(raw, path)
853                })?
854                .iter()
855                .enumerate()
856            {
857                field_extension.push(path.with_index("extension", index, |path| {
858                    super::super::codec::Json::from_json(
859                        super::super::codec::expect_object(value, path)?,
860                        path,
861                    )
862                })?);
863            }
864        }
865        let mut field_modifier_extension = Vec::new();
866        if let Some(raw) = raw_modifier_extension {
867            for (index, value) in path
868                .with("modifierExtension", |path| {
869                    super::super::codec::expect_array(raw, path)
870                })?
871                .iter()
872                .enumerate()
873            {
874                field_modifier_extension.push(path.with_index(
875                    "modifierExtension",
876                    index,
877                    |path| {
878                        super::super::codec::Json::from_json(
879                            super::super::codec::expect_object(value, path)?,
880                            path,
881                        )
882                    },
883                )?);
884            }
885        }
886        let field_url = match (raw_url, raw_url_element) {
887            (None, None) => None,
888            (value, element) => Some(path.with("url", |path| {
889                super::super::codec::Primitive::from_json_parts(value, element, path)
890            })?),
891        };
892        let mut field_identifier = Vec::new();
893        if let Some(raw) = raw_identifier {
894            for (index, value) in path
895                .with("identifier", |path| {
896                    super::super::codec::expect_array(raw, path)
897                })?
898                .iter()
899                .enumerate()
900            {
901                field_identifier.push(path.with_index("identifier", index, |path| {
902                    super::super::codec::Json::from_json(
903                        super::super::codec::expect_object(value, path)?,
904                        path,
905                    )
906                })?);
907            }
908        }
909        let field_version = match (raw_version, raw_version_element) {
910            (None, None) => None,
911            (value, element) => Some(path.with("version", |path| {
912                super::super::codec::Primitive::from_json_parts(value, element, path)
913            })?),
914        };
915        let field_version_algorithm = match raw_version_algorithm.suffix {
916            None => None,
917            Some(suffix) => Some(path.with("versionAlgorithm", |path| {
918                TerminologyCapabilitiesVersionAlgorithm::from_json_parts(
919                    suffix,
920                    raw_version_algorithm.value,
921                    raw_version_algorithm.element,
922                    path,
923                )
924            })?),
925        };
926        let field_name = match (raw_name, raw_name_element) {
927            (None, None) => None,
928            (value, element) => Some(path.with("name", |path| {
929                super::super::codec::Primitive::from_json_parts(value, element, path)
930            })?),
931        };
932        let field_title = match (raw_title, raw_title_element) {
933            (None, None) => None,
934            (value, element) => Some(path.with("title", |path| {
935                super::super::codec::Primitive::from_json_parts(value, element, path)
936            })?),
937        };
938        let field_status = path.with("status", |path| {
939            super::super::codec::Primitive::from_json_parts(raw_status, raw_status_element, path)
940        })?;
941        let field_experimental = match (raw_experimental, raw_experimental_element) {
942            (None, None) => None,
943            (value, element) => Some(path.with("experimental", |path| {
944                super::super::codec::Primitive::from_json_parts(value, element, path)
945            })?),
946        };
947        let field_date = path.with("date", |path| {
948            super::super::codec::Primitive::from_json_parts(raw_date, raw_date_element, path)
949        })?;
950        let field_publisher = match (raw_publisher, raw_publisher_element) {
951            (None, None) => None,
952            (value, element) => Some(path.with("publisher", |path| {
953                super::super::codec::Primitive::from_json_parts(value, element, path)
954            })?),
955        };
956        let mut field_contact = Vec::new();
957        if let Some(raw) = raw_contact {
958            for (index, value) in path
959                .with("contact", |path| {
960                    super::super::codec::expect_array(raw, path)
961                })?
962                .iter()
963                .enumerate()
964            {
965                field_contact.push(path.with_index("contact", index, |path| {
966                    super::super::codec::Json::from_json(
967                        super::super::codec::expect_object(value, path)?,
968                        path,
969                    )
970                })?);
971            }
972        }
973        let field_description = match (raw_description, raw_description_element) {
974            (None, None) => None,
975            (value, element) => Some(path.with("description", |path| {
976                super::super::codec::Primitive::from_json_parts(value, element, path)
977            })?),
978        };
979        let mut field_use_context = Vec::new();
980        if let Some(raw) = raw_use_context {
981            for (index, value) in path
982                .with("useContext", |path| {
983                    super::super::codec::expect_array(raw, path)
984                })?
985                .iter()
986                .enumerate()
987            {
988                field_use_context.push(path.with_index("useContext", index, |path| {
989                    super::super::codec::Json::from_json(
990                        super::super::codec::expect_object(value, path)?,
991                        path,
992                    )
993                })?);
994            }
995        }
996        let mut field_jurisdiction = Vec::new();
997        if let Some(raw) = raw_jurisdiction {
998            for (index, value) in path
999                .with("jurisdiction", |path| {
1000                    super::super::codec::expect_array(raw, path)
1001                })?
1002                .iter()
1003                .enumerate()
1004            {
1005                field_jurisdiction.push(path.with_index("jurisdiction", index, |path| {
1006                    super::super::codec::Json::from_json(
1007                        super::super::codec::expect_object(value, path)?,
1008                        path,
1009                    )
1010                })?);
1011            }
1012        }
1013        let field_purpose = match (raw_purpose, raw_purpose_element) {
1014            (None, None) => None,
1015            (value, element) => Some(path.with("purpose", |path| {
1016                super::super::codec::Primitive::from_json_parts(value, element, path)
1017            })?),
1018        };
1019        let field_copyright = match (raw_copyright, raw_copyright_element) {
1020            (None, None) => None,
1021            (value, element) => Some(path.with("copyright", |path| {
1022                super::super::codec::Primitive::from_json_parts(value, element, path)
1023            })?),
1024        };
1025        let field_copyright_label = match (raw_copyright_label, raw_copyright_label_element) {
1026            (None, None) => None,
1027            (value, element) => Some(path.with("copyrightLabel", |path| {
1028                super::super::codec::Primitive::from_json_parts(value, element, path)
1029            })?),
1030        };
1031        let field_kind = path.with("kind", |path| {
1032            super::super::codec::Primitive::from_json_parts(raw_kind, raw_kind_element, path)
1033        })?;
1034        let field_software = raw_software
1035            .map(|value| {
1036                path.with("software", |path| {
1037                    super::super::codec::Json::from_json(
1038                        super::super::codec::expect_object(
1039                            super::super::codec::expect_single(value, path)?,
1040                            path,
1041                        )?,
1042                        path,
1043                    )
1044                })
1045            })
1046            .transpose()?;
1047        let field_implementation = raw_implementation
1048            .map(|value| {
1049                path.with("implementation", |path| {
1050                    super::super::codec::Json::from_json(
1051                        super::super::codec::expect_object(
1052                            super::super::codec::expect_single(value, path)?,
1053                            path,
1054                        )?,
1055                        path,
1056                    )
1057                })
1058            })
1059            .transpose()?;
1060        let field_locked_date = match (raw_locked_date, raw_locked_date_element) {
1061            (None, None) => None,
1062            (value, element) => Some(path.with("lockedDate", |path| {
1063                super::super::codec::Primitive::from_json_parts(value, element, path)
1064            })?),
1065        };
1066        let mut field_code_system = Vec::new();
1067        if let Some(raw) = raw_code_system {
1068            for (index, value) in path
1069                .with("codeSystem", |path| {
1070                    super::super::codec::expect_array(raw, path)
1071                })?
1072                .iter()
1073                .enumerate()
1074            {
1075                field_code_system.push(path.with_index("codeSystem", index, |path| {
1076                    super::super::codec::Json::from_json(
1077                        super::super::codec::expect_object(value, path)?,
1078                        path,
1079                    )
1080                })?);
1081            }
1082        }
1083        let field_supplements = raw_supplements
1084            .map(|value| {
1085                path.with("supplements", |path| {
1086                    super::super::codec::Json::from_json(
1087                        super::super::codec::expect_object(
1088                            super::super::codec::expect_single(value, path)?,
1089                            path,
1090                        )?,
1091                        path,
1092                    )
1093                })
1094            })
1095            .transpose()?;
1096        let field_expansion = raw_expansion
1097            .map(|value| {
1098                path.with("expansion", |path| {
1099                    super::super::codec::Json::from_json(
1100                        super::super::codec::expect_object(
1101                            super::super::codec::expect_single(value, path)?,
1102                            path,
1103                        )?,
1104                        path,
1105                    )
1106                })
1107            })
1108            .transpose()?;
1109        let field_code_search = match (raw_code_search, raw_code_search_element) {
1110            (None, None) => None,
1111            (value, element) => Some(path.with("codeSearch", |path| {
1112                super::super::codec::Primitive::from_json_parts(value, element, path)
1113            })?),
1114        };
1115        let field_validate_code = raw_validate_code
1116            .map(|value| {
1117                path.with("validateCode", |path| {
1118                    super::super::codec::Json::from_json(
1119                        super::super::codec::expect_object(
1120                            super::super::codec::expect_single(value, path)?,
1121                            path,
1122                        )?,
1123                        path,
1124                    )
1125                })
1126            })
1127            .transpose()?;
1128        let field_translation = raw_translation
1129            .map(|value| {
1130                path.with("translation", |path| {
1131                    super::super::codec::Json::from_json(
1132                        super::super::codec::expect_object(
1133                            super::super::codec::expect_single(value, path)?,
1134                            path,
1135                        )?,
1136                        path,
1137                    )
1138                })
1139            })
1140            .transpose()?;
1141        Ok(Self {
1142            id: field_id,
1143            meta: field_meta,
1144            implicit_rules: field_implicit_rules,
1145            language: field_language,
1146            text: field_text,
1147            contained: field_contained,
1148            extension: field_extension,
1149            modifier_extension: field_modifier_extension,
1150            url: field_url,
1151            identifier: field_identifier,
1152            version: field_version,
1153            version_algorithm: field_version_algorithm,
1154            name: field_name,
1155            title: field_title,
1156            status: field_status,
1157            experimental: field_experimental,
1158            date: field_date,
1159            publisher: field_publisher,
1160            contact: field_contact,
1161            description: field_description,
1162            use_context: field_use_context,
1163            jurisdiction: field_jurisdiction,
1164            purpose: field_purpose,
1165            copyright: field_copyright,
1166            copyright_label: field_copyright_label,
1167            kind: field_kind,
1168            software: field_software,
1169            implementation: field_implementation,
1170            locked_date: field_locked_date,
1171            code_system: field_code_system,
1172            supplements: field_supplements,
1173            expansion: field_expansion,
1174            code_search: field_code_search,
1175            validate_code: field_validate_code,
1176            translation: field_translation,
1177        })
1178    }
1179}
1180
1181impl serde::Serialize for TerminologyCapabilities {
1182    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1183        let mut map = serde::Serializer::serialize_map(serializer, None)?;
1184        if let Some(item) = &self.code_search {
1185            super::super::codec::element_entry(&mut map, "_codeSearch", item)?;
1186        }
1187        if let Some(item) = &self.copyright {
1188            super::super::codec::element_entry(&mut map, "_copyright", item)?;
1189        }
1190        if let Some(item) = &self.copyright_label {
1191            super::super::codec::element_entry(&mut map, "_copyrightLabel", item)?;
1192        }
1193        super::super::codec::element_entry(&mut map, "_date", &self.date)?;
1194        if let Some(item) = &self.description {
1195            super::super::codec::element_entry(&mut map, "_description", item)?;
1196        }
1197        if let Some(item) = &self.experimental {
1198            super::super::codec::element_entry(&mut map, "_experimental", item)?;
1199        }
1200        if let Some(item) = &self.implicit_rules {
1201            super::super::codec::element_entry(&mut map, "_implicitRules", item)?;
1202        }
1203        super::super::codec::element_entry(&mut map, "_kind", &self.kind)?;
1204        if let Some(item) = &self.language {
1205            super::super::codec::element_entry(&mut map, "_language", item)?;
1206        }
1207        if let Some(item) = &self.locked_date {
1208            super::super::codec::element_entry(&mut map, "_lockedDate", item)?;
1209        }
1210        if let Some(item) = &self.name {
1211            super::super::codec::element_entry(&mut map, "_name", item)?;
1212        }
1213        if let Some(item) = &self.publisher {
1214            super::super::codec::element_entry(&mut map, "_publisher", item)?;
1215        }
1216        if let Some(item) = &self.purpose {
1217            super::super::codec::element_entry(&mut map, "_purpose", item)?;
1218        }
1219        super::super::codec::element_entry(&mut map, "_status", &self.status)?;
1220        if let Some(item) = &self.title {
1221            super::super::codec::element_entry(&mut map, "_title", item)?;
1222        }
1223        if let Some(item) = &self.url {
1224            super::super::codec::element_entry(&mut map, "_url", item)?;
1225        }
1226        if let Some(item) = &self.version {
1227            super::super::codec::element_entry(&mut map, "_version", item)?;
1228        }
1229        if let Some(TerminologyCapabilitiesVersionAlgorithm::String(inner)) =
1230            &self.version_algorithm
1231        {
1232            super::super::codec::element_entry(&mut map, "_versionAlgorithmString", inner)?;
1233        }
1234        if let Some(item) = &self.code_search {
1235            super::super::codec::value_entry(&mut map, "codeSearch", item)?;
1236        }
1237        if !self.code_system.is_empty() {
1238            serde::ser::SerializeMap::serialize_entry(&mut map, "codeSystem", &self.code_system)?;
1239        }
1240        if !self.contact.is_empty() {
1241            serde::ser::SerializeMap::serialize_entry(&mut map, "contact", &self.contact)?;
1242        }
1243        if !self.contained.is_empty() {
1244            serde::ser::SerializeMap::serialize_entry(&mut map, "contained", &self.contained)?;
1245        }
1246        if let Some(item) = &self.copyright {
1247            super::super::codec::value_entry(&mut map, "copyright", item)?;
1248        }
1249        if let Some(item) = &self.copyright_label {
1250            super::super::codec::value_entry(&mut map, "copyrightLabel", item)?;
1251        }
1252        super::super::codec::value_entry(&mut map, "date", &self.date)?;
1253        if let Some(item) = &self.description {
1254            super::super::codec::value_entry(&mut map, "description", item)?;
1255        }
1256        if let Some(item) = &self.expansion {
1257            serde::ser::SerializeMap::serialize_entry(&mut map, "expansion", item)?;
1258        }
1259        if let Some(item) = &self.experimental {
1260            super::super::codec::value_entry(&mut map, "experimental", item)?;
1261        }
1262        if !self.extension.is_empty() {
1263            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
1264        }
1265        if let Some(v) = &self.id {
1266            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
1267        }
1268        if !self.identifier.is_empty() {
1269            serde::ser::SerializeMap::serialize_entry(&mut map, "identifier", &self.identifier)?;
1270        }
1271        if let Some(item) = &self.implementation {
1272            serde::ser::SerializeMap::serialize_entry(&mut map, "implementation", item)?;
1273        }
1274        if let Some(item) = &self.implicit_rules {
1275            super::super::codec::value_entry(&mut map, "implicitRules", item)?;
1276        }
1277        if !self.jurisdiction.is_empty() {
1278            serde::ser::SerializeMap::serialize_entry(
1279                &mut map,
1280                "jurisdiction",
1281                &self.jurisdiction,
1282            )?;
1283        }
1284        super::super::codec::value_entry(&mut map, "kind", &self.kind)?;
1285        if let Some(item) = &self.language {
1286            super::super::codec::value_entry(&mut map, "language", item)?;
1287        }
1288        if let Some(item) = &self.locked_date {
1289            super::super::codec::value_entry(&mut map, "lockedDate", item)?;
1290        }
1291        if let Some(item) = &self.meta {
1292            serde::ser::SerializeMap::serialize_entry(&mut map, "meta", item)?;
1293        }
1294        if !self.modifier_extension.is_empty() {
1295            serde::ser::SerializeMap::serialize_entry(
1296                &mut map,
1297                "modifierExtension",
1298                &self.modifier_extension,
1299            )?;
1300        }
1301        if let Some(item) = &self.name {
1302            super::super::codec::value_entry(&mut map, "name", item)?;
1303        }
1304        if let Some(item) = &self.publisher {
1305            super::super::codec::value_entry(&mut map, "publisher", item)?;
1306        }
1307        if let Some(item) = &self.purpose {
1308            super::super::codec::value_entry(&mut map, "purpose", item)?;
1309        }
1310        serde::ser::SerializeMap::serialize_entry(
1311            &mut map,
1312            "resourceType",
1313            "TerminologyCapabilities",
1314        )?;
1315        if let Some(item) = &self.software {
1316            serde::ser::SerializeMap::serialize_entry(&mut map, "software", item)?;
1317        }
1318        super::super::codec::value_entry(&mut map, "status", &self.status)?;
1319        if let Some(item) = &self.supplements {
1320            serde::ser::SerializeMap::serialize_entry(&mut map, "supplements", item)?;
1321        }
1322        if let Some(item) = &self.text {
1323            serde::ser::SerializeMap::serialize_entry(&mut map, "text", item)?;
1324        }
1325        if let Some(item) = &self.title {
1326            super::super::codec::value_entry(&mut map, "title", item)?;
1327        }
1328        if let Some(item) = &self.translation {
1329            serde::ser::SerializeMap::serialize_entry(&mut map, "translation", item)?;
1330        }
1331        if let Some(item) = &self.url {
1332            super::super::codec::value_entry(&mut map, "url", item)?;
1333        }
1334        if !self.use_context.is_empty() {
1335            serde::ser::SerializeMap::serialize_entry(&mut map, "useContext", &self.use_context)?;
1336        }
1337        if let Some(item) = &self.validate_code {
1338            serde::ser::SerializeMap::serialize_entry(&mut map, "validateCode", item)?;
1339        }
1340        if let Some(item) = &self.version {
1341            super::super::codec::value_entry(&mut map, "version", item)?;
1342        }
1343        match &self.version_algorithm {
1344            Some(TerminologyCapabilitiesVersionAlgorithm::Coding(inner)) => {
1345                serde::ser::SerializeMap::serialize_entry(
1346                    &mut map,
1347                    "versionAlgorithmCoding",
1348                    inner.as_ref(),
1349                )?;
1350            }
1351            Some(TerminologyCapabilitiesVersionAlgorithm::String(inner)) => {
1352                super::super::codec::value_entry(&mut map, "versionAlgorithmString", inner)?;
1353            }
1354            None => {}
1355        }
1356        serde::ser::SerializeMap::end(map)
1357    }
1358}
1359
1360impl<'de> serde::Deserialize<'de> for TerminologyCapabilities {
1361    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1362        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
1363        let mut path = super::super::codec::Path::root("TerminologyCapabilities");
1364        let object =
1365            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
1366        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
1367    }
1368}
1369
1370/// A code system supported by the server
1371///
1372/// Identifies a code system that is supported by the server. If there is a no
1373/// code system URL, then this declares the general assumptions a client can
1374/// make about support for any CodeSystem resource.
1375#[derive(Debug, Clone, Default, PartialEq, Eq)]
1376pub struct TerminologyCapabilitiesCodeSystem {
1377    /// Unique id for inter-element referencing
1378    ///
1379    /// Unique id for the element within a resource (for internal references). This
1380    /// may be any string value that does not contain spaces.
1381    pub id: Option<std::string::String>,
1382    /// Additional content defined by implementations
1383    ///
1384    /// May be used to represent additional information that is not part of the
1385    /// basic definition of the element. To make the use of extensions safe and
1386    /// managable, there is a strict set of governance applied to the definition and
1387    /// use of extensions. Though any implementer can define an extension, there is
1388    /// a set of requirements that SHALL be met as part of the definition of the
1389    /// extension.
1390    pub extension: Vec<super::extension::Extension>,
1391    /// Extensions that cannot be ignored even if unrecognized
1392    ///
1393    /// May be used to represent additional information that is not part of the
1394    /// basic definition of the element and that modifies the understanding of the
1395    /// element in which it is contained and/or the understanding of the containing
1396    /// element's descendants. Usually modifier elements provide negation or
1397    /// qualification. To make the use of extensions safe and managable, there is a
1398    /// strict set of governance applied to the definition and use of extensions.
1399    /// Though any implementer can define an extension, there is a set of
1400    /// requirements that SHALL be met as part of the definition of the extension.
1401    /// Applications processing a resource are required to check for modifier
1402    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
1403    /// on Resource or DomainResource (including cannot change the meaning of
1404    /// modifierExtension itself).
1405    pub modifier_extension: Vec<super::extension::Extension>,
1406    /// Canonical identifier for the code system, represented as a URI (no version
1407    /// portion)
1408    ///
1409    /// Canonical identifier for the code system, represented as a URI. This cannot
1410    /// have a version in the canonical URL.
1411    pub uri: Option<super::primitives::Canonical>,
1412    /// Canonical identifier for a supported supplement to this code system
1413    /// (including supplement version)
1414    ///
1415    /// Canonical identifier for a supported supplement to this code system.
1416    /// Supplements listed here supplement all versions of the code system. This
1417    /// reference SHOULD be version specific.
1418    pub supplement: Vec<super::primitives::Canonical>,
1419    /// How to compare versions
1420    ///
1421    /// Indicates the mechanism used to compare versions to determine which
1422    /// CodeSystem is more current.
1423    pub version_algorithm: Option<TerminologyCapabilitiesCodeSystemVersionAlgorithm>,
1424    /// Version of Code System supported
1425    ///
1426    /// For the code system, a list of versions that are supported by the server.
1427    pub version: Vec<TerminologyCapabilitiesCodeSystemVersion>,
1428    /// not-present | example | fragment | complete | supplement
1429    ///
1430    /// The extent of the content of the code system (the concepts and codes it
1431    /// defines) are represented in this resource instance.
1432    pub content: Option<super::primitives::Code>,
1433    /// Whether subsumption is supported
1434    ///
1435    /// True if subsumption is supported for this version of the code system.
1436    pub subsumption: Option<super::primitives::Boolean>,
1437}
1438
1439impl super::super::codec::Json for TerminologyCapabilitiesCodeSystem {
1440    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
1441        let mut object = super::super::codec::Object::new();
1442        if let Some(v) = &self.id {
1443            object.insert(
1444                std::string::String::from("id"),
1445                super::super::codec::Value::String(v.clone()),
1446            );
1447        }
1448        if !self.extension.is_empty() {
1449            let mut items = Vec::with_capacity(self.extension.len());
1450            for item in &self.extension {
1451                items.push(super::super::codec::Value::Object(
1452                    super::super::codec::Json::to_json(item)?,
1453                ));
1454            }
1455            object.insert(
1456                std::string::String::from("extension"),
1457                super::super::codec::Value::Array(items),
1458            );
1459        }
1460        if !self.modifier_extension.is_empty() {
1461            let mut items = Vec::with_capacity(self.modifier_extension.len());
1462            for item in &self.modifier_extension {
1463                items.push(super::super::codec::Value::Object(
1464                    super::super::codec::Json::to_json(item)?,
1465                ));
1466            }
1467            object.insert(
1468                std::string::String::from("modifierExtension"),
1469                super::super::codec::Value::Array(items),
1470            );
1471        }
1472        if let Some(item) = &self.uri {
1473            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
1474                object.insert(std::string::String::from("uri"), v);
1475            }
1476            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
1477                object.insert(std::string::String::from("_uri"), e);
1478            }
1479        }
1480        if !self.supplement.is_empty() {
1481            let (values, elements) = super::super::codec::primitive_arrays(&self.supplement)?;
1482            if let Some(values) = values {
1483                object.insert(std::string::String::from("supplement"), values);
1484            }
1485            if let Some(elements) = elements {
1486                object.insert(std::string::String::from("_supplement"), elements);
1487            }
1488        }
1489        if let Some(item) = &self.version_algorithm {
1490            let (suffix, value, element) = item.to_json_parts()?;
1491            if let Some(value) = value {
1492                object.insert(format!("versionAlgorithm{suffix}"), value);
1493            }
1494            if let Some(element) = element {
1495                object.insert(format!("_versionAlgorithm{suffix}"), element);
1496            }
1497        }
1498        if !self.version.is_empty() {
1499            let mut items = Vec::with_capacity(self.version.len());
1500            for item in &self.version {
1501                items.push(super::super::codec::Value::Object(
1502                    super::super::codec::Json::to_json(item)?,
1503                ));
1504            }
1505            object.insert(
1506                std::string::String::from("version"),
1507                super::super::codec::Value::Array(items),
1508            );
1509        }
1510        if let Some(item) = &self.content {
1511            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
1512                object.insert(std::string::String::from("content"), v);
1513            }
1514            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
1515                object.insert(std::string::String::from("_content"), e);
1516            }
1517        }
1518        if let Some(item) = &self.subsumption {
1519            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
1520                object.insert(std::string::String::from("subsumption"), v);
1521            }
1522            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
1523                object.insert(std::string::String::from("_subsumption"), e);
1524            }
1525        }
1526        Ok(object)
1527    }
1528
1529    fn from_json(
1530        object: &super::super::codec::Object,
1531        path: &mut super::super::codec::Path,
1532    ) -> Result<Self, super::super::codec::DecodeError> {
1533        let mut raw_id: Option<&super::super::codec::Value> = None;
1534        let mut raw_extension: Option<&super::super::codec::Value> = None;
1535        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
1536        let mut raw_uri: Option<&super::super::codec::Value> = None;
1537        let mut raw_uri_element: Option<&super::super::codec::Value> = None;
1538        let mut raw_supplement: Option<&super::super::codec::Value> = None;
1539        let mut raw_supplement_element: Option<&super::super::codec::Value> = None;
1540        let mut raw_version_algorithm = super::super::codec::ChoiceSlot::default();
1541        let mut raw_version: Option<&super::super::codec::Value> = None;
1542        let mut raw_content: Option<&super::super::codec::Value> = None;
1543        let mut raw_content_element: Option<&super::super::codec::Value> = None;
1544        let mut raw_subsumption: Option<&super::super::codec::Value> = None;
1545        let mut raw_subsumption_element: Option<&super::super::codec::Value> = None;
1546        for (key, value) in object {
1547            match key.as_str() {
1548                "id" => {
1549                    raw_id = Some(value);
1550                }
1551                "extension" => {
1552                    raw_extension = Some(value);
1553                }
1554                "modifierExtension" => {
1555                    raw_modifier_extension = Some(value);
1556                }
1557                "uri" => {
1558                    raw_uri = Some(value);
1559                }
1560                "_uri" => {
1561                    raw_uri_element = Some(value);
1562                }
1563                "supplement" => {
1564                    raw_supplement = Some(value);
1565                }
1566                "_supplement" => {
1567                    raw_supplement_element = Some(value);
1568                }
1569                "versionAlgorithmString" => {
1570                    raw_version_algorithm.value("String", value, path)?;
1571                }
1572                "_versionAlgorithmString" => {
1573                    raw_version_algorithm.element("String", value, path)?;
1574                }
1575                "versionAlgorithmCoding" => {
1576                    raw_version_algorithm.value("Coding", value, path)?;
1577                }
1578                "_versionAlgorithmCoding" => {
1579                    raw_version_algorithm.element("Coding", value, path)?;
1580                }
1581                "version" => {
1582                    raw_version = Some(value);
1583                }
1584                "content" => {
1585                    raw_content = Some(value);
1586                }
1587                "_content" => {
1588                    raw_content_element = Some(value);
1589                }
1590                "subsumption" => {
1591                    raw_subsumption = Some(value);
1592                }
1593                "_subsumption" => {
1594                    raw_subsumption_element = Some(value);
1595                }
1596                other => {
1597                    return path.with(other, |path| {
1598                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
1599                    });
1600                }
1601            }
1602        }
1603        let field_id = raw_id
1604            .map(|value| {
1605                path.with("id", |path| {
1606                    let value = super::super::codec::expect_single(value, path)?;
1607                    super::primitives::checked_string(
1608                        super::super::codec::expect_string(value, path)?,
1609                        path,
1610                    )
1611                })
1612            })
1613            .transpose()?;
1614        let mut field_extension = Vec::new();
1615        if let Some(raw) = raw_extension {
1616            for (index, value) in path
1617                .with("extension", |path| {
1618                    super::super::codec::expect_array(raw, path)
1619                })?
1620                .iter()
1621                .enumerate()
1622            {
1623                field_extension.push(path.with_index("extension", index, |path| {
1624                    super::super::codec::Json::from_json(
1625                        super::super::codec::expect_object(value, path)?,
1626                        path,
1627                    )
1628                })?);
1629            }
1630        }
1631        let mut field_modifier_extension = Vec::new();
1632        if let Some(raw) = raw_modifier_extension {
1633            for (index, value) in path
1634                .with("modifierExtension", |path| {
1635                    super::super::codec::expect_array(raw, path)
1636                })?
1637                .iter()
1638                .enumerate()
1639            {
1640                field_modifier_extension.push(path.with_index(
1641                    "modifierExtension",
1642                    index,
1643                    |path| {
1644                        super::super::codec::Json::from_json(
1645                            super::super::codec::expect_object(value, path)?,
1646                            path,
1647                        )
1648                    },
1649                )?);
1650            }
1651        }
1652        let field_uri = match (raw_uri, raw_uri_element) {
1653            (None, None) => None,
1654            (value, element) => Some(path.with("uri", |path| {
1655                super::super::codec::Primitive::from_json_parts(value, element, path)
1656            })?),
1657        };
1658        let mut field_supplement = Vec::new();
1659        for (index, (value, element)) in path
1660            .with("supplement", |path| {
1661                super::super::codec::pair_arrays(raw_supplement, raw_supplement_element, path)
1662            })?
1663            .into_iter()
1664            .enumerate()
1665        {
1666            field_supplement.push(path.with_index("supplement", index, |path| {
1667                super::super::codec::Primitive::from_json_parts(value, element, path)
1668            })?);
1669        }
1670        let field_version_algorithm = match raw_version_algorithm.suffix {
1671            None => None,
1672            Some(suffix) => Some(path.with("versionAlgorithm", |path| {
1673                TerminologyCapabilitiesCodeSystemVersionAlgorithm::from_json_parts(
1674                    suffix,
1675                    raw_version_algorithm.value,
1676                    raw_version_algorithm.element,
1677                    path,
1678                )
1679            })?),
1680        };
1681        let mut field_version = Vec::new();
1682        if let Some(raw) = raw_version {
1683            for (index, value) in path
1684                .with("version", |path| {
1685                    super::super::codec::expect_array(raw, path)
1686                })?
1687                .iter()
1688                .enumerate()
1689            {
1690                field_version.push(path.with_index("version", index, |path| {
1691                    super::super::codec::Json::from_json(
1692                        super::super::codec::expect_object(value, path)?,
1693                        path,
1694                    )
1695                })?);
1696            }
1697        }
1698        let field_content = match (raw_content, raw_content_element) {
1699            (None, None) => None,
1700            (value, element) => Some(path.with("content", |path| {
1701                super::super::codec::Primitive::from_json_parts(value, element, path)
1702            })?),
1703        };
1704        let field_subsumption = match (raw_subsumption, raw_subsumption_element) {
1705            (None, None) => None,
1706            (value, element) => Some(path.with("subsumption", |path| {
1707                super::super::codec::Primitive::from_json_parts(value, element, path)
1708            })?),
1709        };
1710        Ok(Self {
1711            id: field_id,
1712            extension: field_extension,
1713            modifier_extension: field_modifier_extension,
1714            uri: field_uri,
1715            supplement: field_supplement,
1716            version_algorithm: field_version_algorithm,
1717            version: field_version,
1718            content: field_content,
1719            subsumption: field_subsumption,
1720        })
1721    }
1722}
1723
1724impl serde::Serialize for TerminologyCapabilitiesCodeSystem {
1725    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1726        let mut map = serde::Serializer::serialize_map(serializer, None)?;
1727        if let Some(item) = &self.content {
1728            super::super::codec::element_entry(&mut map, "_content", item)?;
1729        }
1730        if let Some(item) = &self.subsumption {
1731            super::super::codec::element_entry(&mut map, "_subsumption", item)?;
1732        }
1733        super::super::codec::element_list_entry(&mut map, "_supplement", &self.supplement)?;
1734        if let Some(item) = &self.uri {
1735            super::super::codec::element_entry(&mut map, "_uri", item)?;
1736        }
1737        if let Some(TerminologyCapabilitiesCodeSystemVersionAlgorithm::String(inner)) =
1738            &self.version_algorithm
1739        {
1740            super::super::codec::element_entry(&mut map, "_versionAlgorithmString", inner)?;
1741        }
1742        if let Some(item) = &self.content {
1743            super::super::codec::value_entry(&mut map, "content", item)?;
1744        }
1745        if !self.extension.is_empty() {
1746            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
1747        }
1748        if let Some(v) = &self.id {
1749            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
1750        }
1751        if !self.modifier_extension.is_empty() {
1752            serde::ser::SerializeMap::serialize_entry(
1753                &mut map,
1754                "modifierExtension",
1755                &self.modifier_extension,
1756            )?;
1757        }
1758        if let Some(item) = &self.subsumption {
1759            super::super::codec::value_entry(&mut map, "subsumption", item)?;
1760        }
1761        super::super::codec::value_list_entry(&mut map, "supplement", &self.supplement)?;
1762        if let Some(item) = &self.uri {
1763            super::super::codec::value_entry(&mut map, "uri", item)?;
1764        }
1765        if !self.version.is_empty() {
1766            serde::ser::SerializeMap::serialize_entry(&mut map, "version", &self.version)?;
1767        }
1768        match &self.version_algorithm {
1769            Some(TerminologyCapabilitiesCodeSystemVersionAlgorithm::Coding(inner)) => {
1770                serde::ser::SerializeMap::serialize_entry(
1771                    &mut map,
1772                    "versionAlgorithmCoding",
1773                    inner.as_ref(),
1774                )?;
1775            }
1776            Some(TerminologyCapabilitiesCodeSystemVersionAlgorithm::String(inner)) => {
1777                super::super::codec::value_entry(&mut map, "versionAlgorithmString", inner)?;
1778            }
1779            None => {}
1780        }
1781        serde::ser::SerializeMap::end(map)
1782    }
1783}
1784
1785impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesCodeSystem {
1786    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1787        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
1788        let mut path = super::super::codec::Path::root("TerminologyCapabilitiesCodeSystem");
1789        let object =
1790            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
1791        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
1792    }
1793}
1794
1795/// Version of Code System supported
1796///
1797/// For the code system, a list of versions that are supported by the server.
1798#[derive(Debug, Clone, Default, PartialEq, Eq)]
1799pub struct TerminologyCapabilitiesCodeSystemVersion {
1800    /// Unique id for inter-element referencing
1801    ///
1802    /// Unique id for the element within a resource (for internal references). This
1803    /// may be any string value that does not contain spaces.
1804    pub id: Option<std::string::String>,
1805    /// Additional content defined by implementations
1806    ///
1807    /// May be used to represent additional information that is not part of the
1808    /// basic definition of the element. To make the use of extensions safe and
1809    /// managable, there is a strict set of governance applied to the definition and
1810    /// use of extensions. Though any implementer can define an extension, there is
1811    /// a set of requirements that SHALL be met as part of the definition of the
1812    /// extension.
1813    pub extension: Vec<super::extension::Extension>,
1814    /// Extensions that cannot be ignored even if unrecognized
1815    ///
1816    /// May be used to represent additional information that is not part of the
1817    /// basic definition of the element and that modifies the understanding of the
1818    /// element in which it is contained and/or the understanding of the containing
1819    /// element's descendants. Usually modifier elements provide negation or
1820    /// qualification. To make the use of extensions safe and managable, there is a
1821    /// strict set of governance applied to the definition and use of extensions.
1822    /// Though any implementer can define an extension, there is a set of
1823    /// requirements that SHALL be met as part of the definition of the extension.
1824    /// Applications processing a resource are required to check for modifier
1825    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
1826    /// on Resource or DomainResource (including cannot change the meaning of
1827    /// modifierExtension itself).
1828    pub modifier_extension: Vec<super::extension::Extension>,
1829    /// Code system business version
1830    ///
1831    /// For version-less code systems, there should be a single version with no
1832    /// identifier.
1833    pub value: Option<super::primitives::String>,
1834    /// If this is the default version for this code system.
1835    pub is_default: Option<super::primitives::Boolean>,
1836    /// not-present | example | fragment | complete | supplement
1837    ///
1838    /// The extent of the content of the code system (the concepts and codes it
1839    /// defines) are represented in this resource instance.
1840    pub content: Option<super::primitives::Code>,
1841    /// Canonical identifier for a supported supplement to this code system version
1842    /// (including supplement version)
1843    ///
1844    /// Canonical identifier for a supported supplement to this code system.
1845    /// Supplements listed here supplement this specific version of the code system
1846    /// (and by implication, not all of the supported versions). This reference
1847    /// SHOULD be version specific.
1848    pub supplement: Vec<super::primitives::Canonical>,
1849    /// If compositional grammar is supported
1850    ///
1851    /// If the compositional grammar defined by the code system is supported.
1852    pub compositional: Option<super::primitives::Boolean>,
1853    /// Language Displays supported.
1854    pub language: Vec<super::primitives::Code>,
1855    /// Filter Properties supported.
1856    pub filter: Vec<TerminologyCapabilitiesCodeSystemVersionFilter>,
1857    /// Properties supported for $lookup.
1858    pub property: Vec<super::primitives::Code>,
1859}
1860
1861impl super::super::codec::Json for TerminologyCapabilitiesCodeSystemVersion {
1862    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
1863        let mut object = super::super::codec::Object::new();
1864        if let Some(v) = &self.id {
1865            object.insert(
1866                std::string::String::from("id"),
1867                super::super::codec::Value::String(v.clone()),
1868            );
1869        }
1870        if !self.extension.is_empty() {
1871            let mut items = Vec::with_capacity(self.extension.len());
1872            for item in &self.extension {
1873                items.push(super::super::codec::Value::Object(
1874                    super::super::codec::Json::to_json(item)?,
1875                ));
1876            }
1877            object.insert(
1878                std::string::String::from("extension"),
1879                super::super::codec::Value::Array(items),
1880            );
1881        }
1882        if !self.modifier_extension.is_empty() {
1883            let mut items = Vec::with_capacity(self.modifier_extension.len());
1884            for item in &self.modifier_extension {
1885                items.push(super::super::codec::Value::Object(
1886                    super::super::codec::Json::to_json(item)?,
1887                ));
1888            }
1889            object.insert(
1890                std::string::String::from("modifierExtension"),
1891                super::super::codec::Value::Array(items),
1892            );
1893        }
1894        if let Some(item) = &self.value {
1895            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
1896                object.insert(std::string::String::from("value"), v);
1897            }
1898            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
1899                object.insert(std::string::String::from("_value"), e);
1900            }
1901        }
1902        if let Some(item) = &self.is_default {
1903            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
1904                object.insert(std::string::String::from("isDefault"), v);
1905            }
1906            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
1907                object.insert(std::string::String::from("_isDefault"), e);
1908            }
1909        }
1910        if let Some(item) = &self.content {
1911            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
1912                object.insert(std::string::String::from("content"), v);
1913            }
1914            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
1915                object.insert(std::string::String::from("_content"), e);
1916            }
1917        }
1918        if !self.supplement.is_empty() {
1919            let (values, elements) = super::super::codec::primitive_arrays(&self.supplement)?;
1920            if let Some(values) = values {
1921                object.insert(std::string::String::from("supplement"), values);
1922            }
1923            if let Some(elements) = elements {
1924                object.insert(std::string::String::from("_supplement"), elements);
1925            }
1926        }
1927        if let Some(item) = &self.compositional {
1928            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
1929                object.insert(std::string::String::from("compositional"), v);
1930            }
1931            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
1932                object.insert(std::string::String::from("_compositional"), e);
1933            }
1934        }
1935        if !self.language.is_empty() {
1936            let (values, elements) = super::super::codec::primitive_arrays(&self.language)?;
1937            if let Some(values) = values {
1938                object.insert(std::string::String::from("language"), values);
1939            }
1940            if let Some(elements) = elements {
1941                object.insert(std::string::String::from("_language"), elements);
1942            }
1943        }
1944        if !self.filter.is_empty() {
1945            let mut items = Vec::with_capacity(self.filter.len());
1946            for item in &self.filter {
1947                items.push(super::super::codec::Value::Object(
1948                    super::super::codec::Json::to_json(item)?,
1949                ));
1950            }
1951            object.insert(
1952                std::string::String::from("filter"),
1953                super::super::codec::Value::Array(items),
1954            );
1955        }
1956        if !self.property.is_empty() {
1957            let (values, elements) = super::super::codec::primitive_arrays(&self.property)?;
1958            if let Some(values) = values {
1959                object.insert(std::string::String::from("property"), values);
1960            }
1961            if let Some(elements) = elements {
1962                object.insert(std::string::String::from("_property"), elements);
1963            }
1964        }
1965        Ok(object)
1966    }
1967
1968    fn from_json(
1969        object: &super::super::codec::Object,
1970        path: &mut super::super::codec::Path,
1971    ) -> Result<Self, super::super::codec::DecodeError> {
1972        let mut raw_id: Option<&super::super::codec::Value> = None;
1973        let mut raw_extension: Option<&super::super::codec::Value> = None;
1974        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
1975        let mut raw_value: Option<&super::super::codec::Value> = None;
1976        let mut raw_value_element: Option<&super::super::codec::Value> = None;
1977        let mut raw_is_default: Option<&super::super::codec::Value> = None;
1978        let mut raw_is_default_element: Option<&super::super::codec::Value> = None;
1979        let mut raw_content: Option<&super::super::codec::Value> = None;
1980        let mut raw_content_element: Option<&super::super::codec::Value> = None;
1981        let mut raw_supplement: Option<&super::super::codec::Value> = None;
1982        let mut raw_supplement_element: Option<&super::super::codec::Value> = None;
1983        let mut raw_compositional: Option<&super::super::codec::Value> = None;
1984        let mut raw_compositional_element: Option<&super::super::codec::Value> = None;
1985        let mut raw_language: Option<&super::super::codec::Value> = None;
1986        let mut raw_language_element: Option<&super::super::codec::Value> = None;
1987        let mut raw_filter: Option<&super::super::codec::Value> = None;
1988        let mut raw_property: Option<&super::super::codec::Value> = None;
1989        let mut raw_property_element: Option<&super::super::codec::Value> = None;
1990        for (key, value) in object {
1991            match key.as_str() {
1992                "id" => {
1993                    raw_id = Some(value);
1994                }
1995                "extension" => {
1996                    raw_extension = Some(value);
1997                }
1998                "modifierExtension" => {
1999                    raw_modifier_extension = Some(value);
2000                }
2001                "value" => {
2002                    raw_value = Some(value);
2003                }
2004                "_value" => {
2005                    raw_value_element = Some(value);
2006                }
2007                "isDefault" => {
2008                    raw_is_default = Some(value);
2009                }
2010                "_isDefault" => {
2011                    raw_is_default_element = Some(value);
2012                }
2013                "content" => {
2014                    raw_content = Some(value);
2015                }
2016                "_content" => {
2017                    raw_content_element = Some(value);
2018                }
2019                "supplement" => {
2020                    raw_supplement = Some(value);
2021                }
2022                "_supplement" => {
2023                    raw_supplement_element = Some(value);
2024                }
2025                "compositional" => {
2026                    raw_compositional = Some(value);
2027                }
2028                "_compositional" => {
2029                    raw_compositional_element = Some(value);
2030                }
2031                "language" => {
2032                    raw_language = Some(value);
2033                }
2034                "_language" => {
2035                    raw_language_element = Some(value);
2036                }
2037                "filter" => {
2038                    raw_filter = Some(value);
2039                }
2040                "property" => {
2041                    raw_property = Some(value);
2042                }
2043                "_property" => {
2044                    raw_property_element = Some(value);
2045                }
2046                other => {
2047                    return path.with(other, |path| {
2048                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
2049                    });
2050                }
2051            }
2052        }
2053        let field_id = raw_id
2054            .map(|value| {
2055                path.with("id", |path| {
2056                    let value = super::super::codec::expect_single(value, path)?;
2057                    super::primitives::checked_string(
2058                        super::super::codec::expect_string(value, path)?,
2059                        path,
2060                    )
2061                })
2062            })
2063            .transpose()?;
2064        let mut field_extension = Vec::new();
2065        if let Some(raw) = raw_extension {
2066            for (index, value) in path
2067                .with("extension", |path| {
2068                    super::super::codec::expect_array(raw, path)
2069                })?
2070                .iter()
2071                .enumerate()
2072            {
2073                field_extension.push(path.with_index("extension", index, |path| {
2074                    super::super::codec::Json::from_json(
2075                        super::super::codec::expect_object(value, path)?,
2076                        path,
2077                    )
2078                })?);
2079            }
2080        }
2081        let mut field_modifier_extension = Vec::new();
2082        if let Some(raw) = raw_modifier_extension {
2083            for (index, value) in path
2084                .with("modifierExtension", |path| {
2085                    super::super::codec::expect_array(raw, path)
2086                })?
2087                .iter()
2088                .enumerate()
2089            {
2090                field_modifier_extension.push(path.with_index(
2091                    "modifierExtension",
2092                    index,
2093                    |path| {
2094                        super::super::codec::Json::from_json(
2095                            super::super::codec::expect_object(value, path)?,
2096                            path,
2097                        )
2098                    },
2099                )?);
2100            }
2101        }
2102        let field_value = match (raw_value, raw_value_element) {
2103            (None, None) => None,
2104            (value, element) => Some(path.with("value", |path| {
2105                super::super::codec::Primitive::from_json_parts(value, element, path)
2106            })?),
2107        };
2108        let field_is_default = match (raw_is_default, raw_is_default_element) {
2109            (None, None) => None,
2110            (value, element) => Some(path.with("isDefault", |path| {
2111                super::super::codec::Primitive::from_json_parts(value, element, path)
2112            })?),
2113        };
2114        let field_content = match (raw_content, raw_content_element) {
2115            (None, None) => None,
2116            (value, element) => Some(path.with("content", |path| {
2117                super::super::codec::Primitive::from_json_parts(value, element, path)
2118            })?),
2119        };
2120        let mut field_supplement = Vec::new();
2121        for (index, (value, element)) in path
2122            .with("supplement", |path| {
2123                super::super::codec::pair_arrays(raw_supplement, raw_supplement_element, path)
2124            })?
2125            .into_iter()
2126            .enumerate()
2127        {
2128            field_supplement.push(path.with_index("supplement", index, |path| {
2129                super::super::codec::Primitive::from_json_parts(value, element, path)
2130            })?);
2131        }
2132        let field_compositional = match (raw_compositional, raw_compositional_element) {
2133            (None, None) => None,
2134            (value, element) => Some(path.with("compositional", |path| {
2135                super::super::codec::Primitive::from_json_parts(value, element, path)
2136            })?),
2137        };
2138        let mut field_language = Vec::new();
2139        for (index, (value, element)) in path
2140            .with("language", |path| {
2141                super::super::codec::pair_arrays(raw_language, raw_language_element, path)
2142            })?
2143            .into_iter()
2144            .enumerate()
2145        {
2146            field_language.push(path.with_index("language", index, |path| {
2147                super::super::codec::Primitive::from_json_parts(value, element, path)
2148            })?);
2149        }
2150        let mut field_filter = Vec::new();
2151        if let Some(raw) = raw_filter {
2152            for (index, value) in path
2153                .with("filter", |path| {
2154                    super::super::codec::expect_array(raw, path)
2155                })?
2156                .iter()
2157                .enumerate()
2158            {
2159                field_filter.push(path.with_index("filter", index, |path| {
2160                    super::super::codec::Json::from_json(
2161                        super::super::codec::expect_object(value, path)?,
2162                        path,
2163                    )
2164                })?);
2165            }
2166        }
2167        let mut field_property = Vec::new();
2168        for (index, (value, element)) in path
2169            .with("property", |path| {
2170                super::super::codec::pair_arrays(raw_property, raw_property_element, path)
2171            })?
2172            .into_iter()
2173            .enumerate()
2174        {
2175            field_property.push(path.with_index("property", index, |path| {
2176                super::super::codec::Primitive::from_json_parts(value, element, path)
2177            })?);
2178        }
2179        Ok(Self {
2180            id: field_id,
2181            extension: field_extension,
2182            modifier_extension: field_modifier_extension,
2183            value: field_value,
2184            is_default: field_is_default,
2185            content: field_content,
2186            supplement: field_supplement,
2187            compositional: field_compositional,
2188            language: field_language,
2189            filter: field_filter,
2190            property: field_property,
2191        })
2192    }
2193}
2194
2195impl serde::Serialize for TerminologyCapabilitiesCodeSystemVersion {
2196    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2197        let mut map = serde::Serializer::serialize_map(serializer, None)?;
2198        if let Some(item) = &self.compositional {
2199            super::super::codec::element_entry(&mut map, "_compositional", item)?;
2200        }
2201        if let Some(item) = &self.content {
2202            super::super::codec::element_entry(&mut map, "_content", item)?;
2203        }
2204        if let Some(item) = &self.is_default {
2205            super::super::codec::element_entry(&mut map, "_isDefault", item)?;
2206        }
2207        super::super::codec::element_list_entry(&mut map, "_language", &self.language)?;
2208        super::super::codec::element_list_entry(&mut map, "_property", &self.property)?;
2209        super::super::codec::element_list_entry(&mut map, "_supplement", &self.supplement)?;
2210        if let Some(item) = &self.value {
2211            super::super::codec::element_entry(&mut map, "_value", item)?;
2212        }
2213        if let Some(item) = &self.compositional {
2214            super::super::codec::value_entry(&mut map, "compositional", item)?;
2215        }
2216        if let Some(item) = &self.content {
2217            super::super::codec::value_entry(&mut map, "content", item)?;
2218        }
2219        if !self.extension.is_empty() {
2220            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
2221        }
2222        if !self.filter.is_empty() {
2223            serde::ser::SerializeMap::serialize_entry(&mut map, "filter", &self.filter)?;
2224        }
2225        if let Some(v) = &self.id {
2226            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
2227        }
2228        if let Some(item) = &self.is_default {
2229            super::super::codec::value_entry(&mut map, "isDefault", item)?;
2230        }
2231        super::super::codec::value_list_entry(&mut map, "language", &self.language)?;
2232        if !self.modifier_extension.is_empty() {
2233            serde::ser::SerializeMap::serialize_entry(
2234                &mut map,
2235                "modifierExtension",
2236                &self.modifier_extension,
2237            )?;
2238        }
2239        super::super::codec::value_list_entry(&mut map, "property", &self.property)?;
2240        super::super::codec::value_list_entry(&mut map, "supplement", &self.supplement)?;
2241        if let Some(item) = &self.value {
2242            super::super::codec::value_entry(&mut map, "value", item)?;
2243        }
2244        serde::ser::SerializeMap::end(map)
2245    }
2246}
2247
2248impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesCodeSystemVersion {
2249    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2250        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
2251        let mut path = super::super::codec::Path::root("TerminologyCapabilitiesCodeSystemVersion");
2252        let object =
2253            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
2254        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
2255    }
2256}
2257
2258/// The \`versionAlgorithm\[x\]\` choice of
2259/// \`TerminologyCapabilitiesCodeSystem\`.
2260///
2261/// Indicates the mechanism used to compare versions to determine which
2262/// CodeSystem is more current.
2263#[derive(Debug, Clone, PartialEq, Eq)]
2264pub enum TerminologyCapabilitiesCodeSystemVersionAlgorithm {
2265    /// The `string` form.
2266    String(super::primitives::String),
2267    /// The `Coding` form.
2268    Coding(Box<super::coding::Coding>),
2269}
2270
2271impl TerminologyCapabilitiesCodeSystemVersionAlgorithm {
2272    /// The key suffix, the value part, and the `_name` part of this form.
2273    ///
2274    /// # Errors
2275    ///
2276    /// Returns [`super::super::codec::EncodeError`] when a held value has no JSON form.
2277    pub fn to_json_parts(
2278        &self,
2279    ) -> Result<
2280        (
2281            &'static str,
2282            Option<super::super::codec::Value>,
2283            Option<super::super::codec::Value>,
2284        ),
2285        super::super::codec::EncodeError,
2286    > {
2287        match self {
2288            Self::String(inner) => Ok((
2289                "String",
2290                super::super::codec::Primitive::value_json(inner)?,
2291                super::super::codec::Primitive::element_json(inner)?,
2292            )),
2293            Self::Coding(inner) => Ok((
2294                "Coding",
2295                Some(super::super::codec::Value::Object(
2296                    super::super::codec::Json::to_json(inner.as_ref())?,
2297                )),
2298                None,
2299            )),
2300        }
2301    }
2302
2303    /// Decodes the form named by `suffix` from its value and `_name` parts.
2304    ///
2305    /// # Errors
2306    ///
2307    /// Returns [`super::super::codec::DecodeError`] for an unknown suffix or a malformed part.
2308    pub fn from_json_parts(
2309        suffix: &str,
2310        value: Option<&super::super::codec::Value>,
2311        element: Option<&super::super::codec::Value>,
2312        path: &mut super::super::codec::Path,
2313    ) -> Result<Self, super::super::codec::DecodeError> {
2314        match suffix {
2315            "String" => Ok(Self::String(
2316                super::super::codec::Primitive::from_json_parts(value, element, path)?,
2317            )),
2318            "Coding" => {
2319                if element.is_some() {
2320                    return Err(path.error(super::super::codec::DecodeErrorKind::WrongType {
2321                        expected: "no underscore form for a complex type",
2322                    }));
2323                }
2324                let value = value.ok_or_else(|| {
2325                    path.error(super::super::codec::DecodeErrorKind::MissingProperty)
2326                })?;
2327                let inner = super::super::codec::Json::from_json(
2328                    super::super::codec::expect_object(
2329                        super::super::codec::expect_single(value, path)?,
2330                        path,
2331                    )?,
2332                    path,
2333                )?;
2334                Ok(Self::Coding(Box::new(inner)))
2335            }
2336            _ => Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty)),
2337        }
2338    }
2339}
2340
2341/// Filter Properties supported.
2342#[derive(Debug, Clone, Default, PartialEq, Eq)]
2343pub struct TerminologyCapabilitiesCodeSystemVersionFilter {
2344    /// Unique id for inter-element referencing
2345    ///
2346    /// Unique id for the element within a resource (for internal references). This
2347    /// may be any string value that does not contain spaces.
2348    pub id: Option<std::string::String>,
2349    /// Additional content defined by implementations
2350    ///
2351    /// May be used to represent additional information that is not part of the
2352    /// basic definition of the element. To make the use of extensions safe and
2353    /// managable, there is a strict set of governance applied to the definition and
2354    /// use of extensions. Though any implementer can define an extension, there is
2355    /// a set of requirements that SHALL be met as part of the definition of the
2356    /// extension.
2357    pub extension: Vec<super::extension::Extension>,
2358    /// Extensions that cannot be ignored even if unrecognized
2359    ///
2360    /// May be used to represent additional information that is not part of the
2361    /// basic definition of the element and that modifies the understanding of the
2362    /// element in which it is contained and/or the understanding of the containing
2363    /// element's descendants. Usually modifier elements provide negation or
2364    /// qualification. To make the use of extensions safe and managable, there is a
2365    /// strict set of governance applied to the definition and use of extensions.
2366    /// Though any implementer can define an extension, there is a set of
2367    /// requirements that SHALL be met as part of the definition of the extension.
2368    /// Applications processing a resource are required to check for modifier
2369    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
2370    /// on Resource or DomainResource (including cannot change the meaning of
2371    /// modifierExtension itself).
2372    pub modifier_extension: Vec<super::extension::Extension>,
2373    /// Code of the property supported.
2374    pub code: super::primitives::Code,
2375    /// Operations supported for the property.
2376    pub op: Vec<super::primitives::Code>,
2377}
2378
2379impl super::super::codec::Json for TerminologyCapabilitiesCodeSystemVersionFilter {
2380    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
2381        let mut object = super::super::codec::Object::new();
2382        if let Some(v) = &self.id {
2383            object.insert(
2384                std::string::String::from("id"),
2385                super::super::codec::Value::String(v.clone()),
2386            );
2387        }
2388        if !self.extension.is_empty() {
2389            let mut items = Vec::with_capacity(self.extension.len());
2390            for item in &self.extension {
2391                items.push(super::super::codec::Value::Object(
2392                    super::super::codec::Json::to_json(item)?,
2393                ));
2394            }
2395            object.insert(
2396                std::string::String::from("extension"),
2397                super::super::codec::Value::Array(items),
2398            );
2399        }
2400        if !self.modifier_extension.is_empty() {
2401            let mut items = Vec::with_capacity(self.modifier_extension.len());
2402            for item in &self.modifier_extension {
2403                items.push(super::super::codec::Value::Object(
2404                    super::super::codec::Json::to_json(item)?,
2405                ));
2406            }
2407            object.insert(
2408                std::string::String::from("modifierExtension"),
2409                super::super::codec::Value::Array(items),
2410            );
2411        }
2412        if let Some(v) = super::super::codec::Primitive::value_json(&self.code)? {
2413            object.insert(std::string::String::from("code"), v);
2414        }
2415        if let Some(e) = super::super::codec::Primitive::element_json(&self.code)? {
2416            object.insert(std::string::String::from("_code"), e);
2417        }
2418        if !self.op.is_empty() {
2419            let (values, elements) = super::super::codec::primitive_arrays(&self.op)?;
2420            if let Some(values) = values {
2421                object.insert(std::string::String::from("op"), values);
2422            }
2423            if let Some(elements) = elements {
2424                object.insert(std::string::String::from("_op"), elements);
2425            }
2426        }
2427        Ok(object)
2428    }
2429
2430    fn from_json(
2431        object: &super::super::codec::Object,
2432        path: &mut super::super::codec::Path,
2433    ) -> Result<Self, super::super::codec::DecodeError> {
2434        let mut raw_id: Option<&super::super::codec::Value> = None;
2435        let mut raw_extension: Option<&super::super::codec::Value> = None;
2436        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
2437        let mut raw_code: Option<&super::super::codec::Value> = None;
2438        let mut raw_code_element: Option<&super::super::codec::Value> = None;
2439        let mut raw_op: Option<&super::super::codec::Value> = None;
2440        let mut raw_op_element: Option<&super::super::codec::Value> = None;
2441        for (key, value) in object {
2442            match key.as_str() {
2443                "id" => {
2444                    raw_id = Some(value);
2445                }
2446                "extension" => {
2447                    raw_extension = Some(value);
2448                }
2449                "modifierExtension" => {
2450                    raw_modifier_extension = Some(value);
2451                }
2452                "code" => {
2453                    raw_code = Some(value);
2454                }
2455                "_code" => {
2456                    raw_code_element = Some(value);
2457                }
2458                "op" => {
2459                    raw_op = Some(value);
2460                }
2461                "_op" => {
2462                    raw_op_element = Some(value);
2463                }
2464                other => {
2465                    return path.with(other, |path| {
2466                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
2467                    });
2468                }
2469            }
2470        }
2471        let field_id = raw_id
2472            .map(|value| {
2473                path.with("id", |path| {
2474                    let value = super::super::codec::expect_single(value, path)?;
2475                    super::primitives::checked_string(
2476                        super::super::codec::expect_string(value, path)?,
2477                        path,
2478                    )
2479                })
2480            })
2481            .transpose()?;
2482        let mut field_extension = Vec::new();
2483        if let Some(raw) = raw_extension {
2484            for (index, value) in path
2485                .with("extension", |path| {
2486                    super::super::codec::expect_array(raw, path)
2487                })?
2488                .iter()
2489                .enumerate()
2490            {
2491                field_extension.push(path.with_index("extension", index, |path| {
2492                    super::super::codec::Json::from_json(
2493                        super::super::codec::expect_object(value, path)?,
2494                        path,
2495                    )
2496                })?);
2497            }
2498        }
2499        let mut field_modifier_extension = Vec::new();
2500        if let Some(raw) = raw_modifier_extension {
2501            for (index, value) in path
2502                .with("modifierExtension", |path| {
2503                    super::super::codec::expect_array(raw, path)
2504                })?
2505                .iter()
2506                .enumerate()
2507            {
2508                field_modifier_extension.push(path.with_index(
2509                    "modifierExtension",
2510                    index,
2511                    |path| {
2512                        super::super::codec::Json::from_json(
2513                            super::super::codec::expect_object(value, path)?,
2514                            path,
2515                        )
2516                    },
2517                )?);
2518            }
2519        }
2520        let field_code = path.with("code", |path| {
2521            super::super::codec::Primitive::from_json_parts(raw_code, raw_code_element, path)
2522        })?;
2523        let mut field_op = Vec::new();
2524        for (index, (value, element)) in path
2525            .with("op", |path| {
2526                super::super::codec::pair_arrays(raw_op, raw_op_element, path)
2527            })?
2528            .into_iter()
2529            .enumerate()
2530        {
2531            field_op.push(path.with_index("op", index, |path| {
2532                super::super::codec::Primitive::from_json_parts(value, element, path)
2533            })?);
2534        }
2535        if field_op.is_empty() && !path.is_lenient() {
2536            return path.with("op", |path| {
2537                Err(path.error(super::super::codec::DecodeErrorKind::MissingProperty))
2538            });
2539        }
2540        Ok(Self {
2541            id: field_id,
2542            extension: field_extension,
2543            modifier_extension: field_modifier_extension,
2544            code: field_code,
2545            op: field_op,
2546        })
2547    }
2548}
2549
2550impl serde::Serialize for TerminologyCapabilitiesCodeSystemVersionFilter {
2551    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2552        let mut map = serde::Serializer::serialize_map(serializer, None)?;
2553        super::super::codec::element_entry(&mut map, "_code", &self.code)?;
2554        super::super::codec::element_list_entry(&mut map, "_op", &self.op)?;
2555        super::super::codec::value_entry(&mut map, "code", &self.code)?;
2556        if !self.extension.is_empty() {
2557            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
2558        }
2559        if let Some(v) = &self.id {
2560            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
2561        }
2562        if !self.modifier_extension.is_empty() {
2563            serde::ser::SerializeMap::serialize_entry(
2564                &mut map,
2565                "modifierExtension",
2566                &self.modifier_extension,
2567            )?;
2568        }
2569        super::super::codec::value_list_entry(&mut map, "op", &self.op)?;
2570        serde::ser::SerializeMap::end(map)
2571    }
2572}
2573
2574impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesCodeSystemVersionFilter {
2575    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2576        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
2577        let mut path =
2578            super::super::codec::Path::root("TerminologyCapabilitiesCodeSystemVersionFilter");
2579        let object =
2580            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
2581        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
2582    }
2583}
2584
2585/// Information about the \[ValueSet/$expand\](valueset-operation-expand.html)
2586/// operation.
2587#[derive(Debug, Clone, Default, PartialEq, Eq)]
2588pub struct TerminologyCapabilitiesExpansion {
2589    /// Unique id for inter-element referencing
2590    ///
2591    /// Unique id for the element within a resource (for internal references). This
2592    /// may be any string value that does not contain spaces.
2593    pub id: Option<std::string::String>,
2594    /// Additional content defined by implementations
2595    ///
2596    /// May be used to represent additional information that is not part of the
2597    /// basic definition of the element. To make the use of extensions safe and
2598    /// managable, there is a strict set of governance applied to the definition and
2599    /// use of extensions. Though any implementer can define an extension, there is
2600    /// a set of requirements that SHALL be met as part of the definition of the
2601    /// extension.
2602    pub extension: Vec<super::extension::Extension>,
2603    /// Extensions that cannot be ignored even if unrecognized
2604    ///
2605    /// May be used to represent additional information that is not part of the
2606    /// basic definition of the element and that modifies the understanding of the
2607    /// element in which it is contained and/or the understanding of the containing
2608    /// element's descendants. Usually modifier elements provide negation or
2609    /// qualification. To make the use of extensions safe and managable, there is a
2610    /// strict set of governance applied to the definition and use of extensions.
2611    /// Though any implementer can define an extension, there is a set of
2612    /// requirements that SHALL be met as part of the definition of the extension.
2613    /// Applications processing a resource are required to check for modifier
2614    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
2615    /// on Resource or DomainResource (including cannot change the meaning of
2616    /// modifierExtension itself).
2617    pub modifier_extension: Vec<super::extension::Extension>,
2618    /// Whether the server can return nested value sets.
2619    pub hierarchical: Option<super::primitives::Boolean>,
2620    /// Whether the server supports paging on expansion.
2621    pub paging: Option<super::primitives::Boolean>,
2622    /// Allow request for incomplete expansions?
2623    ///
2624    /// True if requests for incomplete expansions are allowed.
2625    pub incomplete: Option<super::primitives::Boolean>,
2626    /// Supported expansion parameter.
2627    pub parameter: Vec<TerminologyCapabilitiesExpansionParameter>,
2628    /// Documentation about text searching works.
2629    pub text_filter: Option<super::primitives::Markdown>,
2630}
2631
2632impl super::super::codec::Json for TerminologyCapabilitiesExpansion {
2633    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
2634        let mut object = super::super::codec::Object::new();
2635        if let Some(v) = &self.id {
2636            object.insert(
2637                std::string::String::from("id"),
2638                super::super::codec::Value::String(v.clone()),
2639            );
2640        }
2641        if !self.extension.is_empty() {
2642            let mut items = Vec::with_capacity(self.extension.len());
2643            for item in &self.extension {
2644                items.push(super::super::codec::Value::Object(
2645                    super::super::codec::Json::to_json(item)?,
2646                ));
2647            }
2648            object.insert(
2649                std::string::String::from("extension"),
2650                super::super::codec::Value::Array(items),
2651            );
2652        }
2653        if !self.modifier_extension.is_empty() {
2654            let mut items = Vec::with_capacity(self.modifier_extension.len());
2655            for item in &self.modifier_extension {
2656                items.push(super::super::codec::Value::Object(
2657                    super::super::codec::Json::to_json(item)?,
2658                ));
2659            }
2660            object.insert(
2661                std::string::String::from("modifierExtension"),
2662                super::super::codec::Value::Array(items),
2663            );
2664        }
2665        if let Some(item) = &self.hierarchical {
2666            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
2667                object.insert(std::string::String::from("hierarchical"), v);
2668            }
2669            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
2670                object.insert(std::string::String::from("_hierarchical"), e);
2671            }
2672        }
2673        if let Some(item) = &self.paging {
2674            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
2675                object.insert(std::string::String::from("paging"), v);
2676            }
2677            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
2678                object.insert(std::string::String::from("_paging"), e);
2679            }
2680        }
2681        if let Some(item) = &self.incomplete {
2682            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
2683                object.insert(std::string::String::from("incomplete"), v);
2684            }
2685            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
2686                object.insert(std::string::String::from("_incomplete"), e);
2687            }
2688        }
2689        if !self.parameter.is_empty() {
2690            let mut items = Vec::with_capacity(self.parameter.len());
2691            for item in &self.parameter {
2692                items.push(super::super::codec::Value::Object(
2693                    super::super::codec::Json::to_json(item)?,
2694                ));
2695            }
2696            object.insert(
2697                std::string::String::from("parameter"),
2698                super::super::codec::Value::Array(items),
2699            );
2700        }
2701        if let Some(item) = &self.text_filter {
2702            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
2703                object.insert(std::string::String::from("textFilter"), v);
2704            }
2705            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
2706                object.insert(std::string::String::from("_textFilter"), e);
2707            }
2708        }
2709        Ok(object)
2710    }
2711
2712    fn from_json(
2713        object: &super::super::codec::Object,
2714        path: &mut super::super::codec::Path,
2715    ) -> Result<Self, super::super::codec::DecodeError> {
2716        let mut raw_id: Option<&super::super::codec::Value> = None;
2717        let mut raw_extension: Option<&super::super::codec::Value> = None;
2718        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
2719        let mut raw_hierarchical: Option<&super::super::codec::Value> = None;
2720        let mut raw_hierarchical_element: Option<&super::super::codec::Value> = None;
2721        let mut raw_paging: Option<&super::super::codec::Value> = None;
2722        let mut raw_paging_element: Option<&super::super::codec::Value> = None;
2723        let mut raw_incomplete: Option<&super::super::codec::Value> = None;
2724        let mut raw_incomplete_element: Option<&super::super::codec::Value> = None;
2725        let mut raw_parameter: Option<&super::super::codec::Value> = None;
2726        let mut raw_text_filter: Option<&super::super::codec::Value> = None;
2727        let mut raw_text_filter_element: Option<&super::super::codec::Value> = None;
2728        for (key, value) in object {
2729            match key.as_str() {
2730                "id" => {
2731                    raw_id = Some(value);
2732                }
2733                "extension" => {
2734                    raw_extension = Some(value);
2735                }
2736                "modifierExtension" => {
2737                    raw_modifier_extension = Some(value);
2738                }
2739                "hierarchical" => {
2740                    raw_hierarchical = Some(value);
2741                }
2742                "_hierarchical" => {
2743                    raw_hierarchical_element = Some(value);
2744                }
2745                "paging" => {
2746                    raw_paging = Some(value);
2747                }
2748                "_paging" => {
2749                    raw_paging_element = Some(value);
2750                }
2751                "incomplete" => {
2752                    raw_incomplete = Some(value);
2753                }
2754                "_incomplete" => {
2755                    raw_incomplete_element = Some(value);
2756                }
2757                "parameter" => {
2758                    raw_parameter = Some(value);
2759                }
2760                "textFilter" => {
2761                    raw_text_filter = Some(value);
2762                }
2763                "_textFilter" => {
2764                    raw_text_filter_element = Some(value);
2765                }
2766                other => {
2767                    return path.with(other, |path| {
2768                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
2769                    });
2770                }
2771            }
2772        }
2773        let field_id = raw_id
2774            .map(|value| {
2775                path.with("id", |path| {
2776                    let value = super::super::codec::expect_single(value, path)?;
2777                    super::primitives::checked_string(
2778                        super::super::codec::expect_string(value, path)?,
2779                        path,
2780                    )
2781                })
2782            })
2783            .transpose()?;
2784        let mut field_extension = Vec::new();
2785        if let Some(raw) = raw_extension {
2786            for (index, value) in path
2787                .with("extension", |path| {
2788                    super::super::codec::expect_array(raw, path)
2789                })?
2790                .iter()
2791                .enumerate()
2792            {
2793                field_extension.push(path.with_index("extension", index, |path| {
2794                    super::super::codec::Json::from_json(
2795                        super::super::codec::expect_object(value, path)?,
2796                        path,
2797                    )
2798                })?);
2799            }
2800        }
2801        let mut field_modifier_extension = Vec::new();
2802        if let Some(raw) = raw_modifier_extension {
2803            for (index, value) in path
2804                .with("modifierExtension", |path| {
2805                    super::super::codec::expect_array(raw, path)
2806                })?
2807                .iter()
2808                .enumerate()
2809            {
2810                field_modifier_extension.push(path.with_index(
2811                    "modifierExtension",
2812                    index,
2813                    |path| {
2814                        super::super::codec::Json::from_json(
2815                            super::super::codec::expect_object(value, path)?,
2816                            path,
2817                        )
2818                    },
2819                )?);
2820            }
2821        }
2822        let field_hierarchical = match (raw_hierarchical, raw_hierarchical_element) {
2823            (None, None) => None,
2824            (value, element) => Some(path.with("hierarchical", |path| {
2825                super::super::codec::Primitive::from_json_parts(value, element, path)
2826            })?),
2827        };
2828        let field_paging = match (raw_paging, raw_paging_element) {
2829            (None, None) => None,
2830            (value, element) => Some(path.with("paging", |path| {
2831                super::super::codec::Primitive::from_json_parts(value, element, path)
2832            })?),
2833        };
2834        let field_incomplete = match (raw_incomplete, raw_incomplete_element) {
2835            (None, None) => None,
2836            (value, element) => Some(path.with("incomplete", |path| {
2837                super::super::codec::Primitive::from_json_parts(value, element, path)
2838            })?),
2839        };
2840        let mut field_parameter = Vec::new();
2841        if let Some(raw) = raw_parameter {
2842            for (index, value) in path
2843                .with("parameter", |path| {
2844                    super::super::codec::expect_array(raw, path)
2845                })?
2846                .iter()
2847                .enumerate()
2848            {
2849                field_parameter.push(path.with_index("parameter", index, |path| {
2850                    super::super::codec::Json::from_json(
2851                        super::super::codec::expect_object(value, path)?,
2852                        path,
2853                    )
2854                })?);
2855            }
2856        }
2857        let field_text_filter = match (raw_text_filter, raw_text_filter_element) {
2858            (None, None) => None,
2859            (value, element) => Some(path.with("textFilter", |path| {
2860                super::super::codec::Primitive::from_json_parts(value, element, path)
2861            })?),
2862        };
2863        Ok(Self {
2864            id: field_id,
2865            extension: field_extension,
2866            modifier_extension: field_modifier_extension,
2867            hierarchical: field_hierarchical,
2868            paging: field_paging,
2869            incomplete: field_incomplete,
2870            parameter: field_parameter,
2871            text_filter: field_text_filter,
2872        })
2873    }
2874}
2875
2876impl serde::Serialize for TerminologyCapabilitiesExpansion {
2877    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2878        let mut map = serde::Serializer::serialize_map(serializer, None)?;
2879        if let Some(item) = &self.hierarchical {
2880            super::super::codec::element_entry(&mut map, "_hierarchical", item)?;
2881        }
2882        if let Some(item) = &self.incomplete {
2883            super::super::codec::element_entry(&mut map, "_incomplete", item)?;
2884        }
2885        if let Some(item) = &self.paging {
2886            super::super::codec::element_entry(&mut map, "_paging", item)?;
2887        }
2888        if let Some(item) = &self.text_filter {
2889            super::super::codec::element_entry(&mut map, "_textFilter", item)?;
2890        }
2891        if !self.extension.is_empty() {
2892            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
2893        }
2894        if let Some(item) = &self.hierarchical {
2895            super::super::codec::value_entry(&mut map, "hierarchical", item)?;
2896        }
2897        if let Some(v) = &self.id {
2898            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
2899        }
2900        if let Some(item) = &self.incomplete {
2901            super::super::codec::value_entry(&mut map, "incomplete", item)?;
2902        }
2903        if !self.modifier_extension.is_empty() {
2904            serde::ser::SerializeMap::serialize_entry(
2905                &mut map,
2906                "modifierExtension",
2907                &self.modifier_extension,
2908            )?;
2909        }
2910        if let Some(item) = &self.paging {
2911            super::super::codec::value_entry(&mut map, "paging", item)?;
2912        }
2913        if !self.parameter.is_empty() {
2914            serde::ser::SerializeMap::serialize_entry(&mut map, "parameter", &self.parameter)?;
2915        }
2916        if let Some(item) = &self.text_filter {
2917            super::super::codec::value_entry(&mut map, "textFilter", item)?;
2918        }
2919        serde::ser::SerializeMap::end(map)
2920    }
2921}
2922
2923impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesExpansion {
2924    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2925        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
2926        let mut path = super::super::codec::Path::root("TerminologyCapabilitiesExpansion");
2927        let object =
2928            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
2929        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
2930    }
2931}
2932
2933/// Supported expansion parameter.
2934#[derive(Debug, Clone, Default, PartialEq, Eq)]
2935pub struct TerminologyCapabilitiesExpansionParameter {
2936    /// Unique id for inter-element referencing
2937    ///
2938    /// Unique id for the element within a resource (for internal references). This
2939    /// may be any string value that does not contain spaces.
2940    pub id: Option<std::string::String>,
2941    /// Additional content defined by implementations
2942    ///
2943    /// May be used to represent additional information that is not part of the
2944    /// basic definition of the element. To make the use of extensions safe and
2945    /// managable, there is a strict set of governance applied to the definition and
2946    /// use of extensions. Though any implementer can define an extension, there is
2947    /// a set of requirements that SHALL be met as part of the definition of the
2948    /// extension.
2949    pub extension: Vec<super::extension::Extension>,
2950    /// Extensions that cannot be ignored even if unrecognized
2951    ///
2952    /// May be used to represent additional information that is not part of the
2953    /// basic definition of the element and that modifies the understanding of the
2954    /// element in which it is contained and/or the understanding of the containing
2955    /// element's descendants. Usually modifier elements provide negation or
2956    /// qualification. To make the use of extensions safe and managable, there is a
2957    /// strict set of governance applied to the definition and use of extensions.
2958    /// Though any implementer can define an extension, there is a set of
2959    /// requirements that SHALL be met as part of the definition of the extension.
2960    /// Applications processing a resource are required to check for modifier
2961    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
2962    /// on Resource or DomainResource (including cannot change the meaning of
2963    /// modifierExtension itself).
2964    pub modifier_extension: Vec<super::extension::Extension>,
2965    /// Name of the supported expansion parameter.
2966    pub name: super::primitives::Code,
2967    /// Description of support for parameter.
2968    pub documentation: Option<super::primitives::Markdown>,
2969}
2970
2971impl super::super::codec::Json for TerminologyCapabilitiesExpansionParameter {
2972    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
2973        let mut object = super::super::codec::Object::new();
2974        if let Some(v) = &self.id {
2975            object.insert(
2976                std::string::String::from("id"),
2977                super::super::codec::Value::String(v.clone()),
2978            );
2979        }
2980        if !self.extension.is_empty() {
2981            let mut items = Vec::with_capacity(self.extension.len());
2982            for item in &self.extension {
2983                items.push(super::super::codec::Value::Object(
2984                    super::super::codec::Json::to_json(item)?,
2985                ));
2986            }
2987            object.insert(
2988                std::string::String::from("extension"),
2989                super::super::codec::Value::Array(items),
2990            );
2991        }
2992        if !self.modifier_extension.is_empty() {
2993            let mut items = Vec::with_capacity(self.modifier_extension.len());
2994            for item in &self.modifier_extension {
2995                items.push(super::super::codec::Value::Object(
2996                    super::super::codec::Json::to_json(item)?,
2997                ));
2998            }
2999            object.insert(
3000                std::string::String::from("modifierExtension"),
3001                super::super::codec::Value::Array(items),
3002            );
3003        }
3004        if let Some(v) = super::super::codec::Primitive::value_json(&self.name)? {
3005            object.insert(std::string::String::from("name"), v);
3006        }
3007        if let Some(e) = super::super::codec::Primitive::element_json(&self.name)? {
3008            object.insert(std::string::String::from("_name"), e);
3009        }
3010        if let Some(item) = &self.documentation {
3011            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
3012                object.insert(std::string::String::from("documentation"), v);
3013            }
3014            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
3015                object.insert(std::string::String::from("_documentation"), e);
3016            }
3017        }
3018        Ok(object)
3019    }
3020
3021    fn from_json(
3022        object: &super::super::codec::Object,
3023        path: &mut super::super::codec::Path,
3024    ) -> Result<Self, super::super::codec::DecodeError> {
3025        let mut raw_id: Option<&super::super::codec::Value> = None;
3026        let mut raw_extension: Option<&super::super::codec::Value> = None;
3027        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
3028        let mut raw_name: Option<&super::super::codec::Value> = None;
3029        let mut raw_name_element: Option<&super::super::codec::Value> = None;
3030        let mut raw_documentation: Option<&super::super::codec::Value> = None;
3031        let mut raw_documentation_element: Option<&super::super::codec::Value> = None;
3032        for (key, value) in object {
3033            match key.as_str() {
3034                "id" => {
3035                    raw_id = Some(value);
3036                }
3037                "extension" => {
3038                    raw_extension = Some(value);
3039                }
3040                "modifierExtension" => {
3041                    raw_modifier_extension = Some(value);
3042                }
3043                "name" => {
3044                    raw_name = Some(value);
3045                }
3046                "_name" => {
3047                    raw_name_element = Some(value);
3048                }
3049                "documentation" => {
3050                    raw_documentation = Some(value);
3051                }
3052                "_documentation" => {
3053                    raw_documentation_element = Some(value);
3054                }
3055                other => {
3056                    return path.with(other, |path| {
3057                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
3058                    });
3059                }
3060            }
3061        }
3062        let field_id = raw_id
3063            .map(|value| {
3064                path.with("id", |path| {
3065                    let value = super::super::codec::expect_single(value, path)?;
3066                    super::primitives::checked_string(
3067                        super::super::codec::expect_string(value, path)?,
3068                        path,
3069                    )
3070                })
3071            })
3072            .transpose()?;
3073        let mut field_extension = Vec::new();
3074        if let Some(raw) = raw_extension {
3075            for (index, value) in path
3076                .with("extension", |path| {
3077                    super::super::codec::expect_array(raw, path)
3078                })?
3079                .iter()
3080                .enumerate()
3081            {
3082                field_extension.push(path.with_index("extension", index, |path| {
3083                    super::super::codec::Json::from_json(
3084                        super::super::codec::expect_object(value, path)?,
3085                        path,
3086                    )
3087                })?);
3088            }
3089        }
3090        let mut field_modifier_extension = Vec::new();
3091        if let Some(raw) = raw_modifier_extension {
3092            for (index, value) in path
3093                .with("modifierExtension", |path| {
3094                    super::super::codec::expect_array(raw, path)
3095                })?
3096                .iter()
3097                .enumerate()
3098            {
3099                field_modifier_extension.push(path.with_index(
3100                    "modifierExtension",
3101                    index,
3102                    |path| {
3103                        super::super::codec::Json::from_json(
3104                            super::super::codec::expect_object(value, path)?,
3105                            path,
3106                        )
3107                    },
3108                )?);
3109            }
3110        }
3111        let field_name = path.with("name", |path| {
3112            super::super::codec::Primitive::from_json_parts(raw_name, raw_name_element, path)
3113        })?;
3114        let field_documentation = match (raw_documentation, raw_documentation_element) {
3115            (None, None) => None,
3116            (value, element) => Some(path.with("documentation", |path| {
3117                super::super::codec::Primitive::from_json_parts(value, element, path)
3118            })?),
3119        };
3120        Ok(Self {
3121            id: field_id,
3122            extension: field_extension,
3123            modifier_extension: field_modifier_extension,
3124            name: field_name,
3125            documentation: field_documentation,
3126        })
3127    }
3128}
3129
3130impl serde::Serialize for TerminologyCapabilitiesExpansionParameter {
3131    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3132        let mut map = serde::Serializer::serialize_map(serializer, None)?;
3133        if let Some(item) = &self.documentation {
3134            super::super::codec::element_entry(&mut map, "_documentation", item)?;
3135        }
3136        super::super::codec::element_entry(&mut map, "_name", &self.name)?;
3137        if let Some(item) = &self.documentation {
3138            super::super::codec::value_entry(&mut map, "documentation", item)?;
3139        }
3140        if !self.extension.is_empty() {
3141            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
3142        }
3143        if let Some(v) = &self.id {
3144            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
3145        }
3146        if !self.modifier_extension.is_empty() {
3147            serde::ser::SerializeMap::serialize_entry(
3148                &mut map,
3149                "modifierExtension",
3150                &self.modifier_extension,
3151            )?;
3152        }
3153        super::super::codec::value_entry(&mut map, "name", &self.name)?;
3154        serde::ser::SerializeMap::end(map)
3155    }
3156}
3157
3158impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesExpansionParameter {
3159    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3160        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
3161        let mut path = super::super::codec::Path::root("TerminologyCapabilitiesExpansionParameter");
3162        let object =
3163            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
3164        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
3165    }
3166}
3167
3168/// If this describes a specific instance
3169///
3170/// Identifies a specific implementation instance that is described by the
3171/// terminology capability statement - i.e. a particular installation, rather
3172/// than the capabilities of a software program.
3173#[derive(Debug, Clone, Default, PartialEq, Eq)]
3174pub struct TerminologyCapabilitiesImplementation {
3175    /// Unique id for inter-element referencing
3176    ///
3177    /// Unique id for the element within a resource (for internal references). This
3178    /// may be any string value that does not contain spaces.
3179    pub id: Option<std::string::String>,
3180    /// Additional content defined by implementations
3181    ///
3182    /// May be used to represent additional information that is not part of the
3183    /// basic definition of the element. To make the use of extensions safe and
3184    /// managable, there is a strict set of governance applied to the definition and
3185    /// use of extensions. Though any implementer can define an extension, there is
3186    /// a set of requirements that SHALL be met as part of the definition of the
3187    /// extension.
3188    pub extension: Vec<super::extension::Extension>,
3189    /// Extensions that cannot be ignored even if unrecognized
3190    ///
3191    /// May be used to represent additional information that is not part of the
3192    /// basic definition of the element and that modifies the understanding of the
3193    /// element in which it is contained and/or the understanding of the containing
3194    /// element's descendants. Usually modifier elements provide negation or
3195    /// qualification. To make the use of extensions safe and managable, there is a
3196    /// strict set of governance applied to the definition and use of extensions.
3197    /// Though any implementer can define an extension, there is a set of
3198    /// requirements that SHALL be met as part of the definition of the extension.
3199    /// Applications processing a resource are required to check for modifier
3200    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
3201    /// on Resource or DomainResource (including cannot change the meaning of
3202    /// modifierExtension itself).
3203    pub modifier_extension: Vec<super::extension::Extension>,
3204    /// Describes this specific instance
3205    ///
3206    /// Information about the specific installation that this terminology capability
3207    /// statement relates to.
3208    pub description: super::primitives::Markdown,
3209    /// Base URL for the implementation
3210    ///
3211    /// An absolute base URL for the implementation.
3212    pub url: Option<super::primitives::Url>,
3213    /// Describes how fragments are supported
3214    ///
3215    /// This element provides a description of how fragments are supported (or not).
3216    pub fragment_support: Option<super::primitives::Markdown>,
3217    /// Describes how supplements are supported
3218    ///
3219    /// This element provides a description of how supplements are supported (or
3220    /// not).
3221    pub supplement_support: Option<super::primitives::Markdown>,
3222}
3223
3224impl super::super::codec::Json for TerminologyCapabilitiesImplementation {
3225    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
3226        let mut object = super::super::codec::Object::new();
3227        if let Some(v) = &self.id {
3228            object.insert(
3229                std::string::String::from("id"),
3230                super::super::codec::Value::String(v.clone()),
3231            );
3232        }
3233        if !self.extension.is_empty() {
3234            let mut items = Vec::with_capacity(self.extension.len());
3235            for item in &self.extension {
3236                items.push(super::super::codec::Value::Object(
3237                    super::super::codec::Json::to_json(item)?,
3238                ));
3239            }
3240            object.insert(
3241                std::string::String::from("extension"),
3242                super::super::codec::Value::Array(items),
3243            );
3244        }
3245        if !self.modifier_extension.is_empty() {
3246            let mut items = Vec::with_capacity(self.modifier_extension.len());
3247            for item in &self.modifier_extension {
3248                items.push(super::super::codec::Value::Object(
3249                    super::super::codec::Json::to_json(item)?,
3250                ));
3251            }
3252            object.insert(
3253                std::string::String::from("modifierExtension"),
3254                super::super::codec::Value::Array(items),
3255            );
3256        }
3257        if let Some(v) = super::super::codec::Primitive::value_json(&self.description)? {
3258            object.insert(std::string::String::from("description"), v);
3259        }
3260        if let Some(e) = super::super::codec::Primitive::element_json(&self.description)? {
3261            object.insert(std::string::String::from("_description"), e);
3262        }
3263        if let Some(item) = &self.url {
3264            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
3265                object.insert(std::string::String::from("url"), v);
3266            }
3267            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
3268                object.insert(std::string::String::from("_url"), e);
3269            }
3270        }
3271        if let Some(item) = &self.fragment_support {
3272            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
3273                object.insert(std::string::String::from("fragmentSupport"), v);
3274            }
3275            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
3276                object.insert(std::string::String::from("_fragmentSupport"), e);
3277            }
3278        }
3279        if let Some(item) = &self.supplement_support {
3280            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
3281                object.insert(std::string::String::from("supplementSupport"), v);
3282            }
3283            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
3284                object.insert(std::string::String::from("_supplementSupport"), e);
3285            }
3286        }
3287        Ok(object)
3288    }
3289
3290    fn from_json(
3291        object: &super::super::codec::Object,
3292        path: &mut super::super::codec::Path,
3293    ) -> Result<Self, super::super::codec::DecodeError> {
3294        let mut raw_id: Option<&super::super::codec::Value> = None;
3295        let mut raw_extension: Option<&super::super::codec::Value> = None;
3296        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
3297        let mut raw_description: Option<&super::super::codec::Value> = None;
3298        let mut raw_description_element: Option<&super::super::codec::Value> = None;
3299        let mut raw_url: Option<&super::super::codec::Value> = None;
3300        let mut raw_url_element: Option<&super::super::codec::Value> = None;
3301        let mut raw_fragment_support: Option<&super::super::codec::Value> = None;
3302        let mut raw_fragment_support_element: Option<&super::super::codec::Value> = None;
3303        let mut raw_supplement_support: Option<&super::super::codec::Value> = None;
3304        let mut raw_supplement_support_element: Option<&super::super::codec::Value> = None;
3305        for (key, value) in object {
3306            match key.as_str() {
3307                "id" => {
3308                    raw_id = Some(value);
3309                }
3310                "extension" => {
3311                    raw_extension = Some(value);
3312                }
3313                "modifierExtension" => {
3314                    raw_modifier_extension = Some(value);
3315                }
3316                "description" => {
3317                    raw_description = Some(value);
3318                }
3319                "_description" => {
3320                    raw_description_element = Some(value);
3321                }
3322                "url" => {
3323                    raw_url = Some(value);
3324                }
3325                "_url" => {
3326                    raw_url_element = Some(value);
3327                }
3328                "fragmentSupport" => {
3329                    raw_fragment_support = Some(value);
3330                }
3331                "_fragmentSupport" => {
3332                    raw_fragment_support_element = Some(value);
3333                }
3334                "supplementSupport" => {
3335                    raw_supplement_support = Some(value);
3336                }
3337                "_supplementSupport" => {
3338                    raw_supplement_support_element = Some(value);
3339                }
3340                other => {
3341                    return path.with(other, |path| {
3342                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
3343                    });
3344                }
3345            }
3346        }
3347        let field_id = raw_id
3348            .map(|value| {
3349                path.with("id", |path| {
3350                    let value = super::super::codec::expect_single(value, path)?;
3351                    super::primitives::checked_string(
3352                        super::super::codec::expect_string(value, path)?,
3353                        path,
3354                    )
3355                })
3356            })
3357            .transpose()?;
3358        let mut field_extension = Vec::new();
3359        if let Some(raw) = raw_extension {
3360            for (index, value) in path
3361                .with("extension", |path| {
3362                    super::super::codec::expect_array(raw, path)
3363                })?
3364                .iter()
3365                .enumerate()
3366            {
3367                field_extension.push(path.with_index("extension", index, |path| {
3368                    super::super::codec::Json::from_json(
3369                        super::super::codec::expect_object(value, path)?,
3370                        path,
3371                    )
3372                })?);
3373            }
3374        }
3375        let mut field_modifier_extension = Vec::new();
3376        if let Some(raw) = raw_modifier_extension {
3377            for (index, value) in path
3378                .with("modifierExtension", |path| {
3379                    super::super::codec::expect_array(raw, path)
3380                })?
3381                .iter()
3382                .enumerate()
3383            {
3384                field_modifier_extension.push(path.with_index(
3385                    "modifierExtension",
3386                    index,
3387                    |path| {
3388                        super::super::codec::Json::from_json(
3389                            super::super::codec::expect_object(value, path)?,
3390                            path,
3391                        )
3392                    },
3393                )?);
3394            }
3395        }
3396        let field_description = path.with("description", |path| {
3397            super::super::codec::Primitive::from_json_parts(
3398                raw_description,
3399                raw_description_element,
3400                path,
3401            )
3402        })?;
3403        let field_url = match (raw_url, raw_url_element) {
3404            (None, None) => None,
3405            (value, element) => Some(path.with("url", |path| {
3406                super::super::codec::Primitive::from_json_parts(value, element, path)
3407            })?),
3408        };
3409        let field_fragment_support = match (raw_fragment_support, raw_fragment_support_element) {
3410            (None, None) => None,
3411            (value, element) => Some(path.with("fragmentSupport", |path| {
3412                super::super::codec::Primitive::from_json_parts(value, element, path)
3413            })?),
3414        };
3415        let field_supplement_support =
3416            match (raw_supplement_support, raw_supplement_support_element) {
3417                (None, None) => None,
3418                (value, element) => Some(path.with("supplementSupport", |path| {
3419                    super::super::codec::Primitive::from_json_parts(value, element, path)
3420                })?),
3421            };
3422        Ok(Self {
3423            id: field_id,
3424            extension: field_extension,
3425            modifier_extension: field_modifier_extension,
3426            description: field_description,
3427            url: field_url,
3428            fragment_support: field_fragment_support,
3429            supplement_support: field_supplement_support,
3430        })
3431    }
3432}
3433
3434impl serde::Serialize for TerminologyCapabilitiesImplementation {
3435    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3436        let mut map = serde::Serializer::serialize_map(serializer, None)?;
3437        super::super::codec::element_entry(&mut map, "_description", &self.description)?;
3438        if let Some(item) = &self.fragment_support {
3439            super::super::codec::element_entry(&mut map, "_fragmentSupport", item)?;
3440        }
3441        if let Some(item) = &self.supplement_support {
3442            super::super::codec::element_entry(&mut map, "_supplementSupport", item)?;
3443        }
3444        if let Some(item) = &self.url {
3445            super::super::codec::element_entry(&mut map, "_url", item)?;
3446        }
3447        super::super::codec::value_entry(&mut map, "description", &self.description)?;
3448        if !self.extension.is_empty() {
3449            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
3450        }
3451        if let Some(item) = &self.fragment_support {
3452            super::super::codec::value_entry(&mut map, "fragmentSupport", item)?;
3453        }
3454        if let Some(v) = &self.id {
3455            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
3456        }
3457        if !self.modifier_extension.is_empty() {
3458            serde::ser::SerializeMap::serialize_entry(
3459                &mut map,
3460                "modifierExtension",
3461                &self.modifier_extension,
3462            )?;
3463        }
3464        if let Some(item) = &self.supplement_support {
3465            super::super::codec::value_entry(&mut map, "supplementSupport", item)?;
3466        }
3467        if let Some(item) = &self.url {
3468            super::super::codec::value_entry(&mut map, "url", item)?;
3469        }
3470        serde::ser::SerializeMap::end(map)
3471    }
3472}
3473
3474impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesImplementation {
3475    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3476        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
3477        let mut path = super::super::codec::Path::root("TerminologyCapabilitiesImplementation");
3478        let object =
3479            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
3480        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
3481    }
3482}
3483
3484/// Software that is covered by this terminology capability statement
3485///
3486/// Software that is covered by this terminology capability statement. It is
3487/// used when the statement describes the capabilities of a particular software
3488/// version, independent of an installation.
3489#[derive(Debug, Clone, Default, PartialEq, Eq)]
3490pub struct TerminologyCapabilitiesSoftware {
3491    /// Unique id for inter-element referencing
3492    ///
3493    /// Unique id for the element within a resource (for internal references). This
3494    /// may be any string value that does not contain spaces.
3495    pub id: Option<std::string::String>,
3496    /// Additional content defined by implementations
3497    ///
3498    /// May be used to represent additional information that is not part of the
3499    /// basic definition of the element. To make the use of extensions safe and
3500    /// managable, there is a strict set of governance applied to the definition and
3501    /// use of extensions. Though any implementer can define an extension, there is
3502    /// a set of requirements that SHALL be met as part of the definition of the
3503    /// extension.
3504    pub extension: Vec<super::extension::Extension>,
3505    /// Extensions that cannot be ignored even if unrecognized
3506    ///
3507    /// May be used to represent additional information that is not part of the
3508    /// basic definition of the element and that modifies the understanding of the
3509    /// element in which it is contained and/or the understanding of the containing
3510    /// element's descendants. Usually modifier elements provide negation or
3511    /// qualification. To make the use of extensions safe and managable, there is a
3512    /// strict set of governance applied to the definition and use of extensions.
3513    /// Though any implementer can define an extension, there is a set of
3514    /// requirements that SHALL be met as part of the definition of the extension.
3515    /// Applications processing a resource are required to check for modifier
3516    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
3517    /// on Resource or DomainResource (including cannot change the meaning of
3518    /// modifierExtension itself).
3519    pub modifier_extension: Vec<super::extension::Extension>,
3520    /// A name the software is known by
3521    ///
3522    /// Name the software is known by.
3523    pub name: super::primitives::String,
3524    /// Version covered by this statement
3525    ///
3526    /// The version identifier for the software covered by this statement.
3527    pub version: Option<super::primitives::String>,
3528}
3529
3530impl super::super::codec::Json for TerminologyCapabilitiesSoftware {
3531    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
3532        let mut object = super::super::codec::Object::new();
3533        if let Some(v) = &self.id {
3534            object.insert(
3535                std::string::String::from("id"),
3536                super::super::codec::Value::String(v.clone()),
3537            );
3538        }
3539        if !self.extension.is_empty() {
3540            let mut items = Vec::with_capacity(self.extension.len());
3541            for item in &self.extension {
3542                items.push(super::super::codec::Value::Object(
3543                    super::super::codec::Json::to_json(item)?,
3544                ));
3545            }
3546            object.insert(
3547                std::string::String::from("extension"),
3548                super::super::codec::Value::Array(items),
3549            );
3550        }
3551        if !self.modifier_extension.is_empty() {
3552            let mut items = Vec::with_capacity(self.modifier_extension.len());
3553            for item in &self.modifier_extension {
3554                items.push(super::super::codec::Value::Object(
3555                    super::super::codec::Json::to_json(item)?,
3556                ));
3557            }
3558            object.insert(
3559                std::string::String::from("modifierExtension"),
3560                super::super::codec::Value::Array(items),
3561            );
3562        }
3563        if let Some(v) = super::super::codec::Primitive::value_json(&self.name)? {
3564            object.insert(std::string::String::from("name"), v);
3565        }
3566        if let Some(e) = super::super::codec::Primitive::element_json(&self.name)? {
3567            object.insert(std::string::String::from("_name"), e);
3568        }
3569        if let Some(item) = &self.version {
3570            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
3571                object.insert(std::string::String::from("version"), v);
3572            }
3573            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
3574                object.insert(std::string::String::from("_version"), e);
3575            }
3576        }
3577        Ok(object)
3578    }
3579
3580    fn from_json(
3581        object: &super::super::codec::Object,
3582        path: &mut super::super::codec::Path,
3583    ) -> Result<Self, super::super::codec::DecodeError> {
3584        let mut raw_id: Option<&super::super::codec::Value> = None;
3585        let mut raw_extension: Option<&super::super::codec::Value> = None;
3586        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
3587        let mut raw_name: Option<&super::super::codec::Value> = None;
3588        let mut raw_name_element: Option<&super::super::codec::Value> = None;
3589        let mut raw_version: Option<&super::super::codec::Value> = None;
3590        let mut raw_version_element: Option<&super::super::codec::Value> = None;
3591        for (key, value) in object {
3592            match key.as_str() {
3593                "id" => {
3594                    raw_id = Some(value);
3595                }
3596                "extension" => {
3597                    raw_extension = Some(value);
3598                }
3599                "modifierExtension" => {
3600                    raw_modifier_extension = Some(value);
3601                }
3602                "name" => {
3603                    raw_name = Some(value);
3604                }
3605                "_name" => {
3606                    raw_name_element = Some(value);
3607                }
3608                "version" => {
3609                    raw_version = Some(value);
3610                }
3611                "_version" => {
3612                    raw_version_element = Some(value);
3613                }
3614                other => {
3615                    return path.with(other, |path| {
3616                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
3617                    });
3618                }
3619            }
3620        }
3621        let field_id = raw_id
3622            .map(|value| {
3623                path.with("id", |path| {
3624                    let value = super::super::codec::expect_single(value, path)?;
3625                    super::primitives::checked_string(
3626                        super::super::codec::expect_string(value, path)?,
3627                        path,
3628                    )
3629                })
3630            })
3631            .transpose()?;
3632        let mut field_extension = Vec::new();
3633        if let Some(raw) = raw_extension {
3634            for (index, value) in path
3635                .with("extension", |path| {
3636                    super::super::codec::expect_array(raw, path)
3637                })?
3638                .iter()
3639                .enumerate()
3640            {
3641                field_extension.push(path.with_index("extension", index, |path| {
3642                    super::super::codec::Json::from_json(
3643                        super::super::codec::expect_object(value, path)?,
3644                        path,
3645                    )
3646                })?);
3647            }
3648        }
3649        let mut field_modifier_extension = Vec::new();
3650        if let Some(raw) = raw_modifier_extension {
3651            for (index, value) in path
3652                .with("modifierExtension", |path| {
3653                    super::super::codec::expect_array(raw, path)
3654                })?
3655                .iter()
3656                .enumerate()
3657            {
3658                field_modifier_extension.push(path.with_index(
3659                    "modifierExtension",
3660                    index,
3661                    |path| {
3662                        super::super::codec::Json::from_json(
3663                            super::super::codec::expect_object(value, path)?,
3664                            path,
3665                        )
3666                    },
3667                )?);
3668            }
3669        }
3670        let field_name = path.with("name", |path| {
3671            super::super::codec::Primitive::from_json_parts(raw_name, raw_name_element, path)
3672        })?;
3673        let field_version = match (raw_version, raw_version_element) {
3674            (None, None) => None,
3675            (value, element) => Some(path.with("version", |path| {
3676                super::super::codec::Primitive::from_json_parts(value, element, path)
3677            })?),
3678        };
3679        Ok(Self {
3680            id: field_id,
3681            extension: field_extension,
3682            modifier_extension: field_modifier_extension,
3683            name: field_name,
3684            version: field_version,
3685        })
3686    }
3687}
3688
3689impl serde::Serialize for TerminologyCapabilitiesSoftware {
3690    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3691        let mut map = serde::Serializer::serialize_map(serializer, None)?;
3692        super::super::codec::element_entry(&mut map, "_name", &self.name)?;
3693        if let Some(item) = &self.version {
3694            super::super::codec::element_entry(&mut map, "_version", item)?;
3695        }
3696        if !self.extension.is_empty() {
3697            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
3698        }
3699        if let Some(v) = &self.id {
3700            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
3701        }
3702        if !self.modifier_extension.is_empty() {
3703            serde::ser::SerializeMap::serialize_entry(
3704                &mut map,
3705                "modifierExtension",
3706                &self.modifier_extension,
3707            )?;
3708        }
3709        super::super::codec::value_entry(&mut map, "name", &self.name)?;
3710        if let Some(item) = &self.version {
3711            super::super::codec::value_entry(&mut map, "version", item)?;
3712        }
3713        serde::ser::SerializeMap::end(map)
3714    }
3715}
3716
3717impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesSoftware {
3718    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3719        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
3720        let mut path = super::super::codec::Path::root("TerminologyCapabilitiesSoftware");
3721        let object =
3722            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
3723        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
3724    }
3725}
3726
3727/// Supplement Support Information
3728///
3729/// Information about how the system supports CodeSystem supplements.
3730#[derive(Debug, Clone, Default, PartialEq, Eq)]
3731pub struct TerminologyCapabilitiesSupplements {
3732    /// Unique id for inter-element referencing
3733    ///
3734    /// Unique id for the element within a resource (for internal references). This
3735    /// may be any string value that does not contain spaces.
3736    pub id: Option<std::string::String>,
3737    /// Additional content defined by implementations
3738    ///
3739    /// May be used to represent additional information that is not part of the
3740    /// basic definition of the element. To make the use of extensions safe and
3741    /// managable, there is a strict set of governance applied to the definition and
3742    /// use of extensions. Though any implementer can define an extension, there is
3743    /// a set of requirements that SHALL be met as part of the definition of the
3744    /// extension.
3745    pub extension: Vec<super::extension::Extension>,
3746    /// Extensions that cannot be ignored even if unrecognized
3747    ///
3748    /// May be used to represent additional information that is not part of the
3749    /// basic definition of the element and that modifies the understanding of the
3750    /// element in which it is contained and/or the understanding of the containing
3751    /// element's descendants. Usually modifier elements provide negation or
3752    /// qualification. To make the use of extensions safe and managable, there is a
3753    /// strict set of governance applied to the definition and use of extensions.
3754    /// Though any implementer can define an extension, there is a set of
3755    /// requirements that SHALL be met as part of the definition of the extension.
3756    /// Applications processing a resource are required to check for modifier
3757    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
3758    /// on Resource or DomainResource (including cannot change the meaning of
3759    /// modifierExtension itself).
3760    pub modifier_extension: Vec<super::extension::Extension>,
3761    /// not-supported | explicit | implicit
3762    ///
3763    /// Codes that describes how the server implements global language packs - that
3764    /// is, supplements that contain only designations for a single language that
3765    /// are marked as intended by the extension
3766    /// <http://hl7.org/fhir/StructureDefinition/codesystem-globalLangPack> for use
3767    /// with all value sets and codesystem without explicit reference.
3768    pub globals: Option<super::primitives::Code>,
3769}
3770
3771impl super::super::codec::Json for TerminologyCapabilitiesSupplements {
3772    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
3773        let mut object = super::super::codec::Object::new();
3774        if let Some(v) = &self.id {
3775            object.insert(
3776                std::string::String::from("id"),
3777                super::super::codec::Value::String(v.clone()),
3778            );
3779        }
3780        if !self.extension.is_empty() {
3781            let mut items = Vec::with_capacity(self.extension.len());
3782            for item in &self.extension {
3783                items.push(super::super::codec::Value::Object(
3784                    super::super::codec::Json::to_json(item)?,
3785                ));
3786            }
3787            object.insert(
3788                std::string::String::from("extension"),
3789                super::super::codec::Value::Array(items),
3790            );
3791        }
3792        if !self.modifier_extension.is_empty() {
3793            let mut items = Vec::with_capacity(self.modifier_extension.len());
3794            for item in &self.modifier_extension {
3795                items.push(super::super::codec::Value::Object(
3796                    super::super::codec::Json::to_json(item)?,
3797                ));
3798            }
3799            object.insert(
3800                std::string::String::from("modifierExtension"),
3801                super::super::codec::Value::Array(items),
3802            );
3803        }
3804        if let Some(item) = &self.globals {
3805            if let Some(v) = super::super::codec::Primitive::value_json(item)? {
3806                object.insert(std::string::String::from("globals"), v);
3807            }
3808            if let Some(e) = super::super::codec::Primitive::element_json(item)? {
3809                object.insert(std::string::String::from("_globals"), e);
3810            }
3811        }
3812        Ok(object)
3813    }
3814
3815    fn from_json(
3816        object: &super::super::codec::Object,
3817        path: &mut super::super::codec::Path,
3818    ) -> Result<Self, super::super::codec::DecodeError> {
3819        let mut raw_id: Option<&super::super::codec::Value> = None;
3820        let mut raw_extension: Option<&super::super::codec::Value> = None;
3821        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
3822        let mut raw_globals: Option<&super::super::codec::Value> = None;
3823        let mut raw_globals_element: Option<&super::super::codec::Value> = None;
3824        for (key, value) in object {
3825            match key.as_str() {
3826                "id" => {
3827                    raw_id = Some(value);
3828                }
3829                "extension" => {
3830                    raw_extension = Some(value);
3831                }
3832                "modifierExtension" => {
3833                    raw_modifier_extension = Some(value);
3834                }
3835                "globals" => {
3836                    raw_globals = Some(value);
3837                }
3838                "_globals" => {
3839                    raw_globals_element = Some(value);
3840                }
3841                other => {
3842                    return path.with(other, |path| {
3843                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
3844                    });
3845                }
3846            }
3847        }
3848        let field_id = raw_id
3849            .map(|value| {
3850                path.with("id", |path| {
3851                    let value = super::super::codec::expect_single(value, path)?;
3852                    super::primitives::checked_string(
3853                        super::super::codec::expect_string(value, path)?,
3854                        path,
3855                    )
3856                })
3857            })
3858            .transpose()?;
3859        let mut field_extension = Vec::new();
3860        if let Some(raw) = raw_extension {
3861            for (index, value) in path
3862                .with("extension", |path| {
3863                    super::super::codec::expect_array(raw, path)
3864                })?
3865                .iter()
3866                .enumerate()
3867            {
3868                field_extension.push(path.with_index("extension", index, |path| {
3869                    super::super::codec::Json::from_json(
3870                        super::super::codec::expect_object(value, path)?,
3871                        path,
3872                    )
3873                })?);
3874            }
3875        }
3876        let mut field_modifier_extension = Vec::new();
3877        if let Some(raw) = raw_modifier_extension {
3878            for (index, value) in path
3879                .with("modifierExtension", |path| {
3880                    super::super::codec::expect_array(raw, path)
3881                })?
3882                .iter()
3883                .enumerate()
3884            {
3885                field_modifier_extension.push(path.with_index(
3886                    "modifierExtension",
3887                    index,
3888                    |path| {
3889                        super::super::codec::Json::from_json(
3890                            super::super::codec::expect_object(value, path)?,
3891                            path,
3892                        )
3893                    },
3894                )?);
3895            }
3896        }
3897        let field_globals = match (raw_globals, raw_globals_element) {
3898            (None, None) => None,
3899            (value, element) => Some(path.with("globals", |path| {
3900                super::super::codec::Primitive::from_json_parts(value, element, path)
3901            })?),
3902        };
3903        Ok(Self {
3904            id: field_id,
3905            extension: field_extension,
3906            modifier_extension: field_modifier_extension,
3907            globals: field_globals,
3908        })
3909    }
3910}
3911
3912impl serde::Serialize for TerminologyCapabilitiesSupplements {
3913    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
3914        let mut map = serde::Serializer::serialize_map(serializer, None)?;
3915        if let Some(item) = &self.globals {
3916            super::super::codec::element_entry(&mut map, "_globals", item)?;
3917        }
3918        if !self.extension.is_empty() {
3919            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
3920        }
3921        if let Some(item) = &self.globals {
3922            super::super::codec::value_entry(&mut map, "globals", item)?;
3923        }
3924        if let Some(v) = &self.id {
3925            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
3926        }
3927        if !self.modifier_extension.is_empty() {
3928            serde::ser::SerializeMap::serialize_entry(
3929                &mut map,
3930                "modifierExtension",
3931                &self.modifier_extension,
3932            )?;
3933        }
3934        serde::ser::SerializeMap::end(map)
3935    }
3936}
3937
3938impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesSupplements {
3939    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3940        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
3941        let mut path = super::super::codec::Path::root("TerminologyCapabilitiesSupplements");
3942        let object =
3943            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
3944        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
3945    }
3946}
3947
3948/// Information about the
3949/// \[ConceptMap/$translate\](conceptmap-operation-translate.html) operation.
3950#[derive(Debug, Clone, Default, PartialEq, Eq)]
3951pub struct TerminologyCapabilitiesTranslation {
3952    /// Unique id for inter-element referencing
3953    ///
3954    /// Unique id for the element within a resource (for internal references). This
3955    /// may be any string value that does not contain spaces.
3956    pub id: Option<std::string::String>,
3957    /// Additional content defined by implementations
3958    ///
3959    /// May be used to represent additional information that is not part of the
3960    /// basic definition of the element. To make the use of extensions safe and
3961    /// managable, there is a strict set of governance applied to the definition and
3962    /// use of extensions. Though any implementer can define an extension, there is
3963    /// a set of requirements that SHALL be met as part of the definition of the
3964    /// extension.
3965    pub extension: Vec<super::extension::Extension>,
3966    /// Extensions that cannot be ignored even if unrecognized
3967    ///
3968    /// May be used to represent additional information that is not part of the
3969    /// basic definition of the element and that modifies the understanding of the
3970    /// element in which it is contained and/or the understanding of the containing
3971    /// element's descendants. Usually modifier elements provide negation or
3972    /// qualification. To make the use of extensions safe and managable, there is a
3973    /// strict set of governance applied to the definition and use of extensions.
3974    /// Though any implementer can define an extension, there is a set of
3975    /// requirements that SHALL be met as part of the definition of the extension.
3976    /// Applications processing a resource are required to check for modifier
3977    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
3978    /// on Resource or DomainResource (including cannot change the meaning of
3979    /// modifierExtension itself).
3980    pub modifier_extension: Vec<super::extension::Extension>,
3981    /// Whether the client must identify the map.
3982    pub needs_map: super::primitives::Boolean,
3983}
3984
3985impl super::super::codec::Json for TerminologyCapabilitiesTranslation {
3986    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
3987        let mut object = super::super::codec::Object::new();
3988        if let Some(v) = &self.id {
3989            object.insert(
3990                std::string::String::from("id"),
3991                super::super::codec::Value::String(v.clone()),
3992            );
3993        }
3994        if !self.extension.is_empty() {
3995            let mut items = Vec::with_capacity(self.extension.len());
3996            for item in &self.extension {
3997                items.push(super::super::codec::Value::Object(
3998                    super::super::codec::Json::to_json(item)?,
3999                ));
4000            }
4001            object.insert(
4002                std::string::String::from("extension"),
4003                super::super::codec::Value::Array(items),
4004            );
4005        }
4006        if !self.modifier_extension.is_empty() {
4007            let mut items = Vec::with_capacity(self.modifier_extension.len());
4008            for item in &self.modifier_extension {
4009                items.push(super::super::codec::Value::Object(
4010                    super::super::codec::Json::to_json(item)?,
4011                ));
4012            }
4013            object.insert(
4014                std::string::String::from("modifierExtension"),
4015                super::super::codec::Value::Array(items),
4016            );
4017        }
4018        if let Some(v) = super::super::codec::Primitive::value_json(&self.needs_map)? {
4019            object.insert(std::string::String::from("needsMap"), v);
4020        }
4021        if let Some(e) = super::super::codec::Primitive::element_json(&self.needs_map)? {
4022            object.insert(std::string::String::from("_needsMap"), e);
4023        }
4024        Ok(object)
4025    }
4026
4027    fn from_json(
4028        object: &super::super::codec::Object,
4029        path: &mut super::super::codec::Path,
4030    ) -> Result<Self, super::super::codec::DecodeError> {
4031        let mut raw_id: Option<&super::super::codec::Value> = None;
4032        let mut raw_extension: Option<&super::super::codec::Value> = None;
4033        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
4034        let mut raw_needs_map: Option<&super::super::codec::Value> = None;
4035        let mut raw_needs_map_element: Option<&super::super::codec::Value> = None;
4036        for (key, value) in object {
4037            match key.as_str() {
4038                "id" => {
4039                    raw_id = Some(value);
4040                }
4041                "extension" => {
4042                    raw_extension = Some(value);
4043                }
4044                "modifierExtension" => {
4045                    raw_modifier_extension = Some(value);
4046                }
4047                "needsMap" => {
4048                    raw_needs_map = Some(value);
4049                }
4050                "_needsMap" => {
4051                    raw_needs_map_element = Some(value);
4052                }
4053                other => {
4054                    return path.with(other, |path| {
4055                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
4056                    });
4057                }
4058            }
4059        }
4060        let field_id = raw_id
4061            .map(|value| {
4062                path.with("id", |path| {
4063                    let value = super::super::codec::expect_single(value, path)?;
4064                    super::primitives::checked_string(
4065                        super::super::codec::expect_string(value, path)?,
4066                        path,
4067                    )
4068                })
4069            })
4070            .transpose()?;
4071        let mut field_extension = Vec::new();
4072        if let Some(raw) = raw_extension {
4073            for (index, value) in path
4074                .with("extension", |path| {
4075                    super::super::codec::expect_array(raw, path)
4076                })?
4077                .iter()
4078                .enumerate()
4079            {
4080                field_extension.push(path.with_index("extension", index, |path| {
4081                    super::super::codec::Json::from_json(
4082                        super::super::codec::expect_object(value, path)?,
4083                        path,
4084                    )
4085                })?);
4086            }
4087        }
4088        let mut field_modifier_extension = Vec::new();
4089        if let Some(raw) = raw_modifier_extension {
4090            for (index, value) in path
4091                .with("modifierExtension", |path| {
4092                    super::super::codec::expect_array(raw, path)
4093                })?
4094                .iter()
4095                .enumerate()
4096            {
4097                field_modifier_extension.push(path.with_index(
4098                    "modifierExtension",
4099                    index,
4100                    |path| {
4101                        super::super::codec::Json::from_json(
4102                            super::super::codec::expect_object(value, path)?,
4103                            path,
4104                        )
4105                    },
4106                )?);
4107            }
4108        }
4109        let field_needs_map = path.with("needsMap", |path| {
4110            super::super::codec::Primitive::from_json_parts(
4111                raw_needs_map,
4112                raw_needs_map_element,
4113                path,
4114            )
4115        })?;
4116        Ok(Self {
4117            id: field_id,
4118            extension: field_extension,
4119            modifier_extension: field_modifier_extension,
4120            needs_map: field_needs_map,
4121        })
4122    }
4123}
4124
4125impl serde::Serialize for TerminologyCapabilitiesTranslation {
4126    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
4127        let mut map = serde::Serializer::serialize_map(serializer, None)?;
4128        super::super::codec::element_entry(&mut map, "_needsMap", &self.needs_map)?;
4129        if !self.extension.is_empty() {
4130            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
4131        }
4132        if let Some(v) = &self.id {
4133            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
4134        }
4135        if !self.modifier_extension.is_empty() {
4136            serde::ser::SerializeMap::serialize_entry(
4137                &mut map,
4138                "modifierExtension",
4139                &self.modifier_extension,
4140            )?;
4141        }
4142        super::super::codec::value_entry(&mut map, "needsMap", &self.needs_map)?;
4143        serde::ser::SerializeMap::end(map)
4144    }
4145}
4146
4147impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesTranslation {
4148    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
4149        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
4150        let mut path = super::super::codec::Path::root("TerminologyCapabilitiesTranslation");
4151        let object =
4152            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
4153        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
4154    }
4155}
4156
4157/// Information about the
4158/// \[ValueSet/$validate-code\](valueset-operation-validate-code.html)
4159/// operation.
4160#[derive(Debug, Clone, Default, PartialEq, Eq)]
4161pub struct TerminologyCapabilitiesValidateCode {
4162    /// Unique id for inter-element referencing
4163    ///
4164    /// Unique id for the element within a resource (for internal references). This
4165    /// may be any string value that does not contain spaces.
4166    pub id: Option<std::string::String>,
4167    /// Additional content defined by implementations
4168    ///
4169    /// May be used to represent additional information that is not part of the
4170    /// basic definition of the element. To make the use of extensions safe and
4171    /// managable, there is a strict set of governance applied to the definition and
4172    /// use of extensions. Though any implementer can define an extension, there is
4173    /// a set of requirements that SHALL be met as part of the definition of the
4174    /// extension.
4175    pub extension: Vec<super::extension::Extension>,
4176    /// Extensions that cannot be ignored even if unrecognized
4177    ///
4178    /// May be used to represent additional information that is not part of the
4179    /// basic definition of the element and that modifies the understanding of the
4180    /// element in which it is contained and/or the understanding of the containing
4181    /// element's descendants. Usually modifier elements provide negation or
4182    /// qualification. To make the use of extensions safe and managable, there is a
4183    /// strict set of governance applied to the definition and use of extensions.
4184    /// Though any implementer can define an extension, there is a set of
4185    /// requirements that SHALL be met as part of the definition of the extension.
4186    /// Applications processing a resource are required to check for modifier
4187    /// extensions. Modifier extensions SHALL NOT change the meaning of any elements
4188    /// on Resource or DomainResource (including cannot change the meaning of
4189    /// modifierExtension itself).
4190    pub modifier_extension: Vec<super::extension::Extension>,
4191    /// Whether translations are validated.
4192    pub translations: super::primitives::Boolean,
4193}
4194
4195impl super::super::codec::Json for TerminologyCapabilitiesValidateCode {
4196    fn to_json(&self) -> Result<super::super::codec::Object, super::super::codec::EncodeError> {
4197        let mut object = super::super::codec::Object::new();
4198        if let Some(v) = &self.id {
4199            object.insert(
4200                std::string::String::from("id"),
4201                super::super::codec::Value::String(v.clone()),
4202            );
4203        }
4204        if !self.extension.is_empty() {
4205            let mut items = Vec::with_capacity(self.extension.len());
4206            for item in &self.extension {
4207                items.push(super::super::codec::Value::Object(
4208                    super::super::codec::Json::to_json(item)?,
4209                ));
4210            }
4211            object.insert(
4212                std::string::String::from("extension"),
4213                super::super::codec::Value::Array(items),
4214            );
4215        }
4216        if !self.modifier_extension.is_empty() {
4217            let mut items = Vec::with_capacity(self.modifier_extension.len());
4218            for item in &self.modifier_extension {
4219                items.push(super::super::codec::Value::Object(
4220                    super::super::codec::Json::to_json(item)?,
4221                ));
4222            }
4223            object.insert(
4224                std::string::String::from("modifierExtension"),
4225                super::super::codec::Value::Array(items),
4226            );
4227        }
4228        if let Some(v) = super::super::codec::Primitive::value_json(&self.translations)? {
4229            object.insert(std::string::String::from("translations"), v);
4230        }
4231        if let Some(e) = super::super::codec::Primitive::element_json(&self.translations)? {
4232            object.insert(std::string::String::from("_translations"), e);
4233        }
4234        Ok(object)
4235    }
4236
4237    fn from_json(
4238        object: &super::super::codec::Object,
4239        path: &mut super::super::codec::Path,
4240    ) -> Result<Self, super::super::codec::DecodeError> {
4241        let mut raw_id: Option<&super::super::codec::Value> = None;
4242        let mut raw_extension: Option<&super::super::codec::Value> = None;
4243        let mut raw_modifier_extension: Option<&super::super::codec::Value> = None;
4244        let mut raw_translations: Option<&super::super::codec::Value> = None;
4245        let mut raw_translations_element: Option<&super::super::codec::Value> = None;
4246        for (key, value) in object {
4247            match key.as_str() {
4248                "id" => {
4249                    raw_id = Some(value);
4250                }
4251                "extension" => {
4252                    raw_extension = Some(value);
4253                }
4254                "modifierExtension" => {
4255                    raw_modifier_extension = Some(value);
4256                }
4257                "translations" => {
4258                    raw_translations = Some(value);
4259                }
4260                "_translations" => {
4261                    raw_translations_element = Some(value);
4262                }
4263                other => {
4264                    return path.with(other, |path| {
4265                        Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty))
4266                    });
4267                }
4268            }
4269        }
4270        let field_id = raw_id
4271            .map(|value| {
4272                path.with("id", |path| {
4273                    let value = super::super::codec::expect_single(value, path)?;
4274                    super::primitives::checked_string(
4275                        super::super::codec::expect_string(value, path)?,
4276                        path,
4277                    )
4278                })
4279            })
4280            .transpose()?;
4281        let mut field_extension = Vec::new();
4282        if let Some(raw) = raw_extension {
4283            for (index, value) in path
4284                .with("extension", |path| {
4285                    super::super::codec::expect_array(raw, path)
4286                })?
4287                .iter()
4288                .enumerate()
4289            {
4290                field_extension.push(path.with_index("extension", index, |path| {
4291                    super::super::codec::Json::from_json(
4292                        super::super::codec::expect_object(value, path)?,
4293                        path,
4294                    )
4295                })?);
4296            }
4297        }
4298        let mut field_modifier_extension = Vec::new();
4299        if let Some(raw) = raw_modifier_extension {
4300            for (index, value) in path
4301                .with("modifierExtension", |path| {
4302                    super::super::codec::expect_array(raw, path)
4303                })?
4304                .iter()
4305                .enumerate()
4306            {
4307                field_modifier_extension.push(path.with_index(
4308                    "modifierExtension",
4309                    index,
4310                    |path| {
4311                        super::super::codec::Json::from_json(
4312                            super::super::codec::expect_object(value, path)?,
4313                            path,
4314                        )
4315                    },
4316                )?);
4317            }
4318        }
4319        let field_translations = path.with("translations", |path| {
4320            super::super::codec::Primitive::from_json_parts(
4321                raw_translations,
4322                raw_translations_element,
4323                path,
4324            )
4325        })?;
4326        Ok(Self {
4327            id: field_id,
4328            extension: field_extension,
4329            modifier_extension: field_modifier_extension,
4330            translations: field_translations,
4331        })
4332    }
4333}
4334
4335impl serde::Serialize for TerminologyCapabilitiesValidateCode {
4336    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
4337        let mut map = serde::Serializer::serialize_map(serializer, None)?;
4338        super::super::codec::element_entry(&mut map, "_translations", &self.translations)?;
4339        if !self.extension.is_empty() {
4340            serde::ser::SerializeMap::serialize_entry(&mut map, "extension", &self.extension)?;
4341        }
4342        if let Some(v) = &self.id {
4343            serde::ser::SerializeMap::serialize_entry(&mut map, "id", v)?;
4344        }
4345        if !self.modifier_extension.is_empty() {
4346            serde::ser::SerializeMap::serialize_entry(
4347                &mut map,
4348                "modifierExtension",
4349                &self.modifier_extension,
4350            )?;
4351        }
4352        super::super::codec::value_entry(&mut map, "translations", &self.translations)?;
4353        serde::ser::SerializeMap::end(map)
4354    }
4355}
4356
4357impl<'de> serde::Deserialize<'de> for TerminologyCapabilitiesValidateCode {
4358    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
4359        let value = <super::super::codec::Value as serde::Deserialize>::deserialize(deserializer)?;
4360        let mut path = super::super::codec::Path::root("TerminologyCapabilitiesValidateCode");
4361        let object =
4362            super::super::codec::expect_object(&value, &path).map_err(serde::de::Error::custom)?;
4363        super::super::codec::Json::from_json(object, &mut path).map_err(serde::de::Error::custom)
4364    }
4365}
4366
4367/// The \`versionAlgorithm\[x\]\` choice of \`TerminologyCapabilities\`.
4368///
4369/// Indicates the mechanism used to compare versions to determine which is more
4370/// current.
4371#[derive(Debug, Clone, PartialEq, Eq)]
4372pub enum TerminologyCapabilitiesVersionAlgorithm {
4373    /// The `string` form.
4374    String(super::primitives::String),
4375    /// The `Coding` form.
4376    Coding(Box<super::coding::Coding>),
4377}
4378
4379impl TerminologyCapabilitiesVersionAlgorithm {
4380    /// The key suffix, the value part, and the `_name` part of this form.
4381    ///
4382    /// # Errors
4383    ///
4384    /// Returns [`super::super::codec::EncodeError`] when a held value has no JSON form.
4385    pub fn to_json_parts(
4386        &self,
4387    ) -> Result<
4388        (
4389            &'static str,
4390            Option<super::super::codec::Value>,
4391            Option<super::super::codec::Value>,
4392        ),
4393        super::super::codec::EncodeError,
4394    > {
4395        match self {
4396            Self::String(inner) => Ok((
4397                "String",
4398                super::super::codec::Primitive::value_json(inner)?,
4399                super::super::codec::Primitive::element_json(inner)?,
4400            )),
4401            Self::Coding(inner) => Ok((
4402                "Coding",
4403                Some(super::super::codec::Value::Object(
4404                    super::super::codec::Json::to_json(inner.as_ref())?,
4405                )),
4406                None,
4407            )),
4408        }
4409    }
4410
4411    /// Decodes the form named by `suffix` from its value and `_name` parts.
4412    ///
4413    /// # Errors
4414    ///
4415    /// Returns [`super::super::codec::DecodeError`] for an unknown suffix or a malformed part.
4416    pub fn from_json_parts(
4417        suffix: &str,
4418        value: Option<&super::super::codec::Value>,
4419        element: Option<&super::super::codec::Value>,
4420        path: &mut super::super::codec::Path,
4421    ) -> Result<Self, super::super::codec::DecodeError> {
4422        match suffix {
4423            "String" => Ok(Self::String(
4424                super::super::codec::Primitive::from_json_parts(value, element, path)?,
4425            )),
4426            "Coding" => {
4427                if element.is_some() {
4428                    return Err(path.error(super::super::codec::DecodeErrorKind::WrongType {
4429                        expected: "no underscore form for a complex type",
4430                    }));
4431                }
4432                let value = value.ok_or_else(|| {
4433                    path.error(super::super::codec::DecodeErrorKind::MissingProperty)
4434                })?;
4435                let inner = super::super::codec::Json::from_json(
4436                    super::super::codec::expect_object(
4437                        super::super::codec::expect_single(value, path)?,
4438                        path,
4439                    )?,
4440                    path,
4441                )?;
4442                Ok(Self::Coding(Box::new(inner)))
4443            }
4444            _ => Err(path.error(super::super::codec::DecodeErrorKind::UnknownProperty)),
4445        }
4446    }
4447}