/// <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 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; } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as MedicationUsage; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (BasedOn != null) { dest.BasedOn = new List <Hl7.Fhir.Model.ResourceReference>(BasedOn.DeepCopy()); } if (PartOf != null) { dest.PartOf = new List <Hl7.Fhir.Model.ResourceReference>(PartOf.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationUsage.MedicationUsageStatusCodes>)StatusElement.DeepCopy(); } if (StatusReason != null) { dest.StatusReason = new List <Hl7.Fhir.Model.CodeableConcept>(StatusReason.DeepCopy()); } if (Category != null) { dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy()); } if (Medication != null) { dest.Medication = (Hl7.Fhir.Model.CodeableReference)Medication.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Encounter != null) { dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy(); } if (Effective != null) { dest.Effective = (Hl7.Fhir.Model.Element)Effective.DeepCopy(); } if (DateAssertedElement != null) { dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopy(); } if (InformationSource != null) { dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopy(); } if (DerivedFrom != null) { dest.DerivedFrom = new List <Hl7.Fhir.Model.ResourceReference>(DerivedFrom.DeepCopy()); } if (Reason != null) { dest.Reason = new List <Hl7.Fhir.Model.CodeableReference>(Reason.DeepCopy()); } if (Note != null) { dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy()); } if (RenderedDosageInstructionElement != null) { dest.RenderedDosageInstructionElement = (Hl7.Fhir.Model.FhirString)RenderedDosageInstructionElement.DeepCopy(); } if (Dosage != null) { dest.Dosage = new List <Hl7.Fhir.Model.Dosage>(Dosage.DeepCopy()); } if (TakenAsOrderedElement != null) { dest.TakenAsOrderedElement = (Hl7.Fhir.Model.FhirBoolean)TakenAsOrderedElement.DeepCopy(); } return(dest); }