示例#1
0
        /// <summary>
        /// Deserialize JSON into a FHIR PaymentReconciliation#Details
        /// </summary>
        public static void DeserializeJson(this PaymentReconciliation.DetailsComponent 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($"PaymentReconciliation.DetailsComponent >>> PaymentReconciliation#Details.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    reader.Read();
                    current.DeserializeJsonProperty(ref reader, options, propertyName);
                }
            }

            throw new JsonException($"PaymentReconciliation.DetailsComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
示例#2
0
        /// <summary>
        /// Deserialize JSON into a FHIR PaymentReconciliation#Details
        /// </summary>
        public static void DeserializeJsonProperty(this PaymentReconciliation.DetailsComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                current.Identifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.Identifier).DeserializeJson(ref reader, options);
                break;

            case "predecessor":
                current.Predecessor = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.Predecessor).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 "request":
                current.Request = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Request).DeserializeJson(ref reader, options);
                break;

            case "submitter":
                current.Submitter = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Submitter).DeserializeJson(ref reader, options);
                break;

            case "response":
                current.Response = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Response).DeserializeJson(ref reader, options);
                break;

            case "date":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DateElement = new Date();
                    reader.Skip();
                }
                else
                {
                    current.DateElement = new Date(reader.GetString());
                }
                break;

            case "_date":
                if (current.DateElement == null)
                {
                    current.DateElement = new Date();
                }
                ((Hl7.Fhir.Model.Element)current.DateElement).DeserializeJson(ref reader, options);
                break;

            case "responsible":
                current.Responsible = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Responsible).DeserializeJson(ref reader, options);
                break;

            case "payee":
                current.Payee = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Payee).DeserializeJson(ref reader, options);
                break;

            case "amount":
                current.Amount = new Hl7.Fhir.Model.Money();
                ((Hl7.Fhir.Model.Money)current.Amount).DeserializeJson(ref reader, options);
                break;

            // Complex: detail, Export: DetailsComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
示例#3
0
        /// <summary>
        /// Serialize a FHIR PaymentReconciliation#Details into JSON
        /// </summary>
        public static void SerializeJson(this PaymentReconciliation.DetailsComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            // Component: PaymentReconciliation#Details, Export: DetailsComponent, Base: BackboneElement (BackboneElement)
            ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false);

            if (current.Identifier != null)
            {
                writer.WritePropertyName("identifier");
                current.Identifier.SerializeJson(writer, options);
            }

            if (current.Predecessor != null)
            {
                writer.WritePropertyName("predecessor");
                current.Predecessor.SerializeJson(writer, options);
            }

            writer.WritePropertyName("type");
            current.Type.SerializeJson(writer, options);

            if (current.Request != null)
            {
                writer.WritePropertyName("request");
                current.Request.SerializeJson(writer, options);
            }

            if (current.Submitter != null)
            {
                writer.WritePropertyName("submitter");
                current.Submitter.SerializeJson(writer, options);
            }

            if (current.Response != null)
            {
                writer.WritePropertyName("response");
                current.Response.SerializeJson(writer, options);
            }

            if (current.DateElement != null)
            {
                if (!string.IsNullOrEmpty(current.DateElement.Value))
                {
                    writer.WriteString("date", current.DateElement.Value);
                }
                if (current.DateElement.HasExtensions() || (!string.IsNullOrEmpty(current.DateElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_date", false, current.DateElement.Extension, current.DateElement.ElementId);
                }
            }

            if (current.Responsible != null)
            {
                writer.WritePropertyName("responsible");
                current.Responsible.SerializeJson(writer, options);
            }

            if (current.Payee != null)
            {
                writer.WritePropertyName("payee");
                current.Payee.SerializeJson(writer, options);
            }

            if (current.Amount != null)
            {
                writer.WritePropertyName("amount");
                current.Amount.SerializeJson(writer, options);
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }