/// <summary> /// Deserialize JSON into a FHIR MedicinalProductInteraction#Interactant /// </summary> public static void DeserializeJson(this MedicinalProductInteraction.InteractantComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options) { string propertyName; while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { return; } if (reader.TokenType == JsonTokenType.PropertyName) { propertyName = reader.GetString(); if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug) { Console.WriteLine($"MedicinalProductInteraction.InteractantComponent >>> MedicinalProductInteraction#Interactant.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } reader.Read(); current.DeserializeJsonProperty(ref reader, options, propertyName); } } throw new JsonException($"MedicinalProductInteraction.InteractantComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); }
/// <summary> /// Serialize a FHIR MedicinalProductInteraction#Interactant into JSON /// </summary> public static void SerializeJson(this MedicinalProductInteraction.InteractantComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } // Component: MedicinalProductInteraction#Interactant, Export: InteractantComponent, Base: BackboneElement (BackboneElement) ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false); if (current.Item != null) { switch (current.Item) { case ResourceReference v_ResourceReference: writer.WritePropertyName("itemReference"); v_ResourceReference.SerializeJson(writer, options); break; case CodeableConcept v_CodeableConcept: writer.WritePropertyName("itemCodeableConcept"); v_CodeableConcept.SerializeJson(writer, options); break; } } if (includeStartObject) { writer.WriteEndObject(); } }
/// <summary> /// Deserialize JSON into a FHIR MedicinalProductInteraction#Interactant /// </summary> public static void DeserializeJsonProperty(this MedicinalProductInteraction.InteractantComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "itemReference": current.Item = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Item).DeserializeJson(ref reader, options); break; case "itemCodeableConcept": current.Item = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Item).DeserializeJson(ref reader, options); break; // Complex: interactant, Export: InteractantComponent, Base: BackboneElement default: ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }