Esempio n. 1
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Target != null) && (Target.Count != 0))
            {
                writer.WritePropertyName("target");
                writer.WriteStartArray();

                foreach (Reference valTarget in Target)
                {
                    valTarget.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((TargetLocation != null) && (TargetLocation.Count != 0))
            {
                writer.WritePropertyName("targetLocation");
                writer.WriteStartArray();

                foreach (string valTargetLocation in TargetLocation)
                {
                    writer.WriteStringValue(valTargetLocation);
                }

                writer.WriteEndArray();
            }

            if ((_TargetLocation != null) && (_TargetLocation.Count != 0))
            {
                writer.WritePropertyName("_targetLocation");
                writer.WriteStartArray();

                foreach (Element val_TargetLocation in _TargetLocation)
                {
                    val_TargetLocation.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Need != null)
            {
                writer.WritePropertyName("need");
                Need.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

            if (_Status != null)
            {
                writer.WritePropertyName("_status");
                _Status.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(StatusDate))
            {
                writer.WriteString("statusDate", (string)StatusDate !);
            }

            if (_StatusDate != null)
            {
                writer.WritePropertyName("_statusDate");
                _StatusDate.SerializeJson(writer, options);
            }

            if (ValidationType != null)
            {
                writer.WritePropertyName("validationType");
                ValidationType.SerializeJson(writer, options);
            }

            if ((ValidationProcess != null) && (ValidationProcess.Count != 0))
            {
                writer.WritePropertyName("validationProcess");
                writer.WriteStartArray();

                foreach (CodeableConcept valValidationProcess in ValidationProcess)
                {
                    valValidationProcess.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Frequency != null)
            {
                writer.WritePropertyName("frequency");
                Frequency.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(LastPerformed))
            {
                writer.WriteString("lastPerformed", (string)LastPerformed !);
            }

            if (_LastPerformed != null)
            {
                writer.WritePropertyName("_lastPerformed");
                _LastPerformed.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(NextScheduled))
            {
                writer.WriteString("nextScheduled", (string)NextScheduled !);
            }

            if (_NextScheduled != null)
            {
                writer.WritePropertyName("_nextScheduled");
                _NextScheduled.SerializeJson(writer, options);
            }

            if (FailureAction != null)
            {
                writer.WritePropertyName("failureAction");
                FailureAction.SerializeJson(writer, options);
            }

            if ((PrimarySource != null) && (PrimarySource.Count != 0))
            {
                writer.WritePropertyName("primarySource");
                writer.WriteStartArray();

                foreach (VerificationResultPrimarySource valPrimarySource in PrimarySource)
                {
                    valPrimarySource.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Attestation != null)
            {
                writer.WritePropertyName("attestation");
                Attestation.SerializeJson(writer, options);
            }

            if ((Validator != null) && (Validator.Count != 0))
            {
                writer.WritePropertyName("validator");
                writer.WriteStartArray();

                foreach (VerificationResultValidator valValidator in Validator)
                {
                    valValidator.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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