/// <summary> /// Deserialize JSON into a FHIR Organization /// </summary> public static void DeserializeJsonProperty(this Organization current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Organization 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($"Organization 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 "active": if (reader.TokenType == JsonTokenType.Null) { current.ActiveElement = new FhirBoolean(); reader.Skip(); } else { current.ActiveElement = new FhirBoolean(reader.GetBoolean()); } break; case "_active": if (current.ActiveElement == null) { current.ActiveElement = new FhirBoolean(); } ((Hl7.Fhir.Model.Element)current.ActiveElement).DeserializeJson(ref reader, options); break; case "type": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Organization error reading 'type' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Type = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Type = new Hl7.Fhir.Model.CodeableConcept(); v_Type.DeserializeJson(ref reader, options); current.Type.Add(v_Type); if (!reader.Read()) { throw new JsonException($"Organization error reading 'type' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Type.Count == 0) { current.Type = 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 "alias": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Organization error reading 'alias' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.AliasElement = new List <FhirString>(); while (reader.TokenType != JsonTokenType.EndArray) { if (reader.TokenType == JsonTokenType.Null) { current.AliasElement.Add(new FhirString()); reader.Skip(); } else { current.AliasElement.Add(new FhirString(reader.GetString())); } if (!reader.Read()) { throw new JsonException($"Organization error reading 'alias' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.AliasElement.Count == 0) { current.AliasElement = null; } break; case "_alias": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Organization error reading 'alias' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } int i_alias = 0; while (reader.TokenType != JsonTokenType.EndArray) { if (i_alias >= current.AliasElement.Count) { current.AliasElement.Add(new FhirString()); } if (reader.TokenType == JsonTokenType.Null) { reader.Skip(); } else { ((Hl7.Fhir.Model.Element)current.AliasElement[i_alias++]).DeserializeJson(ref reader, options); } if (!reader.Read()) { throw new JsonException($"Organization error reading 'alias' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } break; case "telecom": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Organization 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($"Organization 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 "address": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Organization error reading 'address' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Address = new List <Address>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Address v_Address = new Hl7.Fhir.Model.Address(); v_Address.DeserializeJson(ref reader, options); current.Address.Add(v_Address); if (!reader.Read()) { throw new JsonException($"Organization error reading 'address' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Address.Count == 0) { current.Address = null; } break; case "partOf": current.PartOf = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.PartOf).DeserializeJson(ref reader, options); break; case "contact": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Organization error reading 'contact' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Contact = new List <Organization.ContactComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Organization.ContactComponent v_Contact = new Hl7.Fhir.Model.Organization.ContactComponent(); v_Contact.DeserializeJson(ref reader, options); current.Contact.Add(v_Contact); if (!reader.Read()) { throw new JsonException($"Organization 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 "endpoint": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Organization error reading 'endpoint' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Endpoint = new List <ResourceReference>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.ResourceReference v_Endpoint = new Hl7.Fhir.Model.ResourceReference(); v_Endpoint.DeserializeJson(ref reader, options); current.Endpoint.Add(v_Endpoint); if (!reader.Read()) { throw new JsonException($"Organization error reading 'endpoint' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Endpoint.Count == 0) { current.Endpoint = null; } break; // Complex: Organization, Export: Organization, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Deserialize JSON into a FHIR Practitioner /// </summary> public static void DeserializeJsonProperty(this Practitioner current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "identifier": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Practitioner 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($"Practitioner 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 "active": if (reader.TokenType == JsonTokenType.Null) { current.ActiveElement = new FhirBoolean(); reader.Skip(); } else { current.ActiveElement = new FhirBoolean(reader.GetBoolean()); } break; case "_active": if (current.ActiveElement == null) { current.ActiveElement = new FhirBoolean(); } ((Hl7.Fhir.Model.Element)current.ActiveElement).DeserializeJson(ref reader, options); break; case "name": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Practitioner error reading 'name' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Name = new List <HumanName>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.HumanName v_Name = new Hl7.Fhir.Model.HumanName(); v_Name.DeserializeJson(ref reader, options); current.Name.Add(v_Name); if (!reader.Read()) { throw new JsonException($"Practitioner error reading 'name' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Name.Count == 0) { current.Name = null; } break; case "telecom": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Practitioner 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($"Practitioner 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 "address": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Practitioner error reading 'address' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Address = new List <Address>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Address v_Address = new Hl7.Fhir.Model.Address(); v_Address.DeserializeJson(ref reader, options); current.Address.Add(v_Address); if (!reader.Read()) { throw new JsonException($"Practitioner error reading 'address' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Address.Count == 0) { current.Address = null; } break; case "gender": if (reader.TokenType == JsonTokenType.Null) { current.GenderElement = new Code <Hl7.Fhir.Model.AdministrativeGender>(); reader.Skip(); } else { current.GenderElement = new Code <Hl7.Fhir.Model.AdministrativeGender>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.AdministrativeGender>(reader.GetString())); } break; case "_gender": if (current.GenderElement == null) { current.GenderElement = new Code <Hl7.Fhir.Model.AdministrativeGender>(); } ((Hl7.Fhir.Model.Element)current.GenderElement).DeserializeJson(ref reader, options); break; case "birthDate": if (reader.TokenType == JsonTokenType.Null) { current.BirthDateElement = new Date(); reader.Skip(); } else { current.BirthDateElement = new Date(reader.GetString()); } break; case "_birthDate": if (current.BirthDateElement == null) { current.BirthDateElement = new Date(); } ((Hl7.Fhir.Model.Element)current.BirthDateElement).DeserializeJson(ref reader, options); break; case "photo": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Practitioner error reading 'photo' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Photo = new List <Attachment>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Attachment v_Photo = new Hl7.Fhir.Model.Attachment(); v_Photo.DeserializeJson(ref reader, options); current.Photo.Add(v_Photo); if (!reader.Read()) { throw new JsonException($"Practitioner error reading 'photo' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Photo.Count == 0) { current.Photo = null; } break; case "qualification": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Practitioner error reading 'qualification' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Qualification = new List <Practitioner.QualificationComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Practitioner.QualificationComponent v_Qualification = new Hl7.Fhir.Model.Practitioner.QualificationComponent(); v_Qualification.DeserializeJson(ref reader, options); current.Qualification.Add(v_Qualification); if (!reader.Read()) { throw new JsonException($"Practitioner error reading 'qualification' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Qualification.Count == 0) { current.Qualification = null; } break; case "communication": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Practitioner error reading 'communication' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Communication = new List <CodeableConcept>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.CodeableConcept v_Communication = new Hl7.Fhir.Model.CodeableConcept(); v_Communication.DeserializeJson(ref reader, options); current.Communication.Add(v_Communication); if (!reader.Read()) { throw new JsonException($"Practitioner error reading 'communication' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Communication.Count == 0) { current.Communication = null; } break; // Complex: Practitioner, Export: Practitioner, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }