/// <summary> /// Deserialize JSON into a FHIR CommunicationRequest /// </summary> public static void DeserializeJsonProperty(this CommunicationRequest current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CommunicationRequest 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($"CommunicationRequest 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 "basedOn": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CommunicationRequest error reading 'basedOn' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.BasedOn = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_BasedOn = new Hl7.Fhir.Model.ResourceReference(); v_BasedOn.DeserializeJson(ref reader, options); current.BasedOn.Add(v_BasedOn); if (!reader.Read()) { throw new JsonException($"CommunicationRequest error reading 'basedOn' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.BasedOn.Count == 0) { current.BasedOn = null; } break; case "replaces": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CommunicationRequest error reading 'replaces' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Replaces = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Replaces = new Hl7.Fhir.Model.ResourceReference(); v_Replaces.DeserializeJson(ref reader, options); current.Replaces.Add(v_Replaces); if (!reader.Read()) { throw new JsonException($"CommunicationRequest error reading 'replaces' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Replaces.Count == 0) { current.Replaces = null; } break; case "groupIdentifier": current.GroupIdentifier = new Hl7.Fhir.Model.Identifier(); ((Hl7.Fhir.Model.Identifier)current.GroupIdentifier).DeserializeJson(ref reader, options); break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.RequestStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.RequestStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.RequestStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.RequestStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "statusReason": current.StatusReason = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.StatusReason).DeserializeJson(ref reader, options); break; case "category": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CommunicationRequest error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Category = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Category = new Hl7.Fhir.Model.CodeableConcept(); v_Category.DeserializeJson(ref reader, options); current.Category.Add(v_Category); if (!reader.Read()) { throw new JsonException($"CommunicationRequest error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Category.Count == 0) { current.Category = null; } break; case "priority": if (reader.TokenType == JsonTokenType.Null) { current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(); reader.Skip(); } else { current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.RequestPriority>(reader.GetString())); } break; case "_priority": if (current.PriorityElement == null) { current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(); } ((Hl7.Fhir.Model.Element)current.PriorityElement).DeserializeJson(ref reader, options); break; case "doNotPerform": if (reader.TokenType == JsonTokenType.Null) { current.DoNotPerformElement = new FhirBoolean(); reader.Skip(); } else { current.DoNotPerformElement = new FhirBoolean(reader.GetBoolean()); } break; case "_doNotPerform": if (current.DoNotPerformElement == null) { current.DoNotPerformElement = new FhirBoolean(); } ((Hl7.Fhir.Model.Element)current.DoNotPerformElement).DeserializeJson(ref reader, options); break; case "medium": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CommunicationRequest error reading 'medium' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Medium = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Medium = new Hl7.Fhir.Model.CodeableConcept(); v_Medium.DeserializeJson(ref reader, options); current.Medium.Add(v_Medium); if (!reader.Read()) { throw new JsonException($"CommunicationRequest error reading 'medium' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Medium.Count == 0) { current.Medium = null; } break; case "subject": current.Subject = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Subject).DeserializeJson(ref reader, options); break; case "about": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CommunicationRequest error reading 'about' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.About = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_About = new Hl7.Fhir.Model.ResourceReference(); v_About.DeserializeJson(ref reader, options); current.About.Add(v_About); if (!reader.Read()) { throw new JsonException($"CommunicationRequest error reading 'about' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.About.Count == 0) { current.About = null; } break; case "encounter": current.Encounter = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Encounter).DeserializeJson(ref reader, options); break; case "payload": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CommunicationRequest error reading 'payload' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Payload = new List <CommunicationRequest.PayloadComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CommunicationRequest.PayloadComponent v_Payload = new Hl7.Fhir.Model.CommunicationRequest.PayloadComponent(); v_Payload.DeserializeJson(ref reader, options); current.Payload.Add(v_Payload); if (!reader.Read()) { throw new JsonException($"CommunicationRequest error reading 'payload' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Payload.Count == 0) { current.Payload = null; } break; case "occurrenceDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Occurrence = new FhirDateTime(); reader.Skip(); } else { current.Occurrence = new FhirDateTime(reader.GetString()); } break; case "_occurrenceDateTime": if (current.Occurrence == null) { current.Occurrence = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Occurrence).DeserializeJson(ref reader, options); break; case "occurrencePeriod": current.Occurrence = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Occurrence).DeserializeJson(ref reader, options); break; case "authoredOn": if (reader.TokenType == JsonTokenType.Null) { current.AuthoredOnElement = new FhirDateTime(); reader.Skip(); } else { current.AuthoredOnElement = new FhirDateTime(reader.GetString()); } break; case "_authoredOn": if (current.AuthoredOnElement == null) { current.AuthoredOnElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.AuthoredOnElement).DeserializeJson(ref reader, options); break; case "requester": current.Requester = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Requester).DeserializeJson(ref reader, options); break; case "recipient": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CommunicationRequest error reading 'recipient' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Recipient = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Recipient = new Hl7.Fhir.Model.ResourceReference(); v_Recipient.DeserializeJson(ref reader, options); current.Recipient.Add(v_Recipient); if (!reader.Read()) { throw new JsonException($"CommunicationRequest error reading 'recipient' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Recipient.Count == 0) { current.Recipient = null; } break; case "sender": current.Sender = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Sender).DeserializeJson(ref reader, options); break; case "reasonCode": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CommunicationRequest 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($"CommunicationRequest 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($"CommunicationRequest 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($"CommunicationRequest 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($"CommunicationRequest 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($"CommunicationRequest 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; // Complex: CommunicationRequest, Export: CommunicationRequest, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR RiskAssessment /// </summary> public static void DeserializeJsonProperty(this RiskAssessment current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"RiskAssessment 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($"RiskAssessment 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 "basedOn": current.BasedOn = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.BasedOn).DeserializeJson(ref reader, options); break; case "parent": current.Parent = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Parent).DeserializeJson(ref reader, options); break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.ObservationStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.ObservationStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.ObservationStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.ObservationStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "method": current.Method = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Method).DeserializeJson(ref reader, options); break; case "code": current.Code = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Code).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.Occurrence = new FhirDateTime(); reader.Skip(); } else { current.Occurrence = new FhirDateTime(reader.GetString()); } break; case "_occurrenceDateTime": if (current.Occurrence == null) { current.Occurrence = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Occurrence).DeserializeJson(ref reader, options); break; case "occurrencePeriod": current.Occurrence = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Occurrence).DeserializeJson(ref reader, options); break; case "condition": current.Condition = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Condition).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($"RiskAssessment 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($"RiskAssessment 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($"RiskAssessment 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($"RiskAssessment 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 "basis": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"RiskAssessment error reading 'basis' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Basis = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Basis = new Hl7.Fhir.Model.ResourceReference(); v_Basis.DeserializeJson(ref reader, options); current.Basis.Add(v_Basis); if (!reader.Read()) { throw new JsonException($"RiskAssessment error reading 'basis' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Basis.Count == 0) { current.Basis = null; } break; case "prediction": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"RiskAssessment error reading 'prediction' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Prediction = new List <RiskAssessment.PredictionComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.RiskAssessment.PredictionComponent v_Prediction = new Hl7.Fhir.Model.RiskAssessment.PredictionComponent(); v_Prediction.DeserializeJson(ref reader, options); current.Prediction.Add(v_Prediction); if (!reader.Read()) { throw new JsonException($"RiskAssessment error reading 'prediction' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Prediction.Count == 0) { current.Prediction = null; } break; case "mitigation": if (reader.TokenType == JsonTokenType.Null) { current.MitigationElement = new FhirString(); reader.Skip(); } else { current.MitigationElement = new FhirString(reader.GetString()); } break; case "_mitigation": if (current.MitigationElement == null) { current.MitigationElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.MitigationElement).DeserializeJson(ref reader, options); break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"RiskAssessment 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($"RiskAssessment 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; // Complex: RiskAssessment, Export: RiskAssessment, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR FamilyMemberHistory /// </summary> public static void DeserializeJsonProperty(this FamilyMemberHistory current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"FamilyMemberHistory 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($"FamilyMemberHistory 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 "instantiatesCanonical": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"FamilyMemberHistory error reading 'instantiatesCanonical' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.InstantiatesCanonicalElement = new List <Canonical>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.InstantiatesCanonicalElement.Add(new Canonical()); reader.Skip(); } else { current.InstantiatesCanonicalElement.Add(new Canonical(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"FamilyMemberHistory error reading 'instantiatesCanonical' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.InstantiatesCanonicalElement.Count == 0) { current.InstantiatesCanonicalElement = null; } break; case "_instantiatesCanonical": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"FamilyMemberHistory error reading 'instantiatesCanonical' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_instantiatesCanonical = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_instantiatesCanonical >= current.InstantiatesCanonicalElement.Count) { current.InstantiatesCanonicalElement.Add(new Canonical()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.InstantiatesCanonicalElement[i_instantiatesCanonical++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"FamilyMemberHistory error reading 'instantiatesCanonical' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "instantiatesUri": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"FamilyMemberHistory error reading 'instantiatesUri' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.InstantiatesUriElement = new List <FhirUri>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.InstantiatesUriElement.Add(new FhirUri()); reader.Skip(); } else { current.InstantiatesUriElement.Add(new FhirUri(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"FamilyMemberHistory error reading 'instantiatesUri' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.InstantiatesUriElement.Count == 0) { current.InstantiatesUriElement = null; } break; case "_instantiatesUri": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"FamilyMemberHistory error reading 'instantiatesUri' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_instantiatesUri = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_instantiatesUri >= current.InstantiatesUriElement.Count) { current.InstantiatesUriElement.Add(new FhirUri()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.InstantiatesUriElement[i_instantiatesUri++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"FamilyMemberHistory error reading 'instantiatesUri' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "dataAbsentReason": current.DataAbsentReason = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.DataAbsentReason).DeserializeJson(ref reader, options); break; case "patient": current.Patient = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Patient).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 "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 "relationship": current.Relationship = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Relationship).DeserializeJson(ref reader, options); break; case "sex": current.Sex = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Sex).DeserializeJson(ref reader, options); break; case "bornPeriod": current.Born = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Born).DeserializeJson(ref reader, options); break; case "bornDate": if (reader.TokenType == JsonTokenType.Null) { current.Born = new Date(); reader.Skip(); } else { current.Born = new Date(reader.GetString()); } break; case "_bornDate": if (current.Born == null) { current.Born = new Date(); } ((Hl7.Fhir.Model.Element)current.Born).DeserializeJson(ref reader, options); break; case "bornString": if (reader.TokenType == JsonTokenType.Null) { current.Born = new FhirString(); reader.Skip(); } else { current.Born = new FhirString(reader.GetString()); } break; case "_bornString": if (current.Born == null) { current.Born = new FhirString(); } ((Hl7.Fhir.Model.Element)current.Born).DeserializeJson(ref reader, options); break; case "ageAge": current.Age = new Hl7.Fhir.Model.Age(); ((Hl7.Fhir.Model.Age)current.Age).DeserializeJson(ref reader, options); break; case "ageRange": current.Age = new Hl7.Fhir.Model.Range(); ((Hl7.Fhir.Model.Range)current.Age).DeserializeJson(ref reader, options); break; case "ageString": if (reader.TokenType == JsonTokenType.Null) { current.Age = new FhirString(); reader.Skip(); } else { current.Age = new FhirString(reader.GetString()); } break; case "_ageString": if (current.Age == null) { current.Age = new FhirString(); } ((Hl7.Fhir.Model.Element)current.Age).DeserializeJson(ref reader, options); break; case "estimatedAge": if (reader.TokenType == JsonTokenType.Null) { current.EstimatedAgeElement = new FhirBoolean(); reader.Skip(); } else { current.EstimatedAgeElement = new FhirBoolean(reader.GetBoolean()); } break; case "_estimatedAge": if (current.EstimatedAgeElement == null) { current.EstimatedAgeElement = new FhirBoolean(); } ((Hl7.Fhir.Model.Element)current.EstimatedAgeElement).DeserializeJson(ref reader, options); break; case "deceasedBoolean": if (reader.TokenType == JsonTokenType.Null) { current.Deceased = new FhirBoolean(); reader.Skip(); } else { current.Deceased = new FhirBoolean(reader.GetBoolean()); } break; case "_deceasedBoolean": if (current.Deceased == null) { current.Deceased = new FhirBoolean(); } ((Hl7.Fhir.Model.Element)current.Deceased).DeserializeJson(ref reader, options); break; case "deceasedAge": current.Deceased = new Hl7.Fhir.Model.Age(); ((Hl7.Fhir.Model.Age)current.Deceased).DeserializeJson(ref reader, options); break; case "deceasedRange": current.Deceased = new Hl7.Fhir.Model.Range(); ((Hl7.Fhir.Model.Range)current.Deceased).DeserializeJson(ref reader, options); break; case "deceasedDate": if (reader.TokenType == JsonTokenType.Null) { current.Deceased = new Date(); reader.Skip(); } else { current.Deceased = new Date(reader.GetString()); } break; case "_deceasedDate": if (current.Deceased == null) { current.Deceased = new Date(); } ((Hl7.Fhir.Model.Element)current.Deceased).DeserializeJson(ref reader, options); break; case "deceasedString": if (reader.TokenType == JsonTokenType.Null) { current.Deceased = new FhirString(); reader.Skip(); } else { current.Deceased = new FhirString(reader.GetString()); } break; case "_deceasedString": if (current.Deceased == null) { current.Deceased = new FhirString(); } ((Hl7.Fhir.Model.Element)current.Deceased).DeserializeJson(ref reader, options); break; case "reasonCode": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"FamilyMemberHistory 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($"FamilyMemberHistory 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($"FamilyMemberHistory 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($"FamilyMemberHistory 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($"FamilyMemberHistory 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($"FamilyMemberHistory 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 "condition": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"FamilyMemberHistory error reading 'condition' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Condition = new List <FamilyMemberHistory.ConditionComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.FamilyMemberHistory.ConditionComponent v_Condition = new Hl7.Fhir.Model.FamilyMemberHistory.ConditionComponent(); v_Condition.DeserializeJson(ref reader, options); current.Condition.Add(v_Condition); if (!reader.Read()) { throw new JsonException($"FamilyMemberHistory error reading 'condition' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Condition.Count == 0) { current.Condition = null; } break; // Complex: FamilyMemberHistory, Export: FamilyMemberHistory, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR ClinicalImpression /// </summary> public static void DeserializeJsonProperty(this ClinicalImpression current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression 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($"ClinicalImpression 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 "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "statusReason": current.StatusReason = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.StatusReason).DeserializeJson(ref reader, options); break; case "code": current.Code = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Code).DeserializeJson(ref reader, options); break; case "description": if (reader.TokenType == JsonTokenType.Null) { current.DescriptionElement = new FhirString(); reader.Skip(); } else { current.DescriptionElement = new FhirString(reader.GetString()); } break; case "_description": if (current.DescriptionElement == null) { current.DescriptionElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.DescriptionElement).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 "effectiveDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Effective = new FhirDateTime(); reader.Skip(); } else { current.Effective = new FhirDateTime(reader.GetString()); } break; case "_effectiveDateTime": if (current.Effective == null) { current.Effective = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Effective).DeserializeJson(ref reader, options); break; case "effectivePeriod": current.Effective = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Effective).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 "assessor": current.Assessor = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Assessor).DeserializeJson(ref reader, options); break; case "previous": current.Previous = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Previous).DeserializeJson(ref reader, options); break; case "problem": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression error reading 'problem' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Problem = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Problem = new Hl7.Fhir.Model.ResourceReference(); v_Problem.DeserializeJson(ref reader, options); current.Problem.Add(v_Problem); if (!reader.Read()) { throw new JsonException($"ClinicalImpression error reading 'problem' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Problem.Count == 0) { current.Problem = null; } break; case "investigation": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression error reading 'investigation' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Investigation = new List <ClinicalImpression.InvestigationComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ClinicalImpression.InvestigationComponent v_Investigation = new Hl7.Fhir.Model.ClinicalImpression.InvestigationComponent(); v_Investigation.DeserializeJson(ref reader, options); current.Investigation.Add(v_Investigation); if (!reader.Read()) { throw new JsonException($"ClinicalImpression error reading 'investigation' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Investigation.Count == 0) { current.Investigation = null; } break; case "protocol": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression error reading 'protocol' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.ProtocolElement = new List <FhirUri>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.ProtocolElement.Add(new FhirUri()); reader.Skip(); } else { current.ProtocolElement.Add(new FhirUri(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"ClinicalImpression error reading 'protocol' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.ProtocolElement.Count == 0) { current.ProtocolElement = null; } break; case "_protocol": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression error reading 'protocol' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_protocol = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_protocol >= current.ProtocolElement.Count) { current.ProtocolElement.Add(new FhirUri()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.ProtocolElement[i_protocol++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"ClinicalImpression error reading 'protocol' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "summary": if (reader.TokenType == JsonTokenType.Null) { current.SummaryElement = new FhirString(); reader.Skip(); } else { current.SummaryElement = new FhirString(reader.GetString()); } break; case "_summary": if (current.SummaryElement == null) { current.SummaryElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.SummaryElement).DeserializeJson(ref reader, options); break; case "finding": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression error reading 'finding' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Finding = new List <ClinicalImpression.FindingComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ClinicalImpression.FindingComponent v_Finding = new Hl7.Fhir.Model.ClinicalImpression.FindingComponent(); v_Finding.DeserializeJson(ref reader, options); current.Finding.Add(v_Finding); if (!reader.Read()) { throw new JsonException($"ClinicalImpression error reading 'finding' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Finding.Count == 0) { current.Finding = null; } break; case "prognosisCodeableConcept": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression error reading 'prognosisCodeableConcept' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PrognosisCodeableConcept = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_PrognosisCodeableConcept = new Hl7.Fhir.Model.CodeableConcept(); v_PrognosisCodeableConcept.DeserializeJson(ref reader, options); current.PrognosisCodeableConcept.Add(v_PrognosisCodeableConcept); if (!reader.Read()) { throw new JsonException($"ClinicalImpression error reading 'prognosisCodeableConcept' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PrognosisCodeableConcept.Count == 0) { current.PrognosisCodeableConcept = null; } break; case "prognosisReference": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression error reading 'prognosisReference' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PrognosisReference = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_PrognosisReference = new Hl7.Fhir.Model.ResourceReference(); v_PrognosisReference.DeserializeJson(ref reader, options); current.PrognosisReference.Add(v_PrognosisReference); if (!reader.Read()) { throw new JsonException($"ClinicalImpression error reading 'prognosisReference' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PrognosisReference.Count == 0) { current.PrognosisReference = null; } break; case "supportingInfo": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression error reading 'supportingInfo' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.SupportingInfo = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_SupportingInfo = new Hl7.Fhir.Model.ResourceReference(); v_SupportingInfo.DeserializeJson(ref reader, options); current.SupportingInfo.Add(v_SupportingInfo); if (!reader.Read()) { throw new JsonException($"ClinicalImpression error reading 'supportingInfo' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.SupportingInfo.Count == 0) { current.SupportingInfo = null; } break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ClinicalImpression 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($"ClinicalImpression 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; // Complex: ClinicalImpression, Export: ClinicalImpression, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR Media /// </summary> public static void DeserializeJsonProperty(this Media current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Media 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($"Media 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 "basedOn": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Media error reading 'basedOn' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.BasedOn = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_BasedOn = new Hl7.Fhir.Model.ResourceReference(); v_BasedOn.DeserializeJson(ref reader, options); current.BasedOn.Add(v_BasedOn); if (!reader.Read()) { throw new JsonException($"Media error reading 'basedOn' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.BasedOn.Count == 0) { current.BasedOn = null; } break; case "partOf": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Media error reading 'partOf' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PartOf = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_PartOf = new Hl7.Fhir.Model.ResourceReference(); v_PartOf.DeserializeJson(ref reader, options); current.PartOf.Add(v_PartOf); if (!reader.Read()) { throw new JsonException($"Media error reading 'partOf' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PartOf.Count == 0) { current.PartOf = null; } break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.EventStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.EventStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.EventStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.EventStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).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 "modality": current.Modality = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Modality).DeserializeJson(ref reader, options); break; case "view": current.View = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.View).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 "createdDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Created = new FhirDateTime(); reader.Skip(); } else { current.Created = new FhirDateTime(reader.GetString()); } break; case "_createdDateTime": if (current.Created == null) { current.Created = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Created).DeserializeJson(ref reader, options); break; case "createdPeriod": current.Created = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Created).DeserializeJson(ref reader, options); break; case "issued": if (reader.TokenType == JsonTokenType.Null) { current.IssuedElement = new Instant(); reader.Skip(); } else { current.IssuedElement = new Instant(DateTimeOffset.Parse(reader.GetString())); } break; case "_issued": if (current.IssuedElement == null) { current.IssuedElement = new Instant(); } ((Hl7.Fhir.Model.Element)current.IssuedElement).DeserializeJson(ref reader, options); break; case "operator": current.Operator = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Operator).DeserializeJson(ref reader, options); break; case "reasonCode": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Media 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($"Media 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 "bodySite": current.BodySite = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.BodySite).DeserializeJson(ref reader, options); break; case "deviceName": if (reader.TokenType == JsonTokenType.Null) { current.DeviceNameElement = new FhirString(); reader.Skip(); } else { current.DeviceNameElement = new FhirString(reader.GetString()); } break; case "_deviceName": if (current.DeviceNameElement == null) { current.DeviceNameElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.DeviceNameElement).DeserializeJson(ref reader, options); break; case "device": current.Device = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Device).DeserializeJson(ref reader, options); break; case "height": if (reader.TokenType == JsonTokenType.Null) { current.HeightElement = new PositiveInt(); reader.Skip(); } else { current.HeightElement = new PositiveInt(reader.GetInt32()); } break; case "_height": if (current.HeightElement == null) { current.HeightElement = new PositiveInt(); } ((Hl7.Fhir.Model.Element)current.HeightElement).DeserializeJson(ref reader, options); break; case "width": if (reader.TokenType == JsonTokenType.Null) { current.WidthElement = new PositiveInt(); reader.Skip(); } else { current.WidthElement = new PositiveInt(reader.GetInt32()); } break; case "_width": if (current.WidthElement == null) { current.WidthElement = new PositiveInt(); } ((Hl7.Fhir.Model.Element)current.WidthElement).DeserializeJson(ref reader, options); break; case "frames": if (reader.TokenType == JsonTokenType.Null) { current.FramesElement = new PositiveInt(); reader.Skip(); } else { current.FramesElement = new PositiveInt(reader.GetInt32()); } break; case "_frames": if (current.FramesElement == null) { current.FramesElement = new PositiveInt(); } ((Hl7.Fhir.Model.Element)current.FramesElement).DeserializeJson(ref reader, options); break; case "duration": if (reader.TokenType == JsonTokenType.Null) { current.DurationElement = new FhirDecimal(); reader.Skip(); } else { current.DurationElement = new FhirDecimal(reader.GetDecimal()); } break; case "_duration": if (current.DurationElement == null) { current.DurationElement = new FhirDecimal(); } ((Hl7.Fhir.Model.Element)current.DurationElement).DeserializeJson(ref reader, options); break; case "content": current.Content = new Hl7.Fhir.Model.Attachment(); ((Hl7.Fhir.Model.Attachment)current.Content).DeserializeJson(ref reader, options); break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Media 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($"Media 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; // Complex: Media, Export: Media, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <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; } }
/// <summary> /// Deserialize JSON into a FHIR Condition /// </summary> public static void DeserializeJsonProperty(this Condition current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Condition 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($"Condition 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 "clinicalStatus": current.ClinicalStatus = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.ClinicalStatus).DeserializeJson(ref reader, options); break; case "verificationStatus": current.VerificationStatus = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.VerificationStatus).DeserializeJson(ref reader, options); break; case "category": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Condition error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Category = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Category = new Hl7.Fhir.Model.CodeableConcept(); v_Category.DeserializeJson(ref reader, options); current.Category.Add(v_Category); if (!reader.Read()) { throw new JsonException($"Condition error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Category.Count == 0) { current.Category = null; } break; case "severity": current.Severity = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Severity).DeserializeJson(ref reader, options); break; case "code": current.Code = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Code).DeserializeJson(ref reader, options); break; case "bodySite": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Condition error reading 'bodySite' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.BodySite = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_BodySite = new Hl7.Fhir.Model.CodeableConcept(); v_BodySite.DeserializeJson(ref reader, options); current.BodySite.Add(v_BodySite); if (!reader.Read()) { throw new JsonException($"Condition error reading 'bodySite' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.BodySite.Count == 0) { current.BodySite = null; } 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 "onsetDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Onset = new FhirDateTime(); reader.Skip(); } else { current.Onset = new FhirDateTime(reader.GetString()); } break; case "_onsetDateTime": if (current.Onset == null) { current.Onset = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Onset).DeserializeJson(ref reader, options); break; case "onsetAge": current.Onset = new Hl7.Fhir.Model.Age(); ((Hl7.Fhir.Model.Age)current.Onset).DeserializeJson(ref reader, options); break; case "onsetPeriod": current.Onset = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Onset).DeserializeJson(ref reader, options); break; case "onsetRange": current.Onset = new Hl7.Fhir.Model.Range(); ((Hl7.Fhir.Model.Range)current.Onset).DeserializeJson(ref reader, options); break; case "onsetString": if (reader.TokenType == JsonTokenType.Null) { current.Onset = new FhirString(); reader.Skip(); } else { current.Onset = new FhirString(reader.GetString()); } break; case "_onsetString": if (current.Onset == null) { current.Onset = new FhirString(); } ((Hl7.Fhir.Model.Element)current.Onset).DeserializeJson(ref reader, options); break; case "abatementDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Abatement = new FhirDateTime(); reader.Skip(); } else { current.Abatement = new FhirDateTime(reader.GetString()); } break; case "_abatementDateTime": if (current.Abatement == null) { current.Abatement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Abatement).DeserializeJson(ref reader, options); break; case "abatementAge": current.Abatement = new Hl7.Fhir.Model.Age(); ((Hl7.Fhir.Model.Age)current.Abatement).DeserializeJson(ref reader, options); break; case "abatementPeriod": current.Abatement = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Abatement).DeserializeJson(ref reader, options); break; case "abatementRange": current.Abatement = new Hl7.Fhir.Model.Range(); ((Hl7.Fhir.Model.Range)current.Abatement).DeserializeJson(ref reader, options); break; case "abatementString": if (reader.TokenType == JsonTokenType.Null) { current.Abatement = new FhirString(); reader.Skip(); } else { current.Abatement = new FhirString(reader.GetString()); } break; case "_abatementString": if (current.Abatement == null) { current.Abatement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.Abatement).DeserializeJson(ref reader, options); break; case "recordedDate": if (reader.TokenType == JsonTokenType.Null) { current.RecordedDateElement = new FhirDateTime(); reader.Skip(); } else { current.RecordedDateElement = new FhirDateTime(reader.GetString()); } break; case "_recordedDate": if (current.RecordedDateElement == null) { current.RecordedDateElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.RecordedDateElement).DeserializeJson(ref reader, options); break; case "recorder": current.Recorder = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Recorder).DeserializeJson(ref reader, options); break; case "asserter": current.Asserter = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Asserter).DeserializeJson(ref reader, options); break; case "stage": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Condition error reading 'stage' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Stage = new List <Condition.StageComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Condition.StageComponent v_Stage = new Hl7.Fhir.Model.Condition.StageComponent(); v_Stage.DeserializeJson(ref reader, options); current.Stage.Add(v_Stage); if (!reader.Read()) { throw new JsonException($"Condition error reading 'stage' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Stage.Count == 0) { current.Stage = null; } break; case "evidence": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Condition error reading 'evidence' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Evidence = new List <Condition.EvidenceComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Condition.EvidenceComponent v_Evidence = new Hl7.Fhir.Model.Condition.EvidenceComponent(); v_Evidence.DeserializeJson(ref reader, options); current.Evidence.Add(v_Evidence); if (!reader.Read()) { throw new JsonException($"Condition error reading 'evidence' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Evidence.Count == 0) { current.Evidence = null; } break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Condition 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($"Condition 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; // Complex: Condition, Export: Condition, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR Goal /// </summary> public static void DeserializeJsonProperty(this Goal current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Goal 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($"Goal 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 "lifecycleStatus": if (reader.TokenType == JsonTokenType.Null) { current.LifecycleStatusElement = new Code <Hl7.Fhir.Model.Goal.GoalLifecycleStatus>(); reader.Skip(); } else { current.LifecycleStatusElement = new Code <Hl7.Fhir.Model.Goal.GoalLifecycleStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.Goal.GoalLifecycleStatus>(reader.GetString())); } break; case "_lifecycleStatus": if (current.LifecycleStatusElement == null) { current.LifecycleStatusElement = new Code <Hl7.Fhir.Model.Goal.GoalLifecycleStatus>(); } ((Hl7.Fhir.Model.Element)current.LifecycleStatusElement).DeserializeJson(ref reader, options); break; case "achievementStatus": current.AchievementStatus = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.AchievementStatus).DeserializeJson(ref reader, options); break; case "category": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Goal error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Category = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Category = new Hl7.Fhir.Model.CodeableConcept(); v_Category.DeserializeJson(ref reader, options); current.Category.Add(v_Category); if (!reader.Read()) { throw new JsonException($"Goal error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Category.Count == 0) { current.Category = null; } break; case "priority": current.Priority = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Priority).DeserializeJson(ref reader, options); break; case "description": current.Description = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Description).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 "startDate": if (reader.TokenType == JsonTokenType.Null) { current.Start = new Date(); reader.Skip(); } else { current.Start = new Date(reader.GetString()); } break; case "_startDate": if (current.Start == null) { current.Start = new Date(); } ((Hl7.Fhir.Model.Element)current.Start).DeserializeJson(ref reader, options); break; case "startCodeableConcept": current.Start = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Start).DeserializeJson(ref reader, options); break; case "target": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Goal error reading 'target' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Target = new List <Goal.TargetComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Goal.TargetComponent v_Target = new Hl7.Fhir.Model.Goal.TargetComponent(); v_Target.DeserializeJson(ref reader, options); current.Target.Add(v_Target); if (!reader.Read()) { throw new JsonException($"Goal error reading 'target' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Target.Count == 0) { current.Target = null; } break; case "statusDate": if (reader.TokenType == JsonTokenType.Null) { current.StatusDateElement = new Date(); reader.Skip(); } else { current.StatusDateElement = new Date(reader.GetString()); } break; case "_statusDate": if (current.StatusDateElement == null) { current.StatusDateElement = new Date(); } ((Hl7.Fhir.Model.Element)current.StatusDateElement).DeserializeJson(ref reader, options); break; case "statusReason": if (reader.TokenType == JsonTokenType.Null) { current.StatusReasonElement = new FhirString(); reader.Skip(); } else { current.StatusReasonElement = new FhirString(reader.GetString()); } break; case "_statusReason": if (current.StatusReasonElement == null) { current.StatusReasonElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.StatusReasonElement).DeserializeJson(ref reader, options); break; case "expressedBy": current.ExpressedBy = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.ExpressedBy).DeserializeJson(ref reader, options); break; case "addresses": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Goal error reading 'addresses' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Addresses = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Addresses = new Hl7.Fhir.Model.ResourceReference(); v_Addresses.DeserializeJson(ref reader, options); current.Addresses.Add(v_Addresses); if (!reader.Read()) { throw new JsonException($"Goal error reading 'addresses' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Addresses.Count == 0) { current.Addresses = null; } break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Goal 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($"Goal 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 "outcomeCode": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Goal error reading 'outcomeCode' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.OutcomeCode = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_OutcomeCode = new Hl7.Fhir.Model.CodeableConcept(); v_OutcomeCode.DeserializeJson(ref reader, options); current.OutcomeCode.Add(v_OutcomeCode); if (!reader.Read()) { throw new JsonException($"Goal error reading 'outcomeCode' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.OutcomeCode.Count == 0) { current.OutcomeCode = null; } break; case "outcomeReference": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Goal error reading 'outcomeReference' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.OutcomeReference = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_OutcomeReference = new Hl7.Fhir.Model.ResourceReference(); v_OutcomeReference.DeserializeJson(ref reader, options); current.OutcomeReference.Add(v_OutcomeReference); if (!reader.Read()) { throw new JsonException($"Goal error reading 'outcomeReference' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.OutcomeReference.Count == 0) { current.OutcomeReference = null; } break; // Complex: Goal, Export: Goal, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR MedicationAdministration /// </summary> public static void DeserializeJsonProperty(this MedicationAdministration current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration 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($"MedicationAdministration 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 "instantiates": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration error reading 'instantiates' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.InstantiatesElement = new List <FhirUri>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.InstantiatesElement.Add(new FhirUri()); reader.Skip(); } else { current.InstantiatesElement.Add(new FhirUri(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"MedicationAdministration error reading 'instantiates' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.InstantiatesElement.Count == 0) { current.InstantiatesElement = null; } break; case "_instantiates": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration error reading 'instantiates' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_instantiates = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_instantiates >= current.InstantiatesElement.Count) { current.InstantiatesElement.Add(new FhirUri()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.InstantiatesElement[i_instantiates++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"MedicationAdministration error reading 'instantiates' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "partOf": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration error reading 'partOf' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PartOf = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_PartOf = new Hl7.Fhir.Model.ResourceReference(); v_PartOf.DeserializeJson(ref reader, options); current.PartOf.Add(v_PartOf); if (!reader.Read()) { throw new JsonException($"MedicationAdministration error reading 'partOf' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PartOf.Count == 0) { current.PartOf = null; } break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCodes>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCodes>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCodes>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCodes>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "statusReason": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration error reading 'statusReason' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.StatusReason = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_StatusReason = new Hl7.Fhir.Model.CodeableConcept(); v_StatusReason.DeserializeJson(ref reader, options); current.StatusReason.Add(v_StatusReason); if (!reader.Read()) { throw new JsonException($"MedicationAdministration error reading 'statusReason' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.StatusReason.Count == 0) { current.StatusReason = null; } break; case "category": current.Category = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Category).DeserializeJson(ref reader, options); break; case "medicationCodeableConcept": current.Medication = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Medication).DeserializeJson(ref reader, options); break; case "medicationReference": current.Medication = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Medication).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 "context": current.Context = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Context).DeserializeJson(ref reader, options); break; case "supportingInformation": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration error reading 'supportingInformation' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.SupportingInformation = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_SupportingInformation = new Hl7.Fhir.Model.ResourceReference(); v_SupportingInformation.DeserializeJson(ref reader, options); current.SupportingInformation.Add(v_SupportingInformation); if (!reader.Read()) { throw new JsonException($"MedicationAdministration error reading 'supportingInformation' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.SupportingInformation.Count == 0) { current.SupportingInformation = null; } break; case "effectiveDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Effective = new FhirDateTime(); reader.Skip(); } else { current.Effective = new FhirDateTime(reader.GetString()); } break; case "_effectiveDateTime": if (current.Effective == null) { current.Effective = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Effective).DeserializeJson(ref reader, options); break; case "effectivePeriod": current.Effective = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Effective).DeserializeJson(ref reader, options); break; case "performer": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration error reading 'performer' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Performer = new List <MedicationAdministration.PerformerComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.MedicationAdministration.PerformerComponent v_Performer = new Hl7.Fhir.Model.MedicationAdministration.PerformerComponent(); v_Performer.DeserializeJson(ref reader, options); current.Performer.Add(v_Performer); if (!reader.Read()) { throw new JsonException($"MedicationAdministration error reading 'performer' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Performer.Count == 0) { current.Performer = null; } break; case "reasonCode": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration 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($"MedicationAdministration 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($"MedicationAdministration 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($"MedicationAdministration 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 "request": current.Request = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Request).DeserializeJson(ref reader, options); break; case "device": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration error reading 'device' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Device = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Device = new Hl7.Fhir.Model.ResourceReference(); v_Device.DeserializeJson(ref reader, options); current.Device.Add(v_Device); if (!reader.Read()) { throw new JsonException($"MedicationAdministration error reading 'device' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Device.Count == 0) { current.Device = null; } break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration 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($"MedicationAdministration 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 "dosage": current.Dosage = new Hl7.Fhir.Model.MedicationAdministration.DosageComponent(); ((Hl7.Fhir.Model.MedicationAdministration.DosageComponent)current.Dosage).DeserializeJson(ref reader, options); break; case "eventHistory": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationAdministration error reading 'eventHistory' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.EventHistory = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_EventHistory = new Hl7.Fhir.Model.ResourceReference(); v_EventHistory.DeserializeJson(ref reader, options); current.EventHistory.Add(v_EventHistory); if (!reader.Read()) { throw new JsonException($"MedicationAdministration error reading 'eventHistory' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.EventHistory.Count == 0) { current.EventHistory = null; } break; // Complex: MedicationAdministration, Export: MedicationAdministration, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR ChargeItem /// </summary> public static void DeserializeJsonProperty(this ChargeItem current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem 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($"ChargeItem 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 "definitionUri": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'definitionUri' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.DefinitionUriElement = new List <FhirUri>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.DefinitionUriElement.Add(new FhirUri()); reader.Skip(); } else { current.DefinitionUriElement.Add(new FhirUri(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'definitionUri' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.DefinitionUriElement.Count == 0) { current.DefinitionUriElement = null; } break; case "_definitionUri": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'definitionUri' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_definitionUri = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_definitionUri >= current.DefinitionUriElement.Count) { current.DefinitionUriElement.Add(new FhirUri()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.DefinitionUriElement[i_definitionUri++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'definitionUri' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "definitionCanonical": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'definitionCanonical' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.DefinitionCanonicalElement = new List <Canonical>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.DefinitionCanonicalElement.Add(new Canonical()); reader.Skip(); } else { current.DefinitionCanonicalElement.Add(new Canonical(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'definitionCanonical' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.DefinitionCanonicalElement.Count == 0) { current.DefinitionCanonicalElement = null; } break; case "_definitionCanonical": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'definitionCanonical' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_definitionCanonical = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_definitionCanonical >= current.DefinitionCanonicalElement.Count) { current.DefinitionCanonicalElement.Add(new Canonical()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.DefinitionCanonicalElement[i_definitionCanonical++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'definitionCanonical' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.ChargeItem.ChargeItemStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.ChargeItem.ChargeItemStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.ChargeItem.ChargeItemStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.ChargeItem.ChargeItemStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "partOf": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'partOf' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PartOf = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_PartOf = new Hl7.Fhir.Model.ResourceReference(); v_PartOf.DeserializeJson(ref reader, options); current.PartOf.Add(v_PartOf); if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'partOf' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PartOf.Count == 0) { current.PartOf = null; } break; case "code": current.Code = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Code).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 "context": current.Context = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Context).DeserializeJson(ref reader, options); break; case "occurrenceDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Occurrence = new FhirDateTime(); reader.Skip(); } else { current.Occurrence = new FhirDateTime(reader.GetString()); } break; case "_occurrenceDateTime": if (current.Occurrence == null) { current.Occurrence = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Occurrence).DeserializeJson(ref reader, options); break; case "occurrencePeriod": current.Occurrence = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Occurrence).DeserializeJson(ref reader, options); break; case "occurrenceTiming": current.Occurrence = new Hl7.Fhir.Model.Timing(); ((Hl7.Fhir.Model.Timing)current.Occurrence).DeserializeJson(ref reader, options); break; case "performer": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'performer' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Performer = new List <ChargeItem.PerformerComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ChargeItem.PerformerComponent v_Performer = new Hl7.Fhir.Model.ChargeItem.PerformerComponent(); v_Performer.DeserializeJson(ref reader, options); current.Performer.Add(v_Performer); if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'performer' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Performer.Count == 0) { current.Performer = null; } break; case "performingOrganization": current.PerformingOrganization = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.PerformingOrganization).DeserializeJson(ref reader, options); break; case "requestingOrganization": current.RequestingOrganization = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.RequestingOrganization).DeserializeJson(ref reader, options); break; case "costCenter": current.CostCenter = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.CostCenter).DeserializeJson(ref reader, options); break; case "quantity": current.Quantity = new Hl7.Fhir.Model.Quantity(); ((Hl7.Fhir.Model.Quantity)current.Quantity).DeserializeJson(ref reader, options); break; case "bodysite": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'bodysite' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Bodysite = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Bodysite = new Hl7.Fhir.Model.CodeableConcept(); v_Bodysite.DeserializeJson(ref reader, options); current.Bodysite.Add(v_Bodysite); if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'bodysite' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Bodysite.Count == 0) { current.Bodysite = null; } break; case "factorOverride": if (reader.TokenType == JsonTokenType.Null) { current.FactorOverrideElement = new FhirDecimal(); reader.Skip(); } else { current.FactorOverrideElement = new FhirDecimal(reader.GetDecimal()); } break; case "_factorOverride": if (current.FactorOverrideElement == null) { current.FactorOverrideElement = new FhirDecimal(); } ((Hl7.Fhir.Model.Element)current.FactorOverrideElement).DeserializeJson(ref reader, options); break; case "priceOverride": current.PriceOverride = new Hl7.Fhir.Model.Money(); ((Hl7.Fhir.Model.Money)current.PriceOverride).DeserializeJson(ref reader, options); break; case "overrideReason": if (reader.TokenType == JsonTokenType.Null) { current.OverrideReasonElement = new FhirString(); reader.Skip(); } else { current.OverrideReasonElement = new FhirString(reader.GetString()); } break; case "_overrideReason": if (current.OverrideReasonElement == null) { current.OverrideReasonElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.OverrideReasonElement).DeserializeJson(ref reader, options); break; case "enterer": current.Enterer = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Enterer).DeserializeJson(ref reader, options); break; case "enteredDate": if (reader.TokenType == JsonTokenType.Null) { current.EnteredDateElement = new FhirDateTime(); reader.Skip(); } else { current.EnteredDateElement = new FhirDateTime(reader.GetString()); } break; case "_enteredDate": if (current.EnteredDateElement == null) { current.EnteredDateElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.EnteredDateElement).DeserializeJson(ref reader, options); break; case "reason": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'reason' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Reason = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Reason = new Hl7.Fhir.Model.CodeableConcept(); v_Reason.DeserializeJson(ref reader, options); current.Reason.Add(v_Reason); if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'reason' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Reason.Count == 0) { current.Reason = null; } break; case "service": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'service' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Service = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Service = new Hl7.Fhir.Model.ResourceReference(); v_Service.DeserializeJson(ref reader, options); current.Service.Add(v_Service); if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'service' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Service.Count == 0) { current.Service = null; } break; case "productReference": current.Product = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Product).DeserializeJson(ref reader, options); break; case "productCodeableConcept": current.Product = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Product).DeserializeJson(ref reader, options); break; case "account": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'account' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Account = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Account = new Hl7.Fhir.Model.ResourceReference(); v_Account.DeserializeJson(ref reader, options); current.Account.Add(v_Account); if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'account' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Account.Count == 0) { current.Account = null; } break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem 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($"ChargeItem 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 "supportingInformation": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ChargeItem error reading 'supportingInformation' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.SupportingInformation = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_SupportingInformation = new Hl7.Fhir.Model.ResourceReference(); v_SupportingInformation.DeserializeJson(ref reader, options); current.SupportingInformation.Add(v_SupportingInformation); if (!reader.Read()) { throw new JsonException($"ChargeItem error reading 'supportingInformation' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.SupportingInformation.Count == 0) { current.SupportingInformation = null; } break; // Complex: ChargeItem, Export: ChargeItem, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR List /// </summary> public static void DeserializeJsonProperty(this List current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"List 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($"List 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 "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.List.ListStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.List.ListStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.List.ListStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.List.ListStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "mode": if (reader.TokenType == JsonTokenType.Null) { current.ModeElement = new Code <Hl7.Fhir.Model.ListMode>(); reader.Skip(); } else { current.ModeElement = new Code <Hl7.Fhir.Model.ListMode>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.ListMode>(reader.GetString())); } break; case "_mode": if (current.ModeElement == null) { current.ModeElement = new Code <Hl7.Fhir.Model.ListMode>(); } ((Hl7.Fhir.Model.Element)current.ModeElement).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 "code": current.Code = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Code).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 "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 "source": current.Source = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Source).DeserializeJson(ref reader, options); break; case "orderedBy": current.OrderedBy = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.OrderedBy).DeserializeJson(ref reader, options); break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"List 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($"List 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 "entry": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"List error reading 'entry' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Entry = new List <List.EntryComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.List.EntryComponent v_Entry = new Hl7.Fhir.Model.List.EntryComponent(); v_Entry.DeserializeJson(ref reader, options); current.Entry.Add(v_Entry); if (!reader.Read()) { throw new JsonException($"List error reading 'entry' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Entry.Count == 0) { current.Entry = null; } break; case "emptyReason": current.EmptyReason = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.EmptyReason).DeserializeJson(ref reader, options); break; // Complex: List, Export: List, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR Evidence /// </summary> public static void DeserializeJsonProperty(this Evidence 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($"Evidence 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($"Evidence 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 "shortTitle": if (reader.TokenType == JsonTokenType.Null) { current.ShortTitleElement = new FhirString(); reader.Skip(); } else { current.ShortTitleElement = new FhirString(reader.GetString()); } break; case "_shortTitle": if (current.ShortTitleElement == null) { current.ShortTitleElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.ShortTitleElement).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 "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($"Evidence 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($"Evidence 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 "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Evidence 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($"Evidence 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 "useContext": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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 "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($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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($"Evidence 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 "exposureBackground": current.ExposureBackground = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.ExposureBackground).DeserializeJson(ref reader, options); break; case "exposureVariant": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Evidence error reading 'exposureVariant' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.ExposureVariant = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_ExposureVariant = new Hl7.Fhir.Model.ResourceReference(); v_ExposureVariant.DeserializeJson(ref reader, options); current.ExposureVariant.Add(v_ExposureVariant); if (!reader.Read()) { throw new JsonException($"Evidence error reading 'exposureVariant' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.ExposureVariant.Count == 0) { current.ExposureVariant = null; } break; case "outcome": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Evidence error reading 'outcome' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Outcome = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Outcome = new Hl7.Fhir.Model.ResourceReference(); v_Outcome.DeserializeJson(ref reader, options); current.Outcome.Add(v_Outcome); if (!reader.Read()) { throw new JsonException($"Evidence error reading 'outcome' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Outcome.Count == 0) { current.Outcome = null; } break; // Complex: Evidence, Export: Evidence, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR ResearchStudy /// </summary> public static void DeserializeJsonProperty(this ResearchStudy current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy 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($"ResearchStudy 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 "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 "protocol": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'protocol' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Protocol = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Protocol = new Hl7.Fhir.Model.ResourceReference(); v_Protocol.DeserializeJson(ref reader, options); current.Protocol.Add(v_Protocol); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'protocol' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Protocol.Count == 0) { current.Protocol = null; } break; case "partOf": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'partOf' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PartOf = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_PartOf = new Hl7.Fhir.Model.ResourceReference(); v_PartOf.DeserializeJson(ref reader, options); current.PartOf.Add(v_PartOf); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'partOf' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PartOf.Count == 0) { current.PartOf = null; } break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "primaryPurposeType": current.PrimaryPurposeType = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.PrimaryPurposeType).DeserializeJson(ref reader, options); break; case "phase": current.Phase = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Phase).DeserializeJson(ref reader, options); break; case "category": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Category = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Category = new Hl7.Fhir.Model.CodeableConcept(); v_Category.DeserializeJson(ref reader, options); current.Category.Add(v_Category); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Category.Count == 0) { current.Category = null; } break; case "focus": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'focus' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Focus = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Focus = new Hl7.Fhir.Model.CodeableConcept(); v_Focus.DeserializeJson(ref reader, options); current.Focus.Add(v_Focus); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'focus' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Focus.Count == 0) { current.Focus = null; } break; case "condition": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'condition' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Condition = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Condition = new Hl7.Fhir.Model.CodeableConcept(); v_Condition.DeserializeJson(ref reader, options); current.Condition.Add(v_Condition); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'condition' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Condition.Count == 0) { current.Condition = null; } break; case "contact": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy 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($"ResearchStudy 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 "relatedArtifact": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy 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($"ResearchStudy 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 "keyword": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'keyword' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Keyword = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Keyword = new Hl7.Fhir.Model.CodeableConcept(); v_Keyword.DeserializeJson(ref reader, options); current.Keyword.Add(v_Keyword); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'keyword' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Keyword.Count == 0) { current.Keyword = null; } break; case "location": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'location' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Location = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Location = new Hl7.Fhir.Model.CodeableConcept(); v_Location.DeserializeJson(ref reader, options); current.Location.Add(v_Location); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'location' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Location.Count == 0) { current.Location = 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 "enrollment": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'enrollment' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Enrollment = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Enrollment = new Hl7.Fhir.Model.ResourceReference(); v_Enrollment.DeserializeJson(ref reader, options); current.Enrollment.Add(v_Enrollment); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'enrollment' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Enrollment.Count == 0) { current.Enrollment = null; } break; case "period": current.Period = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Period).DeserializeJson(ref reader, options); break; case "sponsor": current.Sponsor = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Sponsor).DeserializeJson(ref reader, options); break; case "principalInvestigator": current.PrincipalInvestigator = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.PrincipalInvestigator).DeserializeJson(ref reader, options); break; case "site": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'site' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Site = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Site = new Hl7.Fhir.Model.ResourceReference(); v_Site.DeserializeJson(ref reader, options); current.Site.Add(v_Site); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'site' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Site.Count == 0) { current.Site = null; } break; case "reasonStopped": current.ReasonStopped = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.ReasonStopped).DeserializeJson(ref reader, options); break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy 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($"ResearchStudy 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 "arm": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'arm' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Arm = new List <ResearchStudy.ArmComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResearchStudy.ArmComponent v_Arm = new Hl7.Fhir.Model.ResearchStudy.ArmComponent(); v_Arm.DeserializeJson(ref reader, options); current.Arm.Add(v_Arm); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'arm' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Arm.Count == 0) { current.Arm = null; } break; case "objective": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ResearchStudy error reading 'objective' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Objective = new List <ResearchStudy.ObjectiveComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResearchStudy.ObjectiveComponent v_Objective = new Hl7.Fhir.Model.ResearchStudy.ObjectiveComponent(); v_Objective.DeserializeJson(ref reader, options); current.Objective.Add(v_Objective); if (!reader.Read()) { throw new JsonException($"ResearchStudy error reading 'objective' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Objective.Count == 0) { current.Objective = null; } break; // Complex: ResearchStudy, Export: ResearchStudy, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR AllergyIntolerance /// </summary> public static void DeserializeJsonProperty(this AllergyIntolerance current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"AllergyIntolerance 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($"AllergyIntolerance 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 "clinicalStatus": current.ClinicalStatus = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.ClinicalStatus).DeserializeJson(ref reader, options); break; case "verificationStatus": current.VerificationStatus = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.VerificationStatus).DeserializeJson(ref reader, options); break; case "type": if (reader.TokenType == JsonTokenType.Null) { current.TypeElement = new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType>(); reader.Skip(); } else { current.TypeElement = new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType>(reader.GetString())); } break; case "_type": if (current.TypeElement == null) { current.TypeElement = new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType>(); } ((Hl7.Fhir.Model.Element)current.TypeElement).DeserializeJson(ref reader, options); break; case "category": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"AllergyIntolerance error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.CategoryElement = new List <Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCategory> >(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.CategoryElement.Add(new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCategory>()); reader.Skip(); } else { current.CategoryElement.Add(new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCategory>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCategory>(reader.GetString()))); } if (!reader.Read()) { throw new JsonException($"AllergyIntolerance error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.CategoryElement.Count == 0) { current.CategoryElement = null; } break; case "_category": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"AllergyIntolerance error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_category = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_category >= current.CategoryElement.Count) { current.CategoryElement.Add(new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCategory>()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.CategoryElement[i_category++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"AllergyIntolerance error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "criticality": if (reader.TokenType == JsonTokenType.Null) { current.CriticalityElement = new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality>(); reader.Skip(); } else { current.CriticalityElement = new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality>(reader.GetString())); } break; case "_criticality": if (current.CriticalityElement == null) { current.CriticalityElement = new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality>(); } ((Hl7.Fhir.Model.Element)current.CriticalityElement).DeserializeJson(ref reader, options); break; case "code": current.Code = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Code).DeserializeJson(ref reader, options); break; case "patient": current.Patient = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Patient).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 "onsetDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Onset = new FhirDateTime(); reader.Skip(); } else { current.Onset = new FhirDateTime(reader.GetString()); } break; case "_onsetDateTime": if (current.Onset == null) { current.Onset = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Onset).DeserializeJson(ref reader, options); break; case "onsetAge": current.Onset = new Hl7.Fhir.Model.Age(); ((Hl7.Fhir.Model.Age)current.Onset).DeserializeJson(ref reader, options); break; case "onsetPeriod": current.Onset = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Onset).DeserializeJson(ref reader, options); break; case "onsetRange": current.Onset = new Hl7.Fhir.Model.Range(); ((Hl7.Fhir.Model.Range)current.Onset).DeserializeJson(ref reader, options); break; case "onsetString": if (reader.TokenType == JsonTokenType.Null) { current.Onset = new FhirString(); reader.Skip(); } else { current.Onset = new FhirString(reader.GetString()); } break; case "_onsetString": if (current.Onset == null) { current.Onset = new FhirString(); } ((Hl7.Fhir.Model.Element)current.Onset).DeserializeJson(ref reader, options); break; case "recordedDate": if (reader.TokenType == JsonTokenType.Null) { current.RecordedDateElement = new FhirDateTime(); reader.Skip(); } else { current.RecordedDateElement = new FhirDateTime(reader.GetString()); } break; case "_recordedDate": if (current.RecordedDateElement == null) { current.RecordedDateElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.RecordedDateElement).DeserializeJson(ref reader, options); break; case "recorder": current.Recorder = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Recorder).DeserializeJson(ref reader, options); break; case "asserter": current.Asserter = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Asserter).DeserializeJson(ref reader, options); break; case "lastOccurrence": if (reader.TokenType == JsonTokenType.Null) { current.LastOccurrenceElement = new FhirDateTime(); reader.Skip(); } else { current.LastOccurrenceElement = new FhirDateTime(reader.GetString()); } break; case "_lastOccurrence": if (current.LastOccurrenceElement == null) { current.LastOccurrenceElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.LastOccurrenceElement).DeserializeJson(ref reader, options); break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"AllergyIntolerance 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($"AllergyIntolerance 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 "reaction": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"AllergyIntolerance error reading 'reaction' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Reaction = new List <AllergyIntolerance.ReactionComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.AllergyIntolerance.ReactionComponent v_Reaction = new Hl7.Fhir.Model.AllergyIntolerance.ReactionComponent(); v_Reaction.DeserializeJson(ref reader, options); current.Reaction.Add(v_Reaction); if (!reader.Read()) { throw new JsonException($"AllergyIntolerance error reading 'reaction' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Reaction.Count == 0) { current.Reaction = null; } break; // Complex: AllergyIntolerance, Export: AllergyIntolerance, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR Invoice /// </summary> public static void DeserializeJsonProperty(this Invoice current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Invoice 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($"Invoice 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 "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.Invoice.InvoiceStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.Invoice.InvoiceStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.Invoice.InvoiceStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.Invoice.InvoiceStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "cancelledReason": if (reader.TokenType == JsonTokenType.Null) { current.CancelledReasonElement = new FhirString(); reader.Skip(); } else { current.CancelledReasonElement = new FhirString(reader.GetString()); } break; case "_cancelledReason": if (current.CancelledReasonElement == null) { current.CancelledReasonElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.CancelledReasonElement).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 "subject": current.Subject = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Subject).DeserializeJson(ref reader, options); break; case "recipient": current.Recipient = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Recipient).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 "participant": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Invoice error reading 'participant' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Participant = new List <Invoice.ParticipantComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Invoice.ParticipantComponent v_Participant = new Hl7.Fhir.Model.Invoice.ParticipantComponent(); v_Participant.DeserializeJson(ref reader, options); current.Participant.Add(v_Participant); if (!reader.Read()) { throw new JsonException($"Invoice error reading 'participant' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Participant.Count == 0) { current.Participant = null; } break; case "issuer": current.Issuer = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Issuer).DeserializeJson(ref reader, options); break; case "account": current.Account = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Account).DeserializeJson(ref reader, options); break; case "lineItem": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Invoice error reading 'lineItem' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.LineItem = new List <Invoice.LineItemComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Invoice.LineItemComponent v_LineItem = new Hl7.Fhir.Model.Invoice.LineItemComponent(); v_LineItem.DeserializeJson(ref reader, options); current.LineItem.Add(v_LineItem); if (!reader.Read()) { throw new JsonException($"Invoice error reading 'lineItem' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.LineItem.Count == 0) { current.LineItem = null; } break; case "totalPriceComponent": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Invoice error reading 'totalPriceComponent' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.TotalPriceComponent = new List <Invoice.PriceComponentComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Invoice.PriceComponentComponent v_TotalPriceComponent = new Hl7.Fhir.Model.Invoice.PriceComponentComponent(); v_TotalPriceComponent.DeserializeJson(ref reader, options); current.TotalPriceComponent.Add(v_TotalPriceComponent); if (!reader.Read()) { throw new JsonException($"Invoice error reading 'totalPriceComponent' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.TotalPriceComponent.Count == 0) { current.TotalPriceComponent = null; } break; case "totalNet": current.TotalNet = new Hl7.Fhir.Model.Money(); ((Hl7.Fhir.Model.Money)current.TotalNet).DeserializeJson(ref reader, options); break; case "totalGross": current.TotalGross = new Hl7.Fhir.Model.Money(); ((Hl7.Fhir.Model.Money)current.TotalGross).DeserializeJson(ref reader, options); break; case "paymentTerms": if (reader.TokenType == JsonTokenType.Null) { current.PaymentTerms = new Markdown(); reader.Skip(); } else { current.PaymentTerms = new Markdown(reader.GetString()); } break; case "_paymentTerms": if (current.PaymentTerms == null) { current.PaymentTerms = new Markdown(); } ((Hl7.Fhir.Model.Element)current.PaymentTerms).DeserializeJson(ref reader, options); break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Invoice 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($"Invoice 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; // Complex: Invoice, Export: Invoice, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR AllergyIntolerance#Reaction /// </summary> public static void DeserializeJsonProperty(this AllergyIntolerance.ReactionComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "substance": current.Substance = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Substance).DeserializeJson(ref reader, options); break; case "manifestation": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ReactionComponent error reading 'manifestation' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Manifestation = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Manifestation = new Hl7.Fhir.Model.CodeableConcept(); v_Manifestation.DeserializeJson(ref reader, options); current.Manifestation.Add(v_Manifestation); if (!reader.Read()) { throw new JsonException($"ReactionComponent error reading 'manifestation' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Manifestation.Count == 0) { current.Manifestation = null; } break; case "description": if (reader.TokenType == JsonTokenType.Null) { current.DescriptionElement = new FhirString(); reader.Skip(); } else { current.DescriptionElement = new FhirString(reader.GetString()); } break; case "_description": if (current.DescriptionElement == null) { current.DescriptionElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.DescriptionElement).DeserializeJson(ref reader, options); break; case "onset": if (reader.TokenType == JsonTokenType.Null) { current.OnsetElement = new FhirDateTime(); reader.Skip(); } else { current.OnsetElement = new FhirDateTime(reader.GetString()); } break; case "_onset": if (current.OnsetElement == null) { current.OnsetElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.OnsetElement).DeserializeJson(ref reader, options); break; case "severity": if (reader.TokenType == JsonTokenType.Null) { current.SeverityElement = new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity>(); reader.Skip(); } else { current.SeverityElement = new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity>(reader.GetString())); } break; case "_severity": if (current.SeverityElement == null) { current.SeverityElement = new Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity>(); } ((Hl7.Fhir.Model.Element)current.SeverityElement).DeserializeJson(ref reader, options); break; case "exposureRoute": current.ExposureRoute = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.ExposureRoute).DeserializeJson(ref reader, options); break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ReactionComponent 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($"ReactionComponent 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; // Complex: reaction, Export: ReactionComponent, Base: BackboneElement default: ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR CareTeam /// </summary> public static void DeserializeJsonProperty(this CareTeam current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CareTeam 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($"CareTeam 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 "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.CareTeam.CareTeamStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.CareTeam.CareTeamStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.CareTeam.CareTeamStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.CareTeam.CareTeamStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "category": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CareTeam error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Category = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Category = new Hl7.Fhir.Model.CodeableConcept(); v_Category.DeserializeJson(ref reader, options); current.Category.Add(v_Category); if (!reader.Read()) { throw new JsonException($"CareTeam error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Category.Count == 0) { current.Category = null; } 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 "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 "period": current.Period = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Period).DeserializeJson(ref reader, options); break; case "participant": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CareTeam error reading 'participant' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Participant = new List <CareTeam.ParticipantComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CareTeam.ParticipantComponent v_Participant = new Hl7.Fhir.Model.CareTeam.ParticipantComponent(); v_Participant.DeserializeJson(ref reader, options); current.Participant.Add(v_Participant); if (!reader.Read()) { throw new JsonException($"CareTeam error reading 'participant' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Participant.Count == 0) { current.Participant = null; } break; case "reasonCode": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CareTeam 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($"CareTeam 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($"CareTeam 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($"CareTeam 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 "managingOrganization": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CareTeam error reading 'managingOrganization' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.ManagingOrganization = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_ManagingOrganization = new Hl7.Fhir.Model.ResourceReference(); v_ManagingOrganization.DeserializeJson(ref reader, options); current.ManagingOrganization.Add(v_ManagingOrganization); if (!reader.Read()) { throw new JsonException($"CareTeam error reading 'managingOrganization' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.ManagingOrganization.Count == 0) { current.ManagingOrganization = null; } break; case "telecom": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CareTeam error reading 'telecom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Telecom = new List <ContactPoint>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ContactPoint v_Telecom = new Hl7.Fhir.Model.ContactPoint(); v_Telecom.DeserializeJson(ref reader, options); current.Telecom.Add(v_Telecom); if (!reader.Read()) { throw new JsonException($"CareTeam error reading 'telecom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Telecom.Count == 0) { current.Telecom = null; } break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"CareTeam 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($"CareTeam 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; // Complex: CareTeam, Export: CareTeam, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR DeviceRequest /// </summary> public static void DeserializeJsonProperty(this DeviceRequest current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest 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($"DeviceRequest 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 "instantiatesCanonical": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'instantiatesCanonical' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.InstantiatesCanonicalElement = new List <Canonical>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.InstantiatesCanonicalElement.Add(new Canonical()); reader.Skip(); } else { current.InstantiatesCanonicalElement.Add(new Canonical(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"DeviceRequest error reading 'instantiatesCanonical' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.InstantiatesCanonicalElement.Count == 0) { current.InstantiatesCanonicalElement = null; } break; case "_instantiatesCanonical": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'instantiatesCanonical' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_instantiatesCanonical = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_instantiatesCanonical >= current.InstantiatesCanonicalElement.Count) { current.InstantiatesCanonicalElement.Add(new Canonical()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.InstantiatesCanonicalElement[i_instantiatesCanonical++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"DeviceRequest error reading 'instantiatesCanonical' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "instantiatesUri": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'instantiatesUri' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.InstantiatesUriElement = new List <FhirUri>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.InstantiatesUriElement.Add(new FhirUri()); reader.Skip(); } else { current.InstantiatesUriElement.Add(new FhirUri(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"DeviceRequest error reading 'instantiatesUri' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.InstantiatesUriElement.Count == 0) { current.InstantiatesUriElement = null; } break; case "_instantiatesUri": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'instantiatesUri' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_instantiatesUri = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_instantiatesUri >= current.InstantiatesUriElement.Count) { current.InstantiatesUriElement.Add(new FhirUri()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.InstantiatesUriElement[i_instantiatesUri++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"DeviceRequest error reading 'instantiatesUri' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "basedOn": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'basedOn' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.BasedOn = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_BasedOn = new Hl7.Fhir.Model.ResourceReference(); v_BasedOn.DeserializeJson(ref reader, options); current.BasedOn.Add(v_BasedOn); if (!reader.Read()) { throw new JsonException($"DeviceRequest error reading 'basedOn' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.BasedOn.Count == 0) { current.BasedOn = null; } break; case "priorRequest": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'priorRequest' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PriorRequest = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_PriorRequest = new Hl7.Fhir.Model.ResourceReference(); v_PriorRequest.DeserializeJson(ref reader, options); current.PriorRequest.Add(v_PriorRequest); if (!reader.Read()) { throw new JsonException($"DeviceRequest error reading 'priorRequest' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PriorRequest.Count == 0) { current.PriorRequest = null; } break; case "groupIdentifier": current.GroupIdentifier = new Hl7.Fhir.Model.Identifier(); ((Hl7.Fhir.Model.Identifier)current.GroupIdentifier).DeserializeJson(ref reader, options); break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.RequestStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.RequestStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.RequestStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.RequestStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "intent": if (reader.TokenType == JsonTokenType.Null) { current.IntentElement = new Code <Hl7.Fhir.Model.RequestIntent>(); reader.Skip(); } else { current.IntentElement = new Code <Hl7.Fhir.Model.RequestIntent>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.RequestIntent>(reader.GetString())); } break; case "_intent": if (current.IntentElement == null) { current.IntentElement = new Code <Hl7.Fhir.Model.RequestIntent>(); } ((Hl7.Fhir.Model.Element)current.IntentElement).DeserializeJson(ref reader, options); break; case "priority": if (reader.TokenType == JsonTokenType.Null) { current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(); reader.Skip(); } else { current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.RequestPriority>(reader.GetString())); } break; case "_priority": if (current.PriorityElement == null) { current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(); } ((Hl7.Fhir.Model.Element)current.PriorityElement).DeserializeJson(ref reader, options); break; case "codeReference": current.Code = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Code).DeserializeJson(ref reader, options); break; case "codeCodeableConcept": current.Code = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Code).DeserializeJson(ref reader, options); break; case "parameter": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'parameter' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Parameter = new List <DeviceRequest.ParameterComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.DeviceRequest.ParameterComponent v_Parameter = new Hl7.Fhir.Model.DeviceRequest.ParameterComponent(); v_Parameter.DeserializeJson(ref reader, options); current.Parameter.Add(v_Parameter); if (!reader.Read()) { throw new JsonException($"DeviceRequest 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 "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.Occurrence = new FhirDateTime(); reader.Skip(); } else { current.Occurrence = new FhirDateTime(reader.GetString()); } break; case "_occurrenceDateTime": if (current.Occurrence == null) { current.Occurrence = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Occurrence).DeserializeJson(ref reader, options); break; case "occurrencePeriod": current.Occurrence = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Occurrence).DeserializeJson(ref reader, options); break; case "occurrenceTiming": current.Occurrence = new Hl7.Fhir.Model.Timing(); ((Hl7.Fhir.Model.Timing)current.Occurrence).DeserializeJson(ref reader, options); break; case "authoredOn": if (reader.TokenType == JsonTokenType.Null) { current.AuthoredOnElement = new FhirDateTime(); reader.Skip(); } else { current.AuthoredOnElement = new FhirDateTime(reader.GetString()); } break; case "_authoredOn": if (current.AuthoredOnElement == null) { current.AuthoredOnElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.AuthoredOnElement).DeserializeJson(ref reader, options); break; case "requester": current.Requester = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Requester).DeserializeJson(ref reader, options); break; case "performerType": current.PerformerType = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.PerformerType).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($"DeviceRequest 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($"DeviceRequest 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($"DeviceRequest 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($"DeviceRequest 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 "insurance": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'insurance' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Insurance = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Insurance = new Hl7.Fhir.Model.ResourceReference(); v_Insurance.DeserializeJson(ref reader, options); current.Insurance.Add(v_Insurance); if (!reader.Read()) { throw new JsonException($"DeviceRequest error reading 'insurance' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Insurance.Count == 0) { current.Insurance = null; } break; case "supportingInfo": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'supportingInfo' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.SupportingInfo = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_SupportingInfo = new Hl7.Fhir.Model.ResourceReference(); v_SupportingInfo.DeserializeJson(ref reader, options); current.SupportingInfo.Add(v_SupportingInfo); if (!reader.Read()) { throw new JsonException($"DeviceRequest error reading 'supportingInfo' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.SupportingInfo.Count == 0) { current.SupportingInfo = null; } break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest 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($"DeviceRequest 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 "relevantHistory": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceRequest error reading 'relevantHistory' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.RelevantHistory = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_RelevantHistory = new Hl7.Fhir.Model.ResourceReference(); v_RelevantHistory.DeserializeJson(ref reader, options); current.RelevantHistory.Add(v_RelevantHistory); if (!reader.Read()) { throw new JsonException($"DeviceRequest error reading 'relevantHistory' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.RelevantHistory.Count == 0) { current.RelevantHistory = null; } break; // Complex: DeviceRequest, Export: DeviceRequest, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR Communication /// </summary> public static void DeserializeJsonProperty(this Communication current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication 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($"Communication 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 "instantiatesCanonical": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'instantiatesCanonical' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.InstantiatesCanonicalElement = new List <Canonical>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.InstantiatesCanonicalElement.Add(new Canonical()); reader.Skip(); } else { current.InstantiatesCanonicalElement.Add(new Canonical(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"Communication error reading 'instantiatesCanonical' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.InstantiatesCanonicalElement.Count == 0) { current.InstantiatesCanonicalElement = null; } break; case "_instantiatesCanonical": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'instantiatesCanonical' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_instantiatesCanonical = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_instantiatesCanonical >= current.InstantiatesCanonicalElement.Count) { current.InstantiatesCanonicalElement.Add(new Canonical()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.InstantiatesCanonicalElement[i_instantiatesCanonical++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"Communication error reading 'instantiatesCanonical' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "instantiatesUri": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'instantiatesUri' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.InstantiatesUriElement = new List <FhirUri>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.InstantiatesUriElement.Add(new FhirUri()); reader.Skip(); } else { current.InstantiatesUriElement.Add(new FhirUri(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"Communication error reading 'instantiatesUri' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.InstantiatesUriElement.Count == 0) { current.InstantiatesUriElement = null; } break; case "_instantiatesUri": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'instantiatesUri' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_instantiatesUri = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_instantiatesUri >= current.InstantiatesUriElement.Count) { current.InstantiatesUriElement.Add(new FhirUri()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.InstantiatesUriElement[i_instantiatesUri++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"Communication error reading 'instantiatesUri' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "basedOn": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'basedOn' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.BasedOn = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_BasedOn = new Hl7.Fhir.Model.ResourceReference(); v_BasedOn.DeserializeJson(ref reader, options); current.BasedOn.Add(v_BasedOn); if (!reader.Read()) { throw new JsonException($"Communication error reading 'basedOn' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.BasedOn.Count == 0) { current.BasedOn = null; } break; case "partOf": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'partOf' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PartOf = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_PartOf = new Hl7.Fhir.Model.ResourceReference(); v_PartOf.DeserializeJson(ref reader, options); current.PartOf.Add(v_PartOf); if (!reader.Read()) { throw new JsonException($"Communication error reading 'partOf' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PartOf.Count == 0) { current.PartOf = null; } break; case "inResponseTo": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'inResponseTo' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.InResponseTo = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_InResponseTo = new Hl7.Fhir.Model.ResourceReference(); v_InResponseTo.DeserializeJson(ref reader, options); current.InResponseTo.Add(v_InResponseTo); if (!reader.Read()) { throw new JsonException($"Communication error reading 'inResponseTo' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.InResponseTo.Count == 0) { current.InResponseTo = null; } break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.EventStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.EventStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.EventStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.EventStatus>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "statusReason": current.StatusReason = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.StatusReason).DeserializeJson(ref reader, options); break; case "category": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Category = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Category = new Hl7.Fhir.Model.CodeableConcept(); v_Category.DeserializeJson(ref reader, options); current.Category.Add(v_Category); if (!reader.Read()) { throw new JsonException($"Communication error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Category.Count == 0) { current.Category = null; } break; case "priority": if (reader.TokenType == JsonTokenType.Null) { current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(); reader.Skip(); } else { current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.RequestPriority>(reader.GetString())); } break; case "_priority": if (current.PriorityElement == null) { current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(); } ((Hl7.Fhir.Model.Element)current.PriorityElement).DeserializeJson(ref reader, options); break; case "medium": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'medium' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Medium = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Medium = new Hl7.Fhir.Model.CodeableConcept(); v_Medium.DeserializeJson(ref reader, options); current.Medium.Add(v_Medium); if (!reader.Read()) { throw new JsonException($"Communication error reading 'medium' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Medium.Count == 0) { current.Medium = null; } break; case "subject": current.Subject = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Subject).DeserializeJson(ref reader, options); break; case "topic": current.Topic = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Topic).DeserializeJson(ref reader, options); break; case "about": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'about' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.About = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_About = new Hl7.Fhir.Model.ResourceReference(); v_About.DeserializeJson(ref reader, options); current.About.Add(v_About); if (!reader.Read()) { throw new JsonException($"Communication error reading 'about' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.About.Count == 0) { current.About = null; } break; case "encounter": current.Encounter = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Encounter).DeserializeJson(ref reader, options); break; case "sent": if (reader.TokenType == JsonTokenType.Null) { current.SentElement = new FhirDateTime(); reader.Skip(); } else { current.SentElement = new FhirDateTime(reader.GetString()); } break; case "_sent": if (current.SentElement == null) { current.SentElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.SentElement).DeserializeJson(ref reader, options); break; case "received": if (reader.TokenType == JsonTokenType.Null) { current.ReceivedElement = new FhirDateTime(); reader.Skip(); } else { current.ReceivedElement = new FhirDateTime(reader.GetString()); } break; case "_received": if (current.ReceivedElement == null) { current.ReceivedElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.ReceivedElement).DeserializeJson(ref reader, options); break; case "recipient": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'recipient' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Recipient = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Recipient = new Hl7.Fhir.Model.ResourceReference(); v_Recipient.DeserializeJson(ref reader, options); current.Recipient.Add(v_Recipient); if (!reader.Read()) { throw new JsonException($"Communication error reading 'recipient' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Recipient.Count == 0) { current.Recipient = null; } break; case "sender": current.Sender = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Sender).DeserializeJson(ref reader, options); break; case "reasonCode": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication 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($"Communication 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($"Communication 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($"Communication 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 "payload": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication error reading 'payload' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Payload = new List <Communication.PayloadComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Communication.PayloadComponent v_Payload = new Hl7.Fhir.Model.Communication.PayloadComponent(); v_Payload.DeserializeJson(ref reader, options); current.Payload.Add(v_Payload); if (!reader.Read()) { throw new JsonException($"Communication error reading 'payload' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Payload.Count == 0) { current.Payload = null; } break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Communication 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($"Communication 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; // Complex: Communication, Export: Communication, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR MedicationStatement /// </summary> public static void DeserializeJsonProperty(this MedicationStatement current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationStatement 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($"MedicationStatement 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 "basedOn": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationStatement error reading 'basedOn' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.BasedOn = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_BasedOn = new Hl7.Fhir.Model.ResourceReference(); v_BasedOn.DeserializeJson(ref reader, options); current.BasedOn.Add(v_BasedOn); if (!reader.Read()) { throw new JsonException($"MedicationStatement error reading 'basedOn' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.BasedOn.Count == 0) { current.BasedOn = null; } break; case "partOf": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationStatement error reading 'partOf' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PartOf = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_PartOf = new Hl7.Fhir.Model.ResourceReference(); v_PartOf.DeserializeJson(ref reader, options); current.PartOf.Add(v_PartOf); if (!reader.Read()) { throw new JsonException($"MedicationStatement error reading 'partOf' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PartOf.Count == 0) { current.PartOf = null; } break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.MedicationStatement.MedicationStatusCodes>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.MedicationStatement.MedicationStatusCodes>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.MedicationStatement.MedicationStatusCodes>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.MedicationStatement.MedicationStatusCodes>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "statusReason": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationStatement error reading 'statusReason' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.StatusReason = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_StatusReason = new Hl7.Fhir.Model.CodeableConcept(); v_StatusReason.DeserializeJson(ref reader, options); current.StatusReason.Add(v_StatusReason); if (!reader.Read()) { throw new JsonException($"MedicationStatement error reading 'statusReason' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.StatusReason.Count == 0) { current.StatusReason = null; } break; case "category": current.Category = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Category).DeserializeJson(ref reader, options); break; case "medicationCodeableConcept": current.Medication = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Medication).DeserializeJson(ref reader, options); break; case "medicationReference": current.Medication = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Medication).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 "context": current.Context = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Context).DeserializeJson(ref reader, options); break; case "effectiveDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Effective = new FhirDateTime(); reader.Skip(); } else { current.Effective = new FhirDateTime(reader.GetString()); } break; case "_effectiveDateTime": if (current.Effective == null) { current.Effective = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Effective).DeserializeJson(ref reader, options); break; case "effectivePeriod": current.Effective = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Effective).DeserializeJson(ref reader, options); break; case "dateAsserted": if (reader.TokenType == JsonTokenType.Null) { current.DateAssertedElement = new FhirDateTime(); reader.Skip(); } else { current.DateAssertedElement = new FhirDateTime(reader.GetString()); } break; case "_dateAsserted": if (current.DateAssertedElement == null) { current.DateAssertedElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.DateAssertedElement).DeserializeJson(ref reader, options); break; case "informationSource": current.InformationSource = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.InformationSource).DeserializeJson(ref reader, options); break; case "derivedFrom": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationStatement error reading 'derivedFrom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.DerivedFrom = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_DerivedFrom = new Hl7.Fhir.Model.ResourceReference(); v_DerivedFrom.DeserializeJson(ref reader, options); current.DerivedFrom.Add(v_DerivedFrom); if (!reader.Read()) { throw new JsonException($"MedicationStatement error reading 'derivedFrom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.DerivedFrom.Count == 0) { current.DerivedFrom = null; } break; case "reasonCode": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationStatement 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($"MedicationStatement 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($"MedicationStatement 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($"MedicationStatement 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($"MedicationStatement 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($"MedicationStatement 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 "dosage": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationStatement error reading 'dosage' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Dosage = new List <Dosage>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Dosage v_Dosage = new Hl7.Fhir.Model.Dosage(); v_Dosage.DeserializeJson(ref reader, options); current.Dosage.Add(v_Dosage); if (!reader.Read()) { throw new JsonException($"MedicationStatement error reading 'dosage' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Dosage.Count == 0) { current.Dosage = null; } break; // Complex: MedicationStatement, Export: MedicationStatement, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR DeviceUseStatement /// </summary> public static void DeserializeJsonProperty(this DeviceUseStatement current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceUseStatement 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($"DeviceUseStatement 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 "basedOn": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceUseStatement error reading 'basedOn' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.BasedOn = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_BasedOn = new Hl7.Fhir.Model.ResourceReference(); v_BasedOn.DeserializeJson(ref reader, options); current.BasedOn.Add(v_BasedOn); if (!reader.Read()) { throw new JsonException($"DeviceUseStatement error reading 'basedOn' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.BasedOn.Count == 0) { current.BasedOn = null; } break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus>(); } ((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 "derivedFrom": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceUseStatement error reading 'derivedFrom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.DerivedFrom = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_DerivedFrom = new Hl7.Fhir.Model.ResourceReference(); v_DerivedFrom.DeserializeJson(ref reader, options); current.DerivedFrom.Add(v_DerivedFrom); if (!reader.Read()) { throw new JsonException($"DeviceUseStatement error reading 'derivedFrom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.DerivedFrom.Count == 0) { current.DerivedFrom = null; } break; case "timingTiming": current.Timing = new Hl7.Fhir.Model.Timing(); ((Hl7.Fhir.Model.Timing)current.Timing).DeserializeJson(ref reader, options); break; case "timingPeriod": current.Timing = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Timing).DeserializeJson(ref reader, options); break; case "timingDateTime": if (reader.TokenType == JsonTokenType.Null) { current.Timing = new FhirDateTime(); reader.Skip(); } else { current.Timing = new FhirDateTime(reader.GetString()); } break; case "_timingDateTime": if (current.Timing == null) { current.Timing = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.Timing).DeserializeJson(ref reader, options); break; case "recordedOn": if (reader.TokenType == JsonTokenType.Null) { current.RecordedOnElement = new FhirDateTime(); reader.Skip(); } else { current.RecordedOnElement = new FhirDateTime(reader.GetString()); } break; case "_recordedOn": if (current.RecordedOnElement == null) { current.RecordedOnElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.RecordedOnElement).DeserializeJson(ref reader, options); break; case "source": current.Source = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Source).DeserializeJson(ref reader, options); break; case "device": current.Device = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Device).DeserializeJson(ref reader, options); break; case "reasonCode": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceUseStatement 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($"DeviceUseStatement 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($"DeviceUseStatement 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($"DeviceUseStatement 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 "bodySite": current.BodySite = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.BodySite).DeserializeJson(ref reader, options); break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"DeviceUseStatement 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($"DeviceUseStatement 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; // Complex: DeviceUseStatement, Export: DeviceUseStatement, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR MedicationDispense /// </summary> public static void DeserializeJsonProperty(this MedicationDispense current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense 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($"MedicationDispense 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 "partOf": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense error reading 'partOf' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.PartOf = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_PartOf = new Hl7.Fhir.Model.ResourceReference(); v_PartOf.DeserializeJson(ref reader, options); current.PartOf.Add(v_PartOf); if (!reader.Read()) { throw new JsonException($"MedicationDispense error reading 'partOf' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.PartOf.Count == 0) { current.PartOf = null; } break; case "status": if (reader.TokenType == JsonTokenType.Null) { current.StatusElement = new Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes>(); reader.Skip(); } else { current.StatusElement = new Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes>(reader.GetString())); } break; case "_status": if (current.StatusElement == null) { current.StatusElement = new Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes>(); } ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options); break; case "statusReasonCodeableConcept": current.StatusReason = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.StatusReason).DeserializeJson(ref reader, options); break; case "statusReasonReference": current.StatusReason = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.StatusReason).DeserializeJson(ref reader, options); break; case "category": current.Category = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Category).DeserializeJson(ref reader, options); break; case "medicationCodeableConcept": current.Medication = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Medication).DeserializeJson(ref reader, options); break; case "medicationReference": current.Medication = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Medication).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 "context": current.Context = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Context).DeserializeJson(ref reader, options); break; case "supportingInformation": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense error reading 'supportingInformation' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.SupportingInformation = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_SupportingInformation = new Hl7.Fhir.Model.ResourceReference(); v_SupportingInformation.DeserializeJson(ref reader, options); current.SupportingInformation.Add(v_SupportingInformation); if (!reader.Read()) { throw new JsonException($"MedicationDispense error reading 'supportingInformation' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.SupportingInformation.Count == 0) { current.SupportingInformation = null; } break; case "performer": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense error reading 'performer' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Performer = new List <MedicationDispense.PerformerComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.MedicationDispense.PerformerComponent v_Performer = new Hl7.Fhir.Model.MedicationDispense.PerformerComponent(); v_Performer.DeserializeJson(ref reader, options); current.Performer.Add(v_Performer); if (!reader.Read()) { throw new JsonException($"MedicationDispense error reading 'performer' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Performer.Count == 0) { current.Performer = null; } break; case "location": current.Location = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Location).DeserializeJson(ref reader, options); break; case "authorizingPrescription": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense error reading 'authorizingPrescription' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.AuthorizingPrescription = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_AuthorizingPrescription = new Hl7.Fhir.Model.ResourceReference(); v_AuthorizingPrescription.DeserializeJson(ref reader, options); current.AuthorizingPrescription.Add(v_AuthorizingPrescription); if (!reader.Read()) { throw new JsonException($"MedicationDispense error reading 'authorizingPrescription' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.AuthorizingPrescription.Count == 0) { current.AuthorizingPrescription = null; } break; case "type": current.Type = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Type).DeserializeJson(ref reader, options); break; case "quantity": current.Quantity = new Hl7.Fhir.Model.Quantity(); ((Hl7.Fhir.Model.Quantity)current.Quantity).DeserializeJson(ref reader, options); break; case "daysSupply": current.DaysSupply = new Hl7.Fhir.Model.Quantity(); ((Hl7.Fhir.Model.Quantity)current.DaysSupply).DeserializeJson(ref reader, options); break; case "whenPrepared": if (reader.TokenType == JsonTokenType.Null) { current.WhenPreparedElement = new FhirDateTime(); reader.Skip(); } else { current.WhenPreparedElement = new FhirDateTime(reader.GetString()); } break; case "_whenPrepared": if (current.WhenPreparedElement == null) { current.WhenPreparedElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.WhenPreparedElement).DeserializeJson(ref reader, options); break; case "whenHandedOver": if (reader.TokenType == JsonTokenType.Null) { current.WhenHandedOverElement = new FhirDateTime(); reader.Skip(); } else { current.WhenHandedOverElement = new FhirDateTime(reader.GetString()); } break; case "_whenHandedOver": if (current.WhenHandedOverElement == null) { current.WhenHandedOverElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.WhenHandedOverElement).DeserializeJson(ref reader, options); break; case "destination": current.Destination = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Destination).DeserializeJson(ref reader, options); break; case "receiver": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense error reading 'receiver' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Receiver = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Receiver = new Hl7.Fhir.Model.ResourceReference(); v_Receiver.DeserializeJson(ref reader, options); current.Receiver.Add(v_Receiver); if (!reader.Read()) { throw new JsonException($"MedicationDispense error reading 'receiver' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Receiver.Count == 0) { current.Receiver = null; } break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense 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($"MedicationDispense 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 "dosageInstruction": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense error reading 'dosageInstruction' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.DosageInstruction = new List <Dosage>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Dosage v_DosageInstruction = new Hl7.Fhir.Model.Dosage(); v_DosageInstruction.DeserializeJson(ref reader, options); current.DosageInstruction.Add(v_DosageInstruction); if (!reader.Read()) { throw new JsonException($"MedicationDispense error reading 'dosageInstruction' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.DosageInstruction.Count == 0) { current.DosageInstruction = null; } break; case "substitution": current.Substitution = new Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent(); ((Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)current.Substitution).DeserializeJson(ref reader, options); break; case "detectedIssue": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense error reading 'detectedIssue' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.DetectedIssue = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_DetectedIssue = new Hl7.Fhir.Model.ResourceReference(); v_DetectedIssue.DeserializeJson(ref reader, options); current.DetectedIssue.Add(v_DetectedIssue); if (!reader.Read()) { throw new JsonException($"MedicationDispense error reading 'detectedIssue' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.DetectedIssue.Count == 0) { current.DetectedIssue = null; } break; case "eventHistory": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"MedicationDispense error reading 'eventHistory' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.EventHistory = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_EventHistory = new Hl7.Fhir.Model.ResourceReference(); v_EventHistory.DeserializeJson(ref reader, options); current.EventHistory.Add(v_EventHistory); if (!reader.Read()) { throw new JsonException($"MedicationDispense error reading 'eventHistory' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.EventHistory.Count == 0) { current.EventHistory = null; } break; // Complex: MedicationDispense, Export: MedicationDispense, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR FamilyMemberHistory#Condition /// </summary> public static void DeserializeJsonProperty(this FamilyMemberHistory.ConditionComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "code": current.Code = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Code).DeserializeJson(ref reader, options); break; case "outcome": current.Outcome = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Outcome).DeserializeJson(ref reader, options); break; case "contributedToDeath": if (reader.TokenType == JsonTokenType.Null) { current.ContributedToDeathElement = new FhirBoolean(); reader.Skip(); } else { current.ContributedToDeathElement = new FhirBoolean(reader.GetBoolean()); } break; case "_contributedToDeath": if (current.ContributedToDeathElement == null) { current.ContributedToDeathElement = new FhirBoolean(); } ((Hl7.Fhir.Model.Element)current.ContributedToDeathElement).DeserializeJson(ref reader, options); break; case "onsetAge": current.Onset = new Hl7.Fhir.Model.Age(); ((Hl7.Fhir.Model.Age)current.Onset).DeserializeJson(ref reader, options); break; case "onsetRange": current.Onset = new Hl7.Fhir.Model.Range(); ((Hl7.Fhir.Model.Range)current.Onset).DeserializeJson(ref reader, options); break; case "onsetPeriod": current.Onset = new Hl7.Fhir.Model.Period(); ((Hl7.Fhir.Model.Period)current.Onset).DeserializeJson(ref reader, options); break; case "onsetString": if (reader.TokenType == JsonTokenType.Null) { current.Onset = new FhirString(); reader.Skip(); } else { current.Onset = new FhirString(reader.GetString()); } break; case "_onsetString": if (current.Onset == null) { current.Onset = new FhirString(); } ((Hl7.Fhir.Model.Element)current.Onset).DeserializeJson(ref reader, options); break; case "note": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"ConditionComponent 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($"ConditionComponent 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; // Complex: condition, Export: ConditionComponent, Base: BackboneElement default: ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }