Exemple #1
0
        /// <summary>
        /// Deserialize JSON into a FHIR GuidanceResponse
        /// </summary>
        public static void DeserializeJsonProperty(this GuidanceResponse current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "requestIdentifier":
                current.RequestIdentifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.RequestIdentifier).DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"GuidanceResponse error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"GuidanceResponse error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "moduleUri":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Module = new FhirUri();
                    reader.Skip();
                }
                else
                {
                    current.Module = new FhirUri(reader.GetString());
                }
                break;

            case "_moduleUri":
                if (current.Module == null)
                {
                    current.Module = new FhirUri();
                }
                ((Hl7.Fhir.Model.Element)current.Module).DeserializeJson(ref reader, options);
                break;

            case "moduleCanonical":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Module = new Canonical();
                    reader.Skip();
                }
                else
                {
                    current.Module = new Canonical(reader.GetString());
                }
                break;

            case "_moduleCanonical":
                if (current.Module == null)
                {
                    current.Module = new Canonical();
                }
                ((Hl7.Fhir.Model.Element)current.Module).DeserializeJson(ref reader, options);
                break;

            case "moduleCodeableConcept":
                current.Module = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Module).DeserializeJson(ref reader, options);
                break;

            case "status":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus>(reader.GetString()));
                }
                break;

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options);
                break;

            case "subject":
                current.Subject = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Subject).DeserializeJson(ref reader, options);
                break;

            case "encounter":
                current.Encounter = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Encounter).DeserializeJson(ref reader, options);
                break;

            case "occurrenceDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.OccurrenceDateTimeElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.OccurrenceDateTimeElement = new FhirDateTime(reader.GetString());
                }
                break;

            case "_occurrenceDateTime":
                if (current.OccurrenceDateTimeElement == null)
                {
                    current.OccurrenceDateTimeElement = new FhirDateTime();
                }
                ((Hl7.Fhir.Model.Element)current.OccurrenceDateTimeElement).DeserializeJson(ref reader, options);
                break;

            case "performer":
                current.Performer = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Performer).DeserializeJson(ref reader, options);
                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"GuidanceResponse error reading 'reasonCode' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_ReasonCode = new Hl7.Fhir.Model.CodeableConcept();
                    v_ReasonCode.DeserializeJson(ref reader, options);
                    current.ReasonCode.Add(v_ReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException($"GuidanceResponse error reading 'reasonCode' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.ReasonCode.Count == 0)
                {
                    current.ReasonCode = null;
                }
                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"GuidanceResponse error reading 'reasonReference' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.ReasonReference = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_ReasonReference = new Hl7.Fhir.Model.ResourceReference();
                    v_ReasonReference.DeserializeJson(ref reader, options);
                    current.ReasonReference.Add(v_ReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException($"GuidanceResponse error reading 'reasonReference' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.ReasonReference.Count == 0)
                {
                    current.ReasonReference = null;
                }
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"GuidanceResponse error reading 'note' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Annotation v_Note = new Hl7.Fhir.Model.Annotation();
                    v_Note.DeserializeJson(ref reader, options);
                    current.Note.Add(v_Note);

                    if (!reader.Read())
                    {
                        throw new JsonException($"GuidanceResponse error reading 'note' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Note.Count == 0)
                {
                    current.Note = null;
                }
                break;

            case "evaluationMessage":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"GuidanceResponse error reading 'evaluationMessage' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.EvaluationMessage = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_EvaluationMessage = new Hl7.Fhir.Model.ResourceReference();
                    v_EvaluationMessage.DeserializeJson(ref reader, options);
                    current.EvaluationMessage.Add(v_EvaluationMessage);

                    if (!reader.Read())
                    {
                        throw new JsonException($"GuidanceResponse error reading 'evaluationMessage' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.EvaluationMessage.Count == 0)
                {
                    current.EvaluationMessage = null;
                }
                break;

            case "outputParameters":
                current.OutputParameters = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.OutputParameters).DeserializeJson(ref reader, options);
                break;

            case "result":
                current.Result = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Result).DeserializeJson(ref reader, options);
                break;

            case "dataRequirement":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"GuidanceResponse error reading 'dataRequirement' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.DataRequirement = new List <DataRequirement>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DataRequirement v_DataRequirement = new Hl7.Fhir.Model.DataRequirement();
                    v_DataRequirement.DeserializeJson(ref reader, options);
                    current.DataRequirement.Add(v_DataRequirement);

                    if (!reader.Read())
                    {
                        throw new JsonException($"GuidanceResponse error reading 'dataRequirement' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.DataRequirement.Count == 0)
                {
                    current.DataRequirement = null;
                }
                break;

            // Complex: GuidanceResponse, Export: GuidanceResponse, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as ServiceDefinition;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (UrlElement != null)
            {
                dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopy();
            }
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (VersionElement != null)
            {
                dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopy();
            }
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (TitleElement != null)
            {
                dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.PublicationStatus>)StatusElement.DeepCopy();
            }
            if (ExperimentalElement != null)
            {
                dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopy();
            }
            if (DateElement != null)
            {
                dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy();
            }
            if (PublisherElement != null)
            {
                dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopy();
            }
            if (Description != null)
            {
                dest.Description = (Hl7.Fhir.Model.Markdown)Description.DeepCopy();
            }
            if (Purpose != null)
            {
                dest.Purpose = (Hl7.Fhir.Model.Markdown)Purpose.DeepCopy();
            }
            if (UsageElement != null)
            {
                dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopy();
            }
            if (ApprovalDateElement != null)
            {
                dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopy();
            }
            if (LastReviewDateElement != null)
            {
                dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopy();
            }
            if (EffectivePeriod != null)
            {
                dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopy();
            }
            if (UseContext != null)
            {
                dest.UseContext = new List <Hl7.Fhir.Model.UsageContext>(UseContext.DeepCopy());
            }
            if (Jurisdiction != null)
            {
                dest.Jurisdiction = new List <Hl7.Fhir.Model.CodeableConcept>(Jurisdiction.DeepCopy());
            }
            if (Topic != null)
            {
                dest.Topic = new List <Hl7.Fhir.Model.CodeableConcept>(Topic.DeepCopy());
            }
            if (Contributor != null)
            {
                dest.Contributor = new List <Hl7.Fhir.Model.Contributor>(Contributor.DeepCopy());
            }
            if (Contact != null)
            {
                dest.Contact = new List <Hl7.Fhir.Model.ContactDetail>(Contact.DeepCopy());
            }
            if (Copyright != null)
            {
                dest.Copyright = (Hl7.Fhir.Model.Markdown)Copyright.DeepCopy();
            }
            if (RelatedArtifact != null)
            {
                dest.RelatedArtifact = new List <Hl7.Fhir.Model.RelatedArtifact>(RelatedArtifact.DeepCopy());
            }
            if (Trigger != null)
            {
                dest.Trigger = new List <Hl7.Fhir.Model.TriggerDefinition>(Trigger.DeepCopy());
            }
            if (DataRequirement != null)
            {
                dest.DataRequirement = new List <Hl7.Fhir.Model.DataRequirement>(DataRequirement.DeepCopy());
            }
            if (OperationDefinition != null)
            {
                dest.OperationDefinition = (Hl7.Fhir.Model.ResourceReference)OperationDefinition.DeepCopy();
            }
            return(dest);
        }
Exemple #3
0
        /// <summary>
        /// Deserialize JSON into a FHIR Library
        /// </summary>
        public static void DeserializeJsonProperty(this Library current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "url":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.UrlElement = new FhirUri();
                    reader.Skip();
                }
                else
                {
                    current.UrlElement = new FhirUri(reader.GetString());
                }
                break;

            case "_url":
                if (current.UrlElement == null)
                {
                    current.UrlElement = new FhirUri();
                }
                ((Hl7.Fhir.Model.Element)current.UrlElement).DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "version":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.VersionElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.VersionElement = new FhirString(reader.GetString());
                }
                break;

            case "_version":
                if (current.VersionElement == null)
                {
                    current.VersionElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.VersionElement).DeserializeJson(ref reader, options);
                break;

            case "name":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.NameElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.NameElement = new FhirString(reader.GetString());
                }
                break;

            case "_name":
                if (current.NameElement == null)
                {
                    current.NameElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.NameElement).DeserializeJson(ref reader, options);
                break;

            case "title":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.TitleElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.TitleElement = new FhirString(reader.GetString());
                }
                break;

            case "_title":
                if (current.TitleElement == null)
                {
                    current.TitleElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.TitleElement).DeserializeJson(ref reader, options);
                break;

            case "subtitle":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.SubtitleElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.SubtitleElement = new FhirString(reader.GetString());
                }
                break;

            case "_subtitle":
                if (current.SubtitleElement == null)
                {
                    current.SubtitleElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.SubtitleElement).DeserializeJson(ref reader, options);
                break;

            case "status":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.PublicationStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.PublicationStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.PublicationStatus>(reader.GetString()));
                }
                break;

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.PublicationStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options);
                break;

            case "experimental":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.ExperimentalElement = new FhirBoolean();
                    reader.Skip();
                }
                else
                {
                    current.ExperimentalElement = new FhirBoolean(reader.GetBoolean());
                }
                break;

            case "_experimental":
                if (current.ExperimentalElement == null)
                {
                    current.ExperimentalElement = new FhirBoolean();
                }
                ((Hl7.Fhir.Model.Element)current.ExperimentalElement).DeserializeJson(ref reader, options);
                break;

            case "type":
                current.Type = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Type).DeserializeJson(ref reader, options);
                break;

            case "subjectCodeableConcept":
                current.Subject = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Subject).DeserializeJson(ref reader, options);
                break;

            case "subjectReference":
                current.Subject = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Subject).DeserializeJson(ref reader, options);
                break;

            case "date":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DateElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.DateElement = new FhirDateTime(reader.GetString());
                }
                break;

            case "_date":
                if (current.DateElement == null)
                {
                    current.DateElement = new FhirDateTime();
                }
                ((Hl7.Fhir.Model.Element)current.DateElement).DeserializeJson(ref reader, options);
                break;

            case "publisher":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.PublisherElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.PublisherElement = new FhirString(reader.GetString());
                }
                break;

            case "_publisher":
                if (current.PublisherElement == null)
                {
                    current.PublisherElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.PublisherElement).DeserializeJson(ref reader, options);
                break;

            case "contact":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'contact' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Contact = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactDetail v_Contact = new Hl7.Fhir.Model.ContactDetail();
                    v_Contact.DeserializeJson(ref reader, options);
                    current.Contact.Add(v_Contact);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'contact' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Contact.Count == 0)
                {
                    current.Contact = null;
                }
                break;

            case "description":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Description = new Markdown();
                    reader.Skip();
                }
                else
                {
                    current.Description = new Markdown(reader.GetString());
                }
                break;

            case "_description":
                if (current.Description == null)
                {
                    current.Description = new Markdown();
                }
                ((Hl7.Fhir.Model.Element)current.Description).DeserializeJson(ref reader, options);
                break;

            case "useContext":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'useContext' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.UseContext = new List <UsageContext>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.UsageContext v_UseContext = new Hl7.Fhir.Model.UsageContext();
                    v_UseContext.DeserializeJson(ref reader, options);
                    current.UseContext.Add(v_UseContext);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'useContext' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.UseContext.Count == 0)
                {
                    current.UseContext = null;
                }
                break;

            case "jurisdiction":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'jurisdiction' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Jurisdiction = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Jurisdiction = new Hl7.Fhir.Model.CodeableConcept();
                    v_Jurisdiction.DeserializeJson(ref reader, options);
                    current.Jurisdiction.Add(v_Jurisdiction);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'jurisdiction' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Jurisdiction.Count == 0)
                {
                    current.Jurisdiction = null;
                }
                break;

            case "purpose":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Purpose = new Markdown();
                    reader.Skip();
                }
                else
                {
                    current.Purpose = new Markdown(reader.GetString());
                }
                break;

            case "_purpose":
                if (current.Purpose == null)
                {
                    current.Purpose = new Markdown();
                }
                ((Hl7.Fhir.Model.Element)current.Purpose).DeserializeJson(ref reader, options);
                break;

            case "usage":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.UsageElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.UsageElement = new FhirString(reader.GetString());
                }
                break;

            case "_usage":
                if (current.UsageElement == null)
                {
                    current.UsageElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.UsageElement).DeserializeJson(ref reader, options);
                break;

            case "copyright":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Copyright = new Markdown();
                    reader.Skip();
                }
                else
                {
                    current.Copyright = new Markdown(reader.GetString());
                }
                break;

            case "_copyright":
                if (current.Copyright == null)
                {
                    current.Copyright = new Markdown();
                }
                ((Hl7.Fhir.Model.Element)current.Copyright).DeserializeJson(ref reader, options);
                break;

            case "approvalDate":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.ApprovalDateElement = new Date();
                    reader.Skip();
                }
                else
                {
                    current.ApprovalDateElement = new Date(reader.GetString());
                }
                break;

            case "_approvalDate":
                if (current.ApprovalDateElement == null)
                {
                    current.ApprovalDateElement = new Date();
                }
                ((Hl7.Fhir.Model.Element)current.ApprovalDateElement).DeserializeJson(ref reader, options);
                break;

            case "lastReviewDate":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.LastReviewDateElement = new Date();
                    reader.Skip();
                }
                else
                {
                    current.LastReviewDateElement = new Date(reader.GetString());
                }
                break;

            case "_lastReviewDate":
                if (current.LastReviewDateElement == null)
                {
                    current.LastReviewDateElement = new Date();
                }
                ((Hl7.Fhir.Model.Element)current.LastReviewDateElement).DeserializeJson(ref reader, options);
                break;

            case "effectivePeriod":
                current.EffectivePeriod = new Hl7.Fhir.Model.Period();
                ((Hl7.Fhir.Model.Period)current.EffectivePeriod).DeserializeJson(ref reader, options);
                break;

            case "topic":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'topic' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Topic = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Topic = new Hl7.Fhir.Model.CodeableConcept();
                    v_Topic.DeserializeJson(ref reader, options);
                    current.Topic.Add(v_Topic);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'topic' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Topic.Count == 0)
                {
                    current.Topic = null;
                }
                break;

            case "author":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'author' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Author = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactDetail v_Author = new Hl7.Fhir.Model.ContactDetail();
                    v_Author.DeserializeJson(ref reader, options);
                    current.Author.Add(v_Author);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'author' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Author.Count == 0)
                {
                    current.Author = null;
                }
                break;

            case "editor":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'editor' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Editor = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactDetail v_Editor = new Hl7.Fhir.Model.ContactDetail();
                    v_Editor.DeserializeJson(ref reader, options);
                    current.Editor.Add(v_Editor);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'editor' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Editor.Count == 0)
                {
                    current.Editor = null;
                }
                break;

            case "reviewer":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'reviewer' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Reviewer = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactDetail v_Reviewer = new Hl7.Fhir.Model.ContactDetail();
                    v_Reviewer.DeserializeJson(ref reader, options);
                    current.Reviewer.Add(v_Reviewer);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'reviewer' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Reviewer.Count == 0)
                {
                    current.Reviewer = null;
                }
                break;

            case "endorser":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'endorser' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Endorser = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactDetail v_Endorser = new Hl7.Fhir.Model.ContactDetail();
                    v_Endorser.DeserializeJson(ref reader, options);
                    current.Endorser.Add(v_Endorser);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'endorser' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Endorser.Count == 0)
                {
                    current.Endorser = null;
                }
                break;

            case "relatedArtifact":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'relatedArtifact' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.RelatedArtifact = new List <RelatedArtifact>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.RelatedArtifact v_RelatedArtifact = new Hl7.Fhir.Model.RelatedArtifact();
                    v_RelatedArtifact.DeserializeJson(ref reader, options);
                    current.RelatedArtifact.Add(v_RelatedArtifact);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'relatedArtifact' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.RelatedArtifact.Count == 0)
                {
                    current.RelatedArtifact = null;
                }
                break;

            case "parameter":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'parameter' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Parameter = new List <ParameterDefinition>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ParameterDefinition v_Parameter = new Hl7.Fhir.Model.ParameterDefinition();
                    v_Parameter.DeserializeJson(ref reader, options);
                    current.Parameter.Add(v_Parameter);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'parameter' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Parameter.Count == 0)
                {
                    current.Parameter = null;
                }
                break;

            case "dataRequirement":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'dataRequirement' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.DataRequirement = new List <DataRequirement>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DataRequirement v_DataRequirement = new Hl7.Fhir.Model.DataRequirement();
                    v_DataRequirement.DeserializeJson(ref reader, options);
                    current.DataRequirement.Add(v_DataRequirement);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'dataRequirement' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.DataRequirement.Count == 0)
                {
                    current.DataRequirement = null;
                }
                break;

            case "content":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Library error reading 'content' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Content = new List <Attachment>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Attachment v_Content = new Hl7.Fhir.Model.Attachment();
                    v_Content.DeserializeJson(ref reader, options);
                    current.Content.Add(v_Content);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Library error reading 'content' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Content.Count == 0)
                {
                    current.Content = null;
                }
                break;

            // Complex: Library, Export: Library, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }