/// <summary> /// Deserialize JSON into a FHIR Account#Coverage /// </summary> public static void DeserializeJson(this Account.CoverageComponent 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($"Account.CoverageComponent >>> Account#Coverage.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } reader.Read(); current.DeserializeJsonProperty(ref reader, options, propertyName); } } throw new JsonException($"Account.CoverageComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); }
/// <summary> /// Deserialize JSON into a FHIR Account#Coverage /// </summary> public static void DeserializeJsonProperty(this Account.CoverageComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "coverage": current.Coverage = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Coverage).DeserializeJson(ref reader, options); break; case "priority": if (reader.TokenType == JsonTokenType.Null) { current.PriorityElement = new PositiveInt(); reader.Skip(); } else { current.PriorityElement = new PositiveInt(reader.GetInt32()); } break; case "_priority": if (current.PriorityElement == null) { current.PriorityElement = new PositiveInt(); } ((Hl7.Fhir.Model.Element)current.PriorityElement).DeserializeJson(ref reader, options); break; // Complex: coverage, Export: CoverageComponent, Base: BackboneElement default: ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Serialize a FHIR Account#Coverage into JSON /// </summary> public static void SerializeJson(this Account.CoverageComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } // Component: Account#Coverage, Export: CoverageComponent, Base: BackboneElement (BackboneElement) ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false); writer.WritePropertyName("coverage"); current.Coverage.SerializeJson(writer, options); if (current.PriorityElement != null) { if (current.PriorityElement.Value != null) { writer.WriteNumber("priority", (int)current.PriorityElement.Value); } if (current.PriorityElement.HasExtensions() || (!string.IsNullOrEmpty(current.PriorityElement.ElementId))) { JsonStreamUtilities.SerializeExtensionList(writer, options, "_priority", false, current.PriorityElement.Extension, current.PriorityElement.ElementId); } } if (includeStartObject) { writer.WriteEndObject(); } }