/// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "about":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                About = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objAbout = new fhirCsR4.Models.Reference();
                    objAbout.DeserializeJson(ref reader, options);
                    About.Add(objAbout);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (About.Count == 0)
                {
                    About = null;
                }

                break;

            case "authoredOn":
                AuthoredOn = reader.GetString();
                break;

            case "_authoredOn":
                _AuthoredOn = new fhirCsR4.Models.Element();
                _AuthoredOn.DeserializeJson(ref reader, options);
                break;

            case "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                BasedOn = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objBasedOn = new fhirCsR4.Models.Reference();
                    objBasedOn.DeserializeJson(ref reader, options);
                    BasedOn.Add(objBasedOn);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (BasedOn.Count == 0)
                {
                    BasedOn = null;
                }

                break;

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Category = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCategory = new fhirCsR4.Models.CodeableConcept();
                    objCategory.DeserializeJson(ref reader, options);
                    Category.Add(objCategory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Category.Count == 0)
                {
                    Category = null;
                }

                break;

            case "doNotPerform":
                DoNotPerform = reader.GetBoolean();
                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "groupIdentifier":
                GroupIdentifier = new fhirCsR4.Models.Identifier();
                GroupIdentifier.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "medium":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Medium = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objMedium = new fhirCsR4.Models.CodeableConcept();
                    objMedium.DeserializeJson(ref reader, options);
                    Medium.Add(objMedium);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Medium.Count == 0)
                {
                    Medium = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "occurrenceDateTime":
                OccurrenceDateTime = reader.GetString();
                break;

            case "_occurrenceDateTime":
                _OccurrenceDateTime = new fhirCsR4.Models.Element();
                _OccurrenceDateTime.DeserializeJson(ref reader, options);
                break;

            case "occurrencePeriod":
                OccurrencePeriod = new fhirCsR4.Models.Period();
                OccurrencePeriod.DeserializeJson(ref reader, options);
                break;

            case "payload":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Payload = new List <CommunicationRequestPayload>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CommunicationRequestPayload objPayload = new fhirCsR4.Models.CommunicationRequestPayload();
                    objPayload.DeserializeJson(ref reader, options);
                    Payload.Add(objPayload);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Payload.Count == 0)
                {
                    Payload = null;
                }

                break;

            case "priority":
                Priority = reader.GetString();
                break;

            case "_priority":
                _Priority = new fhirCsR4.Models.Element();
                _Priority.DeserializeJson(ref reader, options);
                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "recipient":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Recipient = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objRecipient = new fhirCsR4.Models.Reference();
                    objRecipient.DeserializeJson(ref reader, options);
                    Recipient.Add(objRecipient);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Recipient.Count == 0)
                {
                    Recipient = null;
                }

                break;

            case "replaces":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Replaces = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReplaces = new fhirCsR4.Models.Reference();
                    objReplaces.DeserializeJson(ref reader, options);
                    Replaces.Add(objReplaces);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Replaces.Count == 0)
                {
                    Replaces = null;
                }

                break;

            case "requester":
                Requester = new fhirCsR4.Models.Reference();
                Requester.DeserializeJson(ref reader, options);
                break;

            case "sender":
                Sender = new fhirCsR4.Models.Reference();
                Sender.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "statusReason":
                StatusReason = new fhirCsR4.Models.CodeableConcept();
                StatusReason.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #2
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "url":
                Url = reader.GetString();
                break;

            case "_url":
                _Url = new fhirCsR4.Models.Element();
                _Url.DeserializeJson(ref reader, options);
                break;

            case "valueBase64Binary":
                ValueBase64Binary = System.Convert.FromBase64String(reader.GetString());
                break;

            case "valueBoolean":
                ValueBoolean = reader.GetBoolean();
                break;

            case "valueCanonical":
                ValueCanonical = reader.GetString();
                break;

            case "_valueCanonical":
                _ValueCanonical = new fhirCsR4.Models.Element();
                _ValueCanonical.DeserializeJson(ref reader, options);
                break;

            case "valueCode":
                ValueCode = reader.GetString();
                break;

            case "_valueCode":
                _ValueCode = new fhirCsR4.Models.Element();
                _ValueCode.DeserializeJson(ref reader, options);
                break;

            case "valueDate":
                ValueDate = reader.GetString();
                break;

            case "_valueDate":
                _ValueDate = new fhirCsR4.Models.Element();
                _ValueDate.DeserializeJson(ref reader, options);
                break;

            case "valueDateTime":
                ValueDateTime = reader.GetString();
                break;

            case "_valueDateTime":
                _ValueDateTime = new fhirCsR4.Models.Element();
                _ValueDateTime.DeserializeJson(ref reader, options);
                break;

            case "valueDecimal":
                ValueDecimal = reader.GetDecimal();
                break;

            case "_valueDecimal":
                _ValueDecimal = new fhirCsR4.Models.Element();
                _ValueDecimal.DeserializeJson(ref reader, options);
                break;

            case "valueId":
                ValueId = reader.GetString();
                break;

            case "_valueId":
                _ValueId = new fhirCsR4.Models.Element();
                _ValueId.DeserializeJson(ref reader, options);
                break;

            case "valueInstant":
                ValueInstant = reader.GetString();
                break;

            case "_valueInstant":
                _ValueInstant = new fhirCsR4.Models.Element();
                _ValueInstant.DeserializeJson(ref reader, options);
                break;

            case "valueInteger":
                ValueInteger = reader.GetInt32();
                break;

            case "valueMarkdown":
                ValueMarkdown = reader.GetString();
                break;

            case "_valueMarkdown":
                _ValueMarkdown = new fhirCsR4.Models.Element();
                _ValueMarkdown.DeserializeJson(ref reader, options);
                break;

            case "valueOid":
                ValueOid = reader.GetString();
                break;

            case "_valueOid":
                _ValueOid = new fhirCsR4.Models.Element();
                _ValueOid.DeserializeJson(ref reader, options);
                break;

            case "valuePositiveInt":
                ValuePositiveInt = reader.GetUInt32();
                break;

            case "valueString":
                ValueString = reader.GetString();
                break;

            case "_valueString":
                _ValueString = new fhirCsR4.Models.Element();
                _ValueString.DeserializeJson(ref reader, options);
                break;

            case "valueTime":
                ValueTime = reader.GetString();
                break;

            case "_valueTime":
                _ValueTime = new fhirCsR4.Models.Element();
                _ValueTime.DeserializeJson(ref reader, options);
                break;

            case "valueUnsignedInt":
                ValueUnsignedInt = reader.GetUInt32();
                break;

            case "valueUri":
                ValueUri = reader.GetString();
                break;

            case "_valueUri":
                _ValueUri = new fhirCsR4.Models.Element();
                _ValueUri.DeserializeJson(ref reader, options);
                break;

            case "valueUrl":
                ValueUrl = reader.GetString();
                break;

            case "_valueUrl":
                _ValueUrl = new fhirCsR4.Models.Element();
                _ValueUrl.DeserializeJson(ref reader, options);
                break;

            case "valueUuid":
                ValueUuid = reader.GetGuid();
                break;

            case "valueAddress":
                ValueAddress = new fhirCsR4.Models.Address();
                ValueAddress.DeserializeJson(ref reader, options);
                break;

            case "valueAge":
                ValueAge = new fhirCsR4.Models.Age();
                ValueAge.DeserializeJson(ref reader, options);
                break;

            case "valueAnnotation":
                ValueAnnotation = new fhirCsR4.Models.Annotation();
                ValueAnnotation.DeserializeJson(ref reader, options);
                break;

            case "valueAttachment":
                ValueAttachment = new fhirCsR4.Models.Attachment();
                ValueAttachment.DeserializeJson(ref reader, options);
                break;

            case "valueCodeableConcept":
                ValueCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                ValueCodeableConcept.DeserializeJson(ref reader, options);
                break;

            case "valueCoding":
                ValueCoding = new fhirCsR4.Models.Coding();
                ValueCoding.DeserializeJson(ref reader, options);
                break;

            case "valueContactPoint":
                ValueContactPoint = new fhirCsR4.Models.ContactPoint();
                ValueContactPoint.DeserializeJson(ref reader, options);
                break;

            case "valueCount":
                ValueCount = new fhirCsR4.Models.Count();
                ValueCount.DeserializeJson(ref reader, options);
                break;

            case "valueDistance":
                ValueDistance = new fhirCsR4.Models.Distance();
                ValueDistance.DeserializeJson(ref reader, options);
                break;

            case "valueDuration":
                ValueDuration = new fhirCsR4.Models.Duration();
                ValueDuration.DeserializeJson(ref reader, options);
                break;

            case "valueHumanName":
                ValueHumanName = new fhirCsR4.Models.HumanName();
                ValueHumanName.DeserializeJson(ref reader, options);
                break;

            case "valueIdentifier":
                ValueIdentifier = new fhirCsR4.Models.Identifier();
                ValueIdentifier.DeserializeJson(ref reader, options);
                break;

            case "valueMoney":
                ValueMoney = new fhirCsR4.Models.Money();
                ValueMoney.DeserializeJson(ref reader, options);
                break;

            case "valuePeriod":
                ValuePeriod = new fhirCsR4.Models.Period();
                ValuePeriod.DeserializeJson(ref reader, options);
                break;

            case "valueQuantity":
                ValueQuantity = new fhirCsR4.Models.Quantity();
                ValueQuantity.DeserializeJson(ref reader, options);
                break;

            case "valueRange":
                ValueRange = new fhirCsR4.Models.Range();
                ValueRange.DeserializeJson(ref reader, options);
                break;

            case "valueRatio":
                ValueRatio = new fhirCsR4.Models.Ratio();
                ValueRatio.DeserializeJson(ref reader, options);
                break;

            case "valueReference":
                ValueReference = new fhirCsR4.Models.Reference();
                ValueReference.DeserializeJson(ref reader, options);
                break;

            case "valueSampledData":
                ValueSampledData = new fhirCsR4.Models.SampledData();
                ValueSampledData.DeserializeJson(ref reader, options);
                break;

            case "valueSignature":
                ValueSignature = new fhirCsR4.Models.Signature();
                ValueSignature.DeserializeJson(ref reader, options);
                break;

            case "valueTiming":
                ValueTiming = new fhirCsR4.Models.Timing();
                ValueTiming.DeserializeJson(ref reader, options);
                break;

            case "valueContactDetail":
                ValueContactDetail = new fhirCsR4.Models.ContactDetail();
                ValueContactDetail.DeserializeJson(ref reader, options);
                break;

            case "valueContributor":
                ValueContributor = new fhirCsR4.Models.Contributor();
                ValueContributor.DeserializeJson(ref reader, options);
                break;

            case "valueDataRequirement":
                ValueDataRequirement = new fhirCsR4.Models.DataRequirement();
                ValueDataRequirement.DeserializeJson(ref reader, options);
                break;

            case "valueExpression":
                ValueExpression = new fhirCsR4.Models.Expression();
                ValueExpression.DeserializeJson(ref reader, options);
                break;

            case "valueParameterDefinition":
                ValueParameterDefinition = new fhirCsR4.Models.ParameterDefinition();
                ValueParameterDefinition.DeserializeJson(ref reader, options);
                break;

            case "valueRelatedArtifact":
                ValueRelatedArtifact = new fhirCsR4.Models.RelatedArtifact();
                ValueRelatedArtifact.DeserializeJson(ref reader, options);
                break;

            case "valueTriggerDefinition":
                ValueTriggerDefinition = new fhirCsR4.Models.TriggerDefinition();
                ValueTriggerDefinition.DeserializeJson(ref reader, options);
                break;

            case "valueUsageContext":
                ValueUsageContext = new fhirCsR4.Models.UsageContext();
                ValueUsageContext.DeserializeJson(ref reader, options);
                break;

            case "valueDosage":
                ValueDosage = new fhirCsR4.Models.Dosage();
                ValueDosage.DeserializeJson(ref reader, options);
                break;

            case "valueMeta":
                ValueMeta = new fhirCsR4.Models.Meta();
                ValueMeta.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.Element) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #3
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "arm":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Arm = new List <ResearchStudyArm>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ResearchStudyArm objArm = new fhirCsR4.Models.ResearchStudyArm();
                    objArm.DeserializeJson(ref reader, options);
                    Arm.Add(objArm);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Arm.Count == 0)
                {
                    Arm = null;
                }

                break;

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Category = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCategory = new fhirCsR4.Models.CodeableConcept();
                    objCategory.DeserializeJson(ref reader, options);
                    Category.Add(objCategory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Category.Count == 0)
                {
                    Category = null;
                }

                break;

            case "condition":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Condition = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCondition = new fhirCsR4.Models.CodeableConcept();
                    objCondition.DeserializeJson(ref reader, options);
                    Condition.Add(objCondition);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Condition.Count == 0)
                {
                    Condition = null;
                }

                break;

            case "contact":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Contact = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ContactDetail objContact = new fhirCsR4.Models.ContactDetail();
                    objContact.DeserializeJson(ref reader, options);
                    Contact.Add(objContact);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Contact.Count == 0)
                {
                    Contact = null;
                }

                break;

            case "description":
                Description = reader.GetString();
                break;

            case "_description":
                _Description = new fhirCsR4.Models.Element();
                _Description.DeserializeJson(ref reader, options);
                break;

            case "enrollment":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Enrollment = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objEnrollment = new fhirCsR4.Models.Reference();
                    objEnrollment.DeserializeJson(ref reader, options);
                    Enrollment.Add(objEnrollment);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Enrollment.Count == 0)
                {
                    Enrollment = null;
                }

                break;

            case "focus":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Focus = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objFocus = new fhirCsR4.Models.CodeableConcept();
                    objFocus.DeserializeJson(ref reader, options);
                    Focus.Add(objFocus);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Focus.Count == 0)
                {
                    Focus = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "keyword":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Keyword = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objKeyword = new fhirCsR4.Models.CodeableConcept();
                    objKeyword.DeserializeJson(ref reader, options);
                    Keyword.Add(objKeyword);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Keyword.Count == 0)
                {
                    Keyword = null;
                }

                break;

            case "location":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Location = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objLocation = new fhirCsR4.Models.CodeableConcept();
                    objLocation.DeserializeJson(ref reader, options);
                    Location.Add(objLocation);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Location.Count == 0)
                {
                    Location = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "objective":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Objective = new List <ResearchStudyObjective>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ResearchStudyObjective objObjective = new fhirCsR4.Models.ResearchStudyObjective();
                    objObjective.DeserializeJson(ref reader, options);
                    Objective.Add(objObjective);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Objective.Count == 0)
                {
                    Objective = null;
                }

                break;

            case "partOf":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PartOf = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPartOf = new fhirCsR4.Models.Reference();
                    objPartOf.DeserializeJson(ref reader, options);
                    PartOf.Add(objPartOf);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PartOf.Count == 0)
                {
                    PartOf = null;
                }

                break;

            case "period":
                Period = new fhirCsR4.Models.Period();
                Period.DeserializeJson(ref reader, options);
                break;

            case "phase":
                Phase = new fhirCsR4.Models.CodeableConcept();
                Phase.DeserializeJson(ref reader, options);
                break;

            case "primaryPurposeType":
                PrimaryPurposeType = new fhirCsR4.Models.CodeableConcept();
                PrimaryPurposeType.DeserializeJson(ref reader, options);
                break;

            case "principalInvestigator":
                PrincipalInvestigator = new fhirCsR4.Models.Reference();
                PrincipalInvestigator.DeserializeJson(ref reader, options);
                break;

            case "protocol":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Protocol = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objProtocol = new fhirCsR4.Models.Reference();
                    objProtocol.DeserializeJson(ref reader, options);
                    Protocol.Add(objProtocol);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Protocol.Count == 0)
                {
                    Protocol = null;
                }

                break;

            case "reasonStopped":
                ReasonStopped = new fhirCsR4.Models.CodeableConcept();
                ReasonStopped.DeserializeJson(ref reader, options);
                break;

            case "relatedArtifact":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                RelatedArtifact = new List <RelatedArtifact>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.RelatedArtifact objRelatedArtifact = new fhirCsR4.Models.RelatedArtifact();
                    objRelatedArtifact.DeserializeJson(ref reader, options);
                    RelatedArtifact.Add(objRelatedArtifact);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (RelatedArtifact.Count == 0)
                {
                    RelatedArtifact = null;
                }

                break;

            case "site":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Site = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objSite = new fhirCsR4.Models.Reference();
                    objSite.DeserializeJson(ref reader, options);
                    Site.Add(objSite);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Site.Count == 0)
                {
                    Site = null;
                }

                break;

            case "sponsor":
                Sponsor = new fhirCsR4.Models.Reference();
                Sponsor.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "title":
                Title = reader.GetString();
                break;

            case "_title":
                _Title = new fhirCsR4.Models.Element();
                _Title.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #4
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "ageAge":
                AgeAge = new fhirCsR4.Models.Age();
                AgeAge.DeserializeJson(ref reader, options);
                break;

            case "ageRange":
                AgeRange = new fhirCsR4.Models.Range();
                AgeRange.DeserializeJson(ref reader, options);
                break;

            case "ageString":
                AgeString = reader.GetString();
                break;

            case "_ageString":
                _AgeString = new fhirCsR4.Models.Element();
                _AgeString.DeserializeJson(ref reader, options);
                break;

            case "bornPeriod":
                BornPeriod = new fhirCsR4.Models.Period();
                BornPeriod.DeserializeJson(ref reader, options);
                break;

            case "bornDate":
                BornDate = reader.GetString();
                break;

            case "_bornDate":
                _BornDate = new fhirCsR4.Models.Element();
                _BornDate.DeserializeJson(ref reader, options);
                break;

            case "bornString":
                BornString = reader.GetString();
                break;

            case "_bornString":
                _BornString = new fhirCsR4.Models.Element();
                _BornString.DeserializeJson(ref reader, options);
                break;

            case "condition":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Condition = new List <FamilyMemberHistoryCondition>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.FamilyMemberHistoryCondition objCondition = new fhirCsR4.Models.FamilyMemberHistoryCondition();
                    objCondition.DeserializeJson(ref reader, options);
                    Condition.Add(objCondition);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Condition.Count == 0)
                {
                    Condition = null;
                }

                break;

            case "dataAbsentReason":
                DataAbsentReason = new fhirCsR4.Models.CodeableConcept();
                DataAbsentReason.DeserializeJson(ref reader, options);
                break;

            case "date":
                Date = reader.GetString();
                break;

            case "_date":
                _Date = new fhirCsR4.Models.Element();
                _Date.DeserializeJson(ref reader, options);
                break;

            case "deceasedBoolean":
                DeceasedBoolean = reader.GetBoolean();
                break;

            case "deceasedAge":
                DeceasedAge = new fhirCsR4.Models.Age();
                DeceasedAge.DeserializeJson(ref reader, options);
                break;

            case "deceasedRange":
                DeceasedRange = new fhirCsR4.Models.Range();
                DeceasedRange.DeserializeJson(ref reader, options);
                break;

            case "deceasedDate":
                DeceasedDate = reader.GetString();
                break;

            case "_deceasedDate":
                _DeceasedDate = new fhirCsR4.Models.Element();
                _DeceasedDate.DeserializeJson(ref reader, options);
                break;

            case "deceasedString":
                DeceasedString = reader.GetString();
                break;

            case "_deceasedString":
                _DeceasedString = new fhirCsR4.Models.Element();
                _DeceasedString.DeserializeJson(ref reader, options);
                break;

            case "estimatedAge":
                EstimatedAge = reader.GetBoolean();
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "instantiatesCanonical":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                InstantiatesCanonical = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    InstantiatesCanonical.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (InstantiatesCanonical.Count == 0)
                {
                    InstantiatesCanonical = null;
                }

                break;

            case "_instantiatesCanonical":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _InstantiatesCanonical = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_InstantiatesCanonical = new fhirCsR4.Models.Element();
                    obj_InstantiatesCanonical.DeserializeJson(ref reader, options);
                    _InstantiatesCanonical.Add(obj_InstantiatesCanonical);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_InstantiatesCanonical.Count == 0)
                {
                    _InstantiatesCanonical = null;
                }

                break;

            case "instantiatesUri":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                InstantiatesUri = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    InstantiatesUri.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (InstantiatesUri.Count == 0)
                {
                    InstantiatesUri = null;
                }

                break;

            case "_instantiatesUri":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _InstantiatesUri = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_InstantiatesUri = new fhirCsR4.Models.Element();
                    obj_InstantiatesUri.DeserializeJson(ref reader, options);
                    _InstantiatesUri.Add(obj_InstantiatesUri);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_InstantiatesUri.Count == 0)
                {
                    _InstantiatesUri = null;
                }

                break;

            case "name":
                Name = reader.GetString();
                break;

            case "_name":
                _Name = new fhirCsR4.Models.Element();
                _Name.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "patient":
                Patient = new fhirCsR4.Models.Reference();
                Patient.DeserializeJson(ref reader, options);
                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "relationship":
                Relationship = new fhirCsR4.Models.CodeableConcept();
                Relationship.DeserializeJson(ref reader, options);
                break;

            case "sex":
                Sex = new fhirCsR4.Models.CodeableConcept();
                Sex.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #5
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "authoredOn":
                AuthoredOn = reader.GetString();
                break;

            case "_authoredOn":
                _AuthoredOn = new fhirCsR4.Models.Element();
                _AuthoredOn.DeserializeJson(ref reader, options);
                break;

            case "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                BasedOn = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objBasedOn = new fhirCsR4.Models.Reference();
                    objBasedOn.DeserializeJson(ref reader, options);
                    BasedOn.Add(objBasedOn);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (BasedOn.Count == 0)
                {
                    BasedOn = null;
                }

                break;

            case "codeReference":
                CodeReference = new fhirCsR4.Models.Reference();
                CodeReference.DeserializeJson(ref reader, options);
                break;

            case "codeCodeableConcept":
                CodeCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                CodeCodeableConcept.DeserializeJson(ref reader, options);
                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "groupIdentifier":
                GroupIdentifier = new fhirCsR4.Models.Identifier();
                GroupIdentifier.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "instantiatesCanonical":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                InstantiatesCanonical = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    InstantiatesCanonical.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (InstantiatesCanonical.Count == 0)
                {
                    InstantiatesCanonical = null;
                }

                break;

            case "_instantiatesCanonical":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _InstantiatesCanonical = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_InstantiatesCanonical = new fhirCsR4.Models.Element();
                    obj_InstantiatesCanonical.DeserializeJson(ref reader, options);
                    _InstantiatesCanonical.Add(obj_InstantiatesCanonical);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_InstantiatesCanonical.Count == 0)
                {
                    _InstantiatesCanonical = null;
                }

                break;

            case "instantiatesUri":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                InstantiatesUri = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    InstantiatesUri.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (InstantiatesUri.Count == 0)
                {
                    InstantiatesUri = null;
                }

                break;

            case "_instantiatesUri":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _InstantiatesUri = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_InstantiatesUri = new fhirCsR4.Models.Element();
                    obj_InstantiatesUri.DeserializeJson(ref reader, options);
                    _InstantiatesUri.Add(obj_InstantiatesUri);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_InstantiatesUri.Count == 0)
                {
                    _InstantiatesUri = null;
                }

                break;

            case "insurance":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Insurance = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objInsurance = new fhirCsR4.Models.Reference();
                    objInsurance.DeserializeJson(ref reader, options);
                    Insurance.Add(objInsurance);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Insurance.Count == 0)
                {
                    Insurance = null;
                }

                break;

            case "intent":
                Intent = reader.GetString();
                break;

            case "_intent":
                _Intent = new fhirCsR4.Models.Element();
                _Intent.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "occurrenceDateTime":
                OccurrenceDateTime = reader.GetString();
                break;

            case "_occurrenceDateTime":
                _OccurrenceDateTime = new fhirCsR4.Models.Element();
                _OccurrenceDateTime.DeserializeJson(ref reader, options);
                break;

            case "occurrencePeriod":
                OccurrencePeriod = new fhirCsR4.Models.Period();
                OccurrencePeriod.DeserializeJson(ref reader, options);
                break;

            case "occurrenceTiming":
                OccurrenceTiming = new fhirCsR4.Models.Timing();
                OccurrenceTiming.DeserializeJson(ref reader, options);
                break;

            case "parameter":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Parameter = new List <DeviceRequestParameter>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.DeviceRequestParameter objParameter = new fhirCsR4.Models.DeviceRequestParameter();
                    objParameter.DeserializeJson(ref reader, options);
                    Parameter.Add(objParameter);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Parameter.Count == 0)
                {
                    Parameter = null;
                }

                break;

            case "performer":
                Performer = new fhirCsR4.Models.Reference();
                Performer.DeserializeJson(ref reader, options);
                break;

            case "performerType":
                PerformerType = new fhirCsR4.Models.CodeableConcept();
                PerformerType.DeserializeJson(ref reader, options);
                break;

            case "priority":
                Priority = reader.GetString();
                break;

            case "_priority":
                _Priority = new fhirCsR4.Models.Element();
                _Priority.DeserializeJson(ref reader, options);
                break;

            case "priorRequest":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PriorRequest = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPriorRequest = new fhirCsR4.Models.Reference();
                    objPriorRequest.DeserializeJson(ref reader, options);
                    PriorRequest.Add(objPriorRequest);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PriorRequest.Count == 0)
                {
                    PriorRequest = null;
                }

                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "relevantHistory":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                RelevantHistory = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objRelevantHistory = new fhirCsR4.Models.Reference();
                    objRelevantHistory.DeserializeJson(ref reader, options);
                    RelevantHistory.Add(objRelevantHistory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (RelevantHistory.Count == 0)
                {
                    RelevantHistory = null;
                }

                break;

            case "requester":
                Requester = new fhirCsR4.Models.Reference();
                Requester.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "supportingInfo":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                SupportingInfo = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objSupportingInfo = new fhirCsR4.Models.Reference();
                    objSupportingInfo.DeserializeJson(ref reader, options);
                    SupportingInfo.Add(objSupportingInfo);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (SupportingInfo.Count == 0)
                {
                    SupportingInfo = null;
                }

                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "description":
                Description = reader.GetString();
                break;

            case "_description":
                _Description = new fhirCsR4.Models.Element();
                _Description.DeserializeJson(ref reader, options);
                break;

            case "exposureRoute":
                ExposureRoute = new fhirCsR4.Models.CodeableConcept();
                ExposureRoute.DeserializeJson(ref reader, options);
                break;

            case "manifestation":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Manifestation = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objManifestation = new fhirCsR4.Models.CodeableConcept();
                    objManifestation.DeserializeJson(ref reader, options);
                    Manifestation.Add(objManifestation);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Manifestation.Count == 0)
                {
                    Manifestation = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "onset":
                Onset = reader.GetString();
                break;

            case "_onset":
                _Onset = new fhirCsR4.Models.Element();
                _Onset.DeserializeJson(ref reader, options);
                break;

            case "severity":
                Severity = reader.GetString();
                break;

            case "_severity":
                _Severity = new fhirCsR4.Models.Element();
                _Severity.DeserializeJson(ref reader, options);
                break;

            case "substance":
                Substance = new fhirCsR4.Models.CodeableConcept();
                Substance.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.BackboneElement) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #7
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                BasedOn = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objBasedOn = new fhirCsR4.Models.Reference();
                    objBasedOn.DeserializeJson(ref reader, options);
                    BasedOn.Add(objBasedOn);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (BasedOn.Count == 0)
                {
                    BasedOn = null;
                }

                break;

            case "bodySite":
                BodySite = new fhirCsR4.Models.CodeableConcept();
                BodySite.DeserializeJson(ref reader, options);
                break;

            case "derivedFrom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                DerivedFrom = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objDerivedFrom = new fhirCsR4.Models.Reference();
                    objDerivedFrom.DeserializeJson(ref reader, options);
                    DerivedFrom.Add(objDerivedFrom);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (DerivedFrom.Count == 0)
                {
                    DerivedFrom = null;
                }

                break;

            case "device":
                Device = new fhirCsR4.Models.Reference();
                Device.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "recordedOn":
                RecordedOn = reader.GetString();
                break;

            case "_recordedOn":
                _RecordedOn = new fhirCsR4.Models.Element();
                _RecordedOn.DeserializeJson(ref reader, options);
                break;

            case "source":
                Source = new fhirCsR4.Models.Reference();
                Source.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "timingTiming":
                TimingTiming = new fhirCsR4.Models.Timing();
                TimingTiming.DeserializeJson(ref reader, options);
                break;

            case "timingPeriod":
                TimingPeriod = new fhirCsR4.Models.Period();
                TimingPeriod.DeserializeJson(ref reader, options);
                break;

            case "timingDateTime":
                TimingDateTime = reader.GetString();
                break;

            case "_timingDateTime":
                _TimingDateTime = new fhirCsR4.Models.Element();
                _TimingDateTime.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #8
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "account":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Account = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objAccount = new fhirCsR4.Models.Reference();
                    objAccount.DeserializeJson(ref reader, options);
                    Account.Add(objAccount);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Account.Count == 0)
                {
                    Account = null;
                }

                break;

            case "bodysite":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Bodysite = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objBodysite = new fhirCsR4.Models.CodeableConcept();
                    objBodysite.DeserializeJson(ref reader, options);
                    Bodysite.Add(objBodysite);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Bodysite.Count == 0)
                {
                    Bodysite = null;
                }

                break;

            case "code":
                Code = new fhirCsR4.Models.CodeableConcept();
                Code.DeserializeJson(ref reader, options);
                break;

            case "context":
                Context = new fhirCsR4.Models.Reference();
                Context.DeserializeJson(ref reader, options);
                break;

            case "costCenter":
                CostCenter = new fhirCsR4.Models.Reference();
                CostCenter.DeserializeJson(ref reader, options);
                break;

            case "definitionCanonical":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                DefinitionCanonical = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    DefinitionCanonical.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (DefinitionCanonical.Count == 0)
                {
                    DefinitionCanonical = null;
                }

                break;

            case "_definitionCanonical":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _DefinitionCanonical = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_DefinitionCanonical = new fhirCsR4.Models.Element();
                    obj_DefinitionCanonical.DeserializeJson(ref reader, options);
                    _DefinitionCanonical.Add(obj_DefinitionCanonical);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_DefinitionCanonical.Count == 0)
                {
                    _DefinitionCanonical = null;
                }

                break;

            case "definitionUri":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                DefinitionUri = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    DefinitionUri.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (DefinitionUri.Count == 0)
                {
                    DefinitionUri = null;
                }

                break;

            case "_definitionUri":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _DefinitionUri = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_DefinitionUri = new fhirCsR4.Models.Element();
                    obj_DefinitionUri.DeserializeJson(ref reader, options);
                    _DefinitionUri.Add(obj_DefinitionUri);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_DefinitionUri.Count == 0)
                {
                    _DefinitionUri = null;
                }

                break;

            case "enteredDate":
                EnteredDate = reader.GetString();
                break;

            case "_enteredDate":
                _EnteredDate = new fhirCsR4.Models.Element();
                _EnteredDate.DeserializeJson(ref reader, options);
                break;

            case "enterer":
                Enterer = new fhirCsR4.Models.Reference();
                Enterer.DeserializeJson(ref reader, options);
                break;

            case "factorOverride":
                FactorOverride = reader.GetDecimal();
                break;

            case "_factorOverride":
                _FactorOverride = new fhirCsR4.Models.Element();
                _FactorOverride.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "occurrenceDateTime":
                OccurrenceDateTime = reader.GetString();
                break;

            case "_occurrenceDateTime":
                _OccurrenceDateTime = new fhirCsR4.Models.Element();
                _OccurrenceDateTime.DeserializeJson(ref reader, options);
                break;

            case "occurrencePeriod":
                OccurrencePeriod = new fhirCsR4.Models.Period();
                OccurrencePeriod.DeserializeJson(ref reader, options);
                break;

            case "occurrenceTiming":
                OccurrenceTiming = new fhirCsR4.Models.Timing();
                OccurrenceTiming.DeserializeJson(ref reader, options);
                break;

            case "overrideReason":
                OverrideReason = reader.GetString();
                break;

            case "_overrideReason":
                _OverrideReason = new fhirCsR4.Models.Element();
                _OverrideReason.DeserializeJson(ref reader, options);
                break;

            case "partOf":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PartOf = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPartOf = new fhirCsR4.Models.Reference();
                    objPartOf.DeserializeJson(ref reader, options);
                    PartOf.Add(objPartOf);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PartOf.Count == 0)
                {
                    PartOf = null;
                }

                break;

            case "performer":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Performer = new List <ChargeItemPerformer>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ChargeItemPerformer objPerformer = new fhirCsR4.Models.ChargeItemPerformer();
                    objPerformer.DeserializeJson(ref reader, options);
                    Performer.Add(objPerformer);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Performer.Count == 0)
                {
                    Performer = null;
                }

                break;

            case "performingOrganization":
                PerformingOrganization = new fhirCsR4.Models.Reference();
                PerformingOrganization.DeserializeJson(ref reader, options);
                break;

            case "priceOverride":
                PriceOverride = new fhirCsR4.Models.Money();
                PriceOverride.DeserializeJson(ref reader, options);
                break;

            case "productReference":
                ProductReference = new fhirCsR4.Models.Reference();
                ProductReference.DeserializeJson(ref reader, options);
                break;

            case "productCodeableConcept":
                ProductCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                ProductCodeableConcept.DeserializeJson(ref reader, options);
                break;

            case "quantity":
                Quantity = new fhirCsR4.Models.Quantity();
                Quantity.DeserializeJson(ref reader, options);
                break;

            case "reason":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Reason = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReason = new fhirCsR4.Models.CodeableConcept();
                    objReason.DeserializeJson(ref reader, options);
                    Reason.Add(objReason);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Reason.Count == 0)
                {
                    Reason = null;
                }

                break;

            case "requestingOrganization":
                RequestingOrganization = new fhirCsR4.Models.Reference();
                RequestingOrganization.DeserializeJson(ref reader, options);
                break;

            case "service":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Service = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objService = new fhirCsR4.Models.Reference();
                    objService.DeserializeJson(ref reader, options);
                    Service.Add(objService);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Service.Count == 0)
                {
                    Service = null;
                }

                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "supportingInformation":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                SupportingInformation = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objSupportingInformation = new fhirCsR4.Models.Reference();
                    objSupportingInformation.DeserializeJson(ref reader, options);
                    SupportingInformation.Add(objSupportingInformation);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (SupportingInformation.Count == 0)
                {
                    SupportingInformation = null;
                }

                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #9
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "dataRequirement":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                DataRequirement = new List <DataRequirement>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.DataRequirement objDataRequirement = new fhirCsR4.Models.DataRequirement();
                    objDataRequirement.DeserializeJson(ref reader, options);
                    DataRequirement.Add(objDataRequirement);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (DataRequirement.Count == 0)
                {
                    DataRequirement = null;
                }

                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "evaluationMessage":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                EvaluationMessage = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objEvaluationMessage = new fhirCsR4.Models.Reference();
                    objEvaluationMessage.DeserializeJson(ref reader, options);
                    EvaluationMessage.Add(objEvaluationMessage);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (EvaluationMessage.Count == 0)
                {
                    EvaluationMessage = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "moduleUri":
                ModuleUri = reader.GetString();
                break;

            case "_moduleUri":
                _ModuleUri = new fhirCsR4.Models.Element();
                _ModuleUri.DeserializeJson(ref reader, options);
                break;

            case "moduleCanonical":
                ModuleCanonical = reader.GetString();
                break;

            case "_moduleCanonical":
                _ModuleCanonical = new fhirCsR4.Models.Element();
                _ModuleCanonical.DeserializeJson(ref reader, options);
                break;

            case "moduleCodeableConcept":
                ModuleCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                ModuleCodeableConcept.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "occurrenceDateTime":
                OccurrenceDateTime = reader.GetString();
                break;

            case "_occurrenceDateTime":
                _OccurrenceDateTime = new fhirCsR4.Models.Element();
                _OccurrenceDateTime.DeserializeJson(ref reader, options);
                break;

            case "outputParameters":
                OutputParameters = new fhirCsR4.Models.Reference();
                OutputParameters.DeserializeJson(ref reader, options);
                break;

            case "performer":
                Performer = new fhirCsR4.Models.Reference();
                Performer.DeserializeJson(ref reader, options);
                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "requestIdentifier":
                RequestIdentifier = new fhirCsR4.Models.Identifier();
                RequestIdentifier.DeserializeJson(ref reader, options);
                break;

            case "result":
                Result = new fhirCsR4.Models.Reference();
                Result.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #10
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Category = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCategory = new fhirCsR4.Models.CodeableConcept();
                    objCategory.DeserializeJson(ref reader, options);
                    Category.Add(objCategory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Category.Count == 0)
                {
                    Category = null;
                }

                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "managingOrganization":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ManagingOrganization = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objManagingOrganization = new fhirCsR4.Models.Reference();
                    objManagingOrganization.DeserializeJson(ref reader, options);
                    ManagingOrganization.Add(objManagingOrganization);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ManagingOrganization.Count == 0)
                {
                    ManagingOrganization = null;
                }

                break;

            case "name":
                Name = reader.GetString();
                break;

            case "_name":
                _Name = new fhirCsR4.Models.Element();
                _Name.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "participant":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Participant = new List <CareTeamParticipant>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CareTeamParticipant objParticipant = new fhirCsR4.Models.CareTeamParticipant();
                    objParticipant.DeserializeJson(ref reader, options);
                    Participant.Add(objParticipant);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Participant.Count == 0)
                {
                    Participant = null;
                }

                break;

            case "period":
                Period = new fhirCsR4.Models.Period();
                Period.DeserializeJson(ref reader, options);
                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "telecom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Telecom = new List <ContactPoint>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ContactPoint objTelecom = new fhirCsR4.Models.ContactPoint();
                    objTelecom.DeserializeJson(ref reader, options);
                    Telecom.Add(objTelecom);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Telecom.Count == 0)
                {
                    Telecom = null;
                }

                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "add":
                Add = reader.GetDecimal();
                break;

            case "_add":
                _Add = new fhirCsR4.Models.Element();
                _Add.DeserializeJson(ref reader, options);
                break;

            case "axis":
                Axis = reader.GetInt32();
                break;

            case "backCurve":
                BackCurve = reader.GetDecimal();
                break;

            case "_backCurve":
                _BackCurve = new fhirCsR4.Models.Element();
                _BackCurve.DeserializeJson(ref reader, options);
                break;

            case "brand":
                Brand = reader.GetString();
                break;

            case "_brand":
                _Brand = new fhirCsR4.Models.Element();
                _Brand.DeserializeJson(ref reader, options);
                break;

            case "color":
                Color = reader.GetString();
                break;

            case "_color":
                _Color = new fhirCsR4.Models.Element();
                _Color.DeserializeJson(ref reader, options);
                break;

            case "cylinder":
                Cylinder = reader.GetDecimal();
                break;

            case "_cylinder":
                _Cylinder = new fhirCsR4.Models.Element();
                _Cylinder.DeserializeJson(ref reader, options);
                break;

            case "diameter":
                Diameter = reader.GetDecimal();
                break;

            case "_diameter":
                _Diameter = new fhirCsR4.Models.Element();
                _Diameter.DeserializeJson(ref reader, options);
                break;

            case "duration":
                Duration = new fhirCsR4.Models.Quantity();
                Duration.DeserializeJson(ref reader, options);
                break;

            case "eye":
                Eye = reader.GetString();
                break;

            case "_eye":
                _Eye = new fhirCsR4.Models.Element();
                _Eye.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "power":
                Power = reader.GetDecimal();
                break;

            case "_power":
                _Power = new fhirCsR4.Models.Element();
                _Power.DeserializeJson(ref reader, options);
                break;

            case "prism":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Prism = new List <VisionPrescriptionLensSpecificationPrism>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.VisionPrescriptionLensSpecificationPrism objPrism = new fhirCsR4.Models.VisionPrescriptionLensSpecificationPrism();
                    objPrism.DeserializeJson(ref reader, options);
                    Prism.Add(objPrism);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Prism.Count == 0)
                {
                    Prism = null;
                }

                break;

            case "product":
                Product = new fhirCsR4.Models.CodeableConcept();
                Product.DeserializeJson(ref reader, options);
                break;

            case "sphere":
                Sphere = reader.GetDecimal();
                break;

            case "_sphere":
                _Sphere = new fhirCsR4.Models.Element();
                _Sphere.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.BackboneElement) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #12
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "assessor":
                Assessor = new fhirCsR4.Models.Reference();
                Assessor.DeserializeJson(ref reader, options);
                break;

            case "code":
                Code = new fhirCsR4.Models.CodeableConcept();
                Code.DeserializeJson(ref reader, options);
                break;

            case "date":
                Date = reader.GetString();
                break;

            case "_date":
                _Date = new fhirCsR4.Models.Element();
                _Date.DeserializeJson(ref reader, options);
                break;

            case "description":
                Description = reader.GetString();
                break;

            case "_description":
                _Description = new fhirCsR4.Models.Element();
                _Description.DeserializeJson(ref reader, options);
                break;

            case "effectiveDateTime":
                EffectiveDateTime = reader.GetString();
                break;

            case "_effectiveDateTime":
                _EffectiveDateTime = new fhirCsR4.Models.Element();
                _EffectiveDateTime.DeserializeJson(ref reader, options);
                break;

            case "effectivePeriod":
                EffectivePeriod = new fhirCsR4.Models.Period();
                EffectivePeriod.DeserializeJson(ref reader, options);
                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "finding":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Finding = new List <ClinicalImpressionFinding>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ClinicalImpressionFinding objFinding = new fhirCsR4.Models.ClinicalImpressionFinding();
                    objFinding.DeserializeJson(ref reader, options);
                    Finding.Add(objFinding);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Finding.Count == 0)
                {
                    Finding = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "investigation":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Investigation = new List <ClinicalImpressionInvestigation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ClinicalImpressionInvestigation objInvestigation = new fhirCsR4.Models.ClinicalImpressionInvestigation();
                    objInvestigation.DeserializeJson(ref reader, options);
                    Investigation.Add(objInvestigation);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Investigation.Count == 0)
                {
                    Investigation = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "previous":
                Previous = new fhirCsR4.Models.Reference();
                Previous.DeserializeJson(ref reader, options);
                break;

            case "problem":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Problem = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objProblem = new fhirCsR4.Models.Reference();
                    objProblem.DeserializeJson(ref reader, options);
                    Problem.Add(objProblem);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Problem.Count == 0)
                {
                    Problem = null;
                }

                break;

            case "prognosisCodeableConcept":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PrognosisCodeableConcept = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objPrognosisCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                    objPrognosisCodeableConcept.DeserializeJson(ref reader, options);
                    PrognosisCodeableConcept.Add(objPrognosisCodeableConcept);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PrognosisCodeableConcept.Count == 0)
                {
                    PrognosisCodeableConcept = null;
                }

                break;

            case "prognosisReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PrognosisReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPrognosisReference = new fhirCsR4.Models.Reference();
                    objPrognosisReference.DeserializeJson(ref reader, options);
                    PrognosisReference.Add(objPrognosisReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PrognosisReference.Count == 0)
                {
                    PrognosisReference = null;
                }

                break;

            case "protocol":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Protocol = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Protocol.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Protocol.Count == 0)
                {
                    Protocol = null;
                }

                break;

            case "_protocol":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _Protocol = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_Protocol = new fhirCsR4.Models.Element();
                    obj_Protocol.DeserializeJson(ref reader, options);
                    _Protocol.Add(obj_Protocol);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_Protocol.Count == 0)
                {
                    _Protocol = null;
                }

                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "statusReason":
                StatusReason = new fhirCsR4.Models.CodeableConcept();
                StatusReason.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "summary":
                Summary = reader.GetString();
                break;

            case "_summary":
                _Summary = new fhirCsR4.Models.Element();
                _Summary.DeserializeJson(ref reader, options);
                break;

            case "supportingInfo":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                SupportingInfo = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objSupportingInfo = new fhirCsR4.Models.Reference();
                    objSupportingInfo.DeserializeJson(ref reader, options);
                    SupportingInfo.Add(objSupportingInfo);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (SupportingInfo.Count == 0)
                {
                    SupportingInfo = null;
                }

                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #13
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "category":
                Category = new fhirCsR4.Models.CodeableConcept();
                Category.DeserializeJson(ref reader, options);
                break;

            case "context":
                Context = new fhirCsR4.Models.Reference();
                Context.DeserializeJson(ref reader, options);
                break;

            case "device":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Device = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objDevice = new fhirCsR4.Models.Reference();
                    objDevice.DeserializeJson(ref reader, options);
                    Device.Add(objDevice);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Device.Count == 0)
                {
                    Device = null;
                }

                break;

            case "dosage":
                Dosage = new fhirCsR4.Models.MedicationAdministrationDosage();
                Dosage.DeserializeJson(ref reader, options);
                break;

            case "effectiveDateTime":
                EffectiveDateTime = reader.GetString();
                break;

            case "_effectiveDateTime":
                _EffectiveDateTime = new fhirCsR4.Models.Element();
                _EffectiveDateTime.DeserializeJson(ref reader, options);
                break;

            case "effectivePeriod":
                EffectivePeriod = new fhirCsR4.Models.Period();
                EffectivePeriod.DeserializeJson(ref reader, options);
                break;

            case "eventHistory":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                EventHistory = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objEventHistory = new fhirCsR4.Models.Reference();
                    objEventHistory.DeserializeJson(ref reader, options);
                    EventHistory.Add(objEventHistory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (EventHistory.Count == 0)
                {
                    EventHistory = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "instantiates":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Instantiates = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Instantiates.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Instantiates.Count == 0)
                {
                    Instantiates = null;
                }

                break;

            case "_instantiates":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _Instantiates = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_Instantiates = new fhirCsR4.Models.Element();
                    obj_Instantiates.DeserializeJson(ref reader, options);
                    _Instantiates.Add(obj_Instantiates);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_Instantiates.Count == 0)
                {
                    _Instantiates = null;
                }

                break;

            case "medicationCodeableConcept":
                MedicationCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                MedicationCodeableConcept.DeserializeJson(ref reader, options);
                break;

            case "medicationReference":
                MedicationReference = new fhirCsR4.Models.Reference();
                MedicationReference.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "partOf":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PartOf = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPartOf = new fhirCsR4.Models.Reference();
                    objPartOf.DeserializeJson(ref reader, options);
                    PartOf.Add(objPartOf);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PartOf.Count == 0)
                {
                    PartOf = null;
                }

                break;

            case "performer":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Performer = new List <MedicationAdministrationPerformer>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.MedicationAdministrationPerformer objPerformer = new fhirCsR4.Models.MedicationAdministrationPerformer();
                    objPerformer.DeserializeJson(ref reader, options);
                    Performer.Add(objPerformer);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Performer.Count == 0)
                {
                    Performer = null;
                }

                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "request":
                Request = new fhirCsR4.Models.Reference();
                Request.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "statusReason":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                StatusReason = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objStatusReason = new fhirCsR4.Models.CodeableConcept();
                    objStatusReason.DeserializeJson(ref reader, options);
                    StatusReason.Add(objStatusReason);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (StatusReason.Count == 0)
                {
                    StatusReason = null;
                }

                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "supportingInformation":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                SupportingInformation = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objSupportingInformation = new fhirCsR4.Models.Reference();
                    objSupportingInformation.DeserializeJson(ref reader, options);
                    SupportingInformation.Add(objSupportingInformation);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (SupportingInformation.Count == 0)
                {
                    SupportingInformation = null;
                }

                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #14
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "account":
                Account = new fhirCsR4.Models.Reference();
                Account.DeserializeJson(ref reader, options);
                break;

            case "cancelledReason":
                CancelledReason = reader.GetString();
                break;

            case "_cancelledReason":
                _CancelledReason = new fhirCsR4.Models.Element();
                _CancelledReason.DeserializeJson(ref reader, options);
                break;

            case "date":
                Date = reader.GetString();
                break;

            case "_date":
                _Date = new fhirCsR4.Models.Element();
                _Date.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "issuer":
                Issuer = new fhirCsR4.Models.Reference();
                Issuer.DeserializeJson(ref reader, options);
                break;

            case "lineItem":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                LineItem = new List <InvoiceLineItem>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.InvoiceLineItem objLineItem = new fhirCsR4.Models.InvoiceLineItem();
                    objLineItem.DeserializeJson(ref reader, options);
                    LineItem.Add(objLineItem);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (LineItem.Count == 0)
                {
                    LineItem = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "participant":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Participant = new List <InvoiceParticipant>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.InvoiceParticipant objParticipant = new fhirCsR4.Models.InvoiceParticipant();
                    objParticipant.DeserializeJson(ref reader, options);
                    Participant.Add(objParticipant);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Participant.Count == 0)
                {
                    Participant = null;
                }

                break;

            case "paymentTerms":
                PaymentTerms = reader.GetString();
                break;

            case "_paymentTerms":
                _PaymentTerms = new fhirCsR4.Models.Element();
                _PaymentTerms.DeserializeJson(ref reader, options);
                break;

            case "recipient":
                Recipient = new fhirCsR4.Models.Reference();
                Recipient.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "totalGross":
                TotalGross = new fhirCsR4.Models.Money();
                TotalGross.DeserializeJson(ref reader, options);
                break;

            case "totalNet":
                TotalNet = new fhirCsR4.Models.Money();
                TotalNet.DeserializeJson(ref reader, options);
                break;

            case "totalPriceComponent":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                TotalPriceComponent = new List <InvoiceLineItemPriceComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.InvoiceLineItemPriceComponent objTotalPriceComponent = new fhirCsR4.Models.InvoiceLineItemPriceComponent();
                    objTotalPriceComponent.DeserializeJson(ref reader, options);
                    TotalPriceComponent.Add(objTotalPriceComponent);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (TotalPriceComponent.Count == 0)
                {
                    TotalPriceComponent = null;
                }

                break;

            case "type":
                Type = new fhirCsR4.Models.CodeableConcept();
                Type.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #15
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "approvalDate":
                ApprovalDate = reader.GetString();
                break;

            case "_approvalDate":
                _ApprovalDate = new fhirCsR4.Models.Element();
                _ApprovalDate.DeserializeJson(ref reader, options);
                break;

            case "author":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Author = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ContactDetail objAuthor = new fhirCsR4.Models.ContactDetail();
                    objAuthor.DeserializeJson(ref reader, options);
                    Author.Add(objAuthor);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Author.Count == 0)
                {
                    Author = null;
                }

                break;

            case "contact":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Contact = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ContactDetail objContact = new fhirCsR4.Models.ContactDetail();
                    objContact.DeserializeJson(ref reader, options);
                    Contact.Add(objContact);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Contact.Count == 0)
                {
                    Contact = null;
                }

                break;

            case "copyright":
                Copyright = reader.GetString();
                break;

            case "_copyright":
                _Copyright = new fhirCsR4.Models.Element();
                _Copyright.DeserializeJson(ref reader, options);
                break;

            case "date":
                Date = reader.GetString();
                break;

            case "_date":
                _Date = new fhirCsR4.Models.Element();
                _Date.DeserializeJson(ref reader, options);
                break;

            case "description":
                Description = reader.GetString();
                break;

            case "_description":
                _Description = new fhirCsR4.Models.Element();
                _Description.DeserializeJson(ref reader, options);
                break;

            case "editor":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Editor = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ContactDetail objEditor = new fhirCsR4.Models.ContactDetail();
                    objEditor.DeserializeJson(ref reader, options);
                    Editor.Add(objEditor);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Editor.Count == 0)
                {
                    Editor = null;
                }

                break;

            case "effectivePeriod":
                EffectivePeriod = new fhirCsR4.Models.Period();
                EffectivePeriod.DeserializeJson(ref reader, options);
                break;

            case "endorser":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Endorser = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ContactDetail objEndorser = new fhirCsR4.Models.ContactDetail();
                    objEndorser.DeserializeJson(ref reader, options);
                    Endorser.Add(objEndorser);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Endorser.Count == 0)
                {
                    Endorser = null;
                }

                break;

            case "exposureBackground":
                ExposureBackground = new fhirCsR4.Models.Reference();
                ExposureBackground.DeserializeJson(ref reader, options);
                break;

            case "exposureVariant":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ExposureVariant = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objExposureVariant = new fhirCsR4.Models.Reference();
                    objExposureVariant.DeserializeJson(ref reader, options);
                    ExposureVariant.Add(objExposureVariant);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ExposureVariant.Count == 0)
                {
                    ExposureVariant = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "jurisdiction":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Jurisdiction = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objJurisdiction = new fhirCsR4.Models.CodeableConcept();
                    objJurisdiction.DeserializeJson(ref reader, options);
                    Jurisdiction.Add(objJurisdiction);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Jurisdiction.Count == 0)
                {
                    Jurisdiction = null;
                }

                break;

            case "lastReviewDate":
                LastReviewDate = reader.GetString();
                break;

            case "_lastReviewDate":
                _LastReviewDate = new fhirCsR4.Models.Element();
                _LastReviewDate.DeserializeJson(ref reader, options);
                break;

            case "name":
                Name = reader.GetString();
                break;

            case "_name":
                _Name = new fhirCsR4.Models.Element();
                _Name.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "outcome":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Outcome = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objOutcome = new fhirCsR4.Models.Reference();
                    objOutcome.DeserializeJson(ref reader, options);
                    Outcome.Add(objOutcome);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Outcome.Count == 0)
                {
                    Outcome = null;
                }

                break;

            case "publisher":
                Publisher = reader.GetString();
                break;

            case "_publisher":
                _Publisher = new fhirCsR4.Models.Element();
                _Publisher.DeserializeJson(ref reader, options);
                break;

            case "relatedArtifact":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                RelatedArtifact = new List <RelatedArtifact>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.RelatedArtifact objRelatedArtifact = new fhirCsR4.Models.RelatedArtifact();
                    objRelatedArtifact.DeserializeJson(ref reader, options);
                    RelatedArtifact.Add(objRelatedArtifact);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (RelatedArtifact.Count == 0)
                {
                    RelatedArtifact = null;
                }

                break;

            case "reviewer":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Reviewer = new List <ContactDetail>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ContactDetail objReviewer = new fhirCsR4.Models.ContactDetail();
                    objReviewer.DeserializeJson(ref reader, options);
                    Reviewer.Add(objReviewer);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Reviewer.Count == 0)
                {
                    Reviewer = null;
                }

                break;

            case "shortTitle":
                ShortTitle = reader.GetString();
                break;

            case "_shortTitle":
                _ShortTitle = new fhirCsR4.Models.Element();
                _ShortTitle.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subtitle":
                Subtitle = reader.GetString();
                break;

            case "_subtitle":
                _Subtitle = new fhirCsR4.Models.Element();
                _Subtitle.DeserializeJson(ref reader, options);
                break;

            case "title":
                Title = reader.GetString();
                break;

            case "_title":
                _Title = new fhirCsR4.Models.Element();
                _Title.DeserializeJson(ref reader, options);
                break;

            case "topic":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Topic = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objTopic = new fhirCsR4.Models.CodeableConcept();
                    objTopic.DeserializeJson(ref reader, options);
                    Topic.Add(objTopic);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Topic.Count == 0)
                {
                    Topic = null;
                }

                break;

            case "url":
                Url = reader.GetString();
                break;

            case "_url":
                _Url = new fhirCsR4.Models.Element();
                _Url.DeserializeJson(ref reader, options);
                break;

            case "useContext":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                UseContext = new List <UsageContext>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.UsageContext objUseContext = new fhirCsR4.Models.UsageContext();
                    objUseContext.DeserializeJson(ref reader, options);
                    UseContext.Add(objUseContext);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (UseContext.Count == 0)
                {
                    UseContext = null;
                }

                break;

            case "version":
                Version = reader.GetString();
                break;

            case "_version":
                _Version = new fhirCsR4.Models.Element();
                _Version.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #16
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "abatementDateTime":
                AbatementDateTime = reader.GetString();
                break;

            case "_abatementDateTime":
                _AbatementDateTime = new fhirCsR4.Models.Element();
                _AbatementDateTime.DeserializeJson(ref reader, options);
                break;

            case "abatementAge":
                AbatementAge = new fhirCsR4.Models.Age();
                AbatementAge.DeserializeJson(ref reader, options);
                break;

            case "abatementPeriod":
                AbatementPeriod = new fhirCsR4.Models.Period();
                AbatementPeriod.DeserializeJson(ref reader, options);
                break;

            case "abatementRange":
                AbatementRange = new fhirCsR4.Models.Range();
                AbatementRange.DeserializeJson(ref reader, options);
                break;

            case "abatementString":
                AbatementString = reader.GetString();
                break;

            case "_abatementString":
                _AbatementString = new fhirCsR4.Models.Element();
                _AbatementString.DeserializeJson(ref reader, options);
                break;

            case "asserter":
                Asserter = new fhirCsR4.Models.Reference();
                Asserter.DeserializeJson(ref reader, options);
                break;

            case "bodySite":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                BodySite = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objBodySite = new fhirCsR4.Models.CodeableConcept();
                    objBodySite.DeserializeJson(ref reader, options);
                    BodySite.Add(objBodySite);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (BodySite.Count == 0)
                {
                    BodySite = null;
                }

                break;

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Category = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCategory = new fhirCsR4.Models.CodeableConcept();
                    objCategory.DeserializeJson(ref reader, options);
                    Category.Add(objCategory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Category.Count == 0)
                {
                    Category = null;
                }

                break;

            case "clinicalStatus":
                ClinicalStatus = new fhirCsR4.Models.CodeableConcept();
                ClinicalStatus.DeserializeJson(ref reader, options);
                break;

            case "code":
                Code = new fhirCsR4.Models.CodeableConcept();
                Code.DeserializeJson(ref reader, options);
                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "evidence":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Evidence = new List <ConditionEvidence>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ConditionEvidence objEvidence = new fhirCsR4.Models.ConditionEvidence();
                    objEvidence.DeserializeJson(ref reader, options);
                    Evidence.Add(objEvidence);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Evidence.Count == 0)
                {
                    Evidence = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "onsetDateTime":
                OnsetDateTime = reader.GetString();
                break;

            case "_onsetDateTime":
                _OnsetDateTime = new fhirCsR4.Models.Element();
                _OnsetDateTime.DeserializeJson(ref reader, options);
                break;

            case "onsetAge":
                OnsetAge = new fhirCsR4.Models.Age();
                OnsetAge.DeserializeJson(ref reader, options);
                break;

            case "onsetPeriod":
                OnsetPeriod = new fhirCsR4.Models.Period();
                OnsetPeriod.DeserializeJson(ref reader, options);
                break;

            case "onsetRange":
                OnsetRange = new fhirCsR4.Models.Range();
                OnsetRange.DeserializeJson(ref reader, options);
                break;

            case "onsetString":
                OnsetString = reader.GetString();
                break;

            case "_onsetString":
                _OnsetString = new fhirCsR4.Models.Element();
                _OnsetString.DeserializeJson(ref reader, options);
                break;

            case "recordedDate":
                RecordedDate = reader.GetString();
                break;

            case "_recordedDate":
                _RecordedDate = new fhirCsR4.Models.Element();
                _RecordedDate.DeserializeJson(ref reader, options);
                break;

            case "recorder":
                Recorder = new fhirCsR4.Models.Reference();
                Recorder.DeserializeJson(ref reader, options);
                break;

            case "severity":
                Severity = new fhirCsR4.Models.CodeableConcept();
                Severity.DeserializeJson(ref reader, options);
                break;

            case "stage":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Stage = new List <ConditionStage>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ConditionStage objStage = new fhirCsR4.Models.ConditionStage();
                    objStage.DeserializeJson(ref reader, options);
                    Stage.Add(objStage);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Stage.Count == 0)
                {
                    Stage = null;
                }

                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "verificationStatus":
                VerificationStatus = new fhirCsR4.Models.CodeableConcept();
                VerificationStatus.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #17
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                BasedOn = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objBasedOn = new fhirCsR4.Models.Reference();
                    objBasedOn.DeserializeJson(ref reader, options);
                    BasedOn.Add(objBasedOn);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (BasedOn.Count == 0)
                {
                    BasedOn = null;
                }

                break;

            case "bodySite":
                BodySite = new fhirCsR4.Models.CodeableConcept();
                BodySite.DeserializeJson(ref reader, options);
                break;

            case "content":
                Content = new fhirCsR4.Models.Attachment();
                Content.DeserializeJson(ref reader, options);
                break;

            case "createdDateTime":
                CreatedDateTime = reader.GetString();
                break;

            case "_createdDateTime":
                _CreatedDateTime = new fhirCsR4.Models.Element();
                _CreatedDateTime.DeserializeJson(ref reader, options);
                break;

            case "createdPeriod":
                CreatedPeriod = new fhirCsR4.Models.Period();
                CreatedPeriod.DeserializeJson(ref reader, options);
                break;

            case "device":
                Device = new fhirCsR4.Models.Reference();
                Device.DeserializeJson(ref reader, options);
                break;

            case "deviceName":
                DeviceName = reader.GetString();
                break;

            case "_deviceName":
                _DeviceName = new fhirCsR4.Models.Element();
                _DeviceName.DeserializeJson(ref reader, options);
                break;

            case "duration":
                Duration = reader.GetDecimal();
                break;

            case "_duration":
                _Duration = new fhirCsR4.Models.Element();
                _Duration.DeserializeJson(ref reader, options);
                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "frames":
                Frames = reader.GetUInt32();
                break;

            case "height":
                Height = reader.GetUInt32();
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "issued":
                Issued = reader.GetString();
                break;

            case "_issued":
                _Issued = new fhirCsR4.Models.Element();
                _Issued.DeserializeJson(ref reader, options);
                break;

            case "modality":
                Modality = new fhirCsR4.Models.CodeableConcept();
                Modality.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "operator":
                Operator = new fhirCsR4.Models.Reference();
                Operator.DeserializeJson(ref reader, options);
                break;

            case "partOf":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PartOf = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPartOf = new fhirCsR4.Models.Reference();
                    objPartOf.DeserializeJson(ref reader, options);
                    PartOf.Add(objPartOf);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PartOf.Count == 0)
                {
                    PartOf = null;
                }

                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "type":
                Type = new fhirCsR4.Models.CodeableConcept();
                Type.DeserializeJson(ref reader, options);
                break;

            case "view":
                View = new fhirCsR4.Models.CodeableConcept();
                View.DeserializeJson(ref reader, options);
                break;

            case "width":
                Width = reader.GetUInt32();
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #18
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                BasedOn = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objBasedOn = new fhirCsR4.Models.Reference();
                    objBasedOn.DeserializeJson(ref reader, options);
                    BasedOn.Add(objBasedOn);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (BasedOn.Count == 0)
                {
                    BasedOn = null;
                }

                break;

            case "description":
                Description = reader.GetString();
                break;

            case "_description":
                _Description = new fhirCsR4.Models.Element();
                _Description.DeserializeJson(ref reader, options);
                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "endpoint":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Endpoint = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objEndpoint = new fhirCsR4.Models.Reference();
                    objEndpoint.DeserializeJson(ref reader, options);
                    Endpoint.Add(objEndpoint);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Endpoint.Count == 0)
                {
                    Endpoint = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "interpreter":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Interpreter = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objInterpreter = new fhirCsR4.Models.Reference();
                    objInterpreter.DeserializeJson(ref reader, options);
                    Interpreter.Add(objInterpreter);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Interpreter.Count == 0)
                {
                    Interpreter = null;
                }

                break;

            case "location":
                Location = new fhirCsR4.Models.Reference();
                Location.DeserializeJson(ref reader, options);
                break;

            case "modality":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Modality = new List <Coding>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Coding objModality = new fhirCsR4.Models.Coding();
                    objModality.DeserializeJson(ref reader, options);
                    Modality.Add(objModality);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Modality.Count == 0)
                {
                    Modality = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "numberOfInstances":
                NumberOfInstances = reader.GetUInt32();
                break;

            case "numberOfSeries":
                NumberOfSeries = reader.GetUInt32();
                break;

            case "procedureCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ProcedureCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objProcedureCode = new fhirCsR4.Models.CodeableConcept();
                    objProcedureCode.DeserializeJson(ref reader, options);
                    ProcedureCode.Add(objProcedureCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ProcedureCode.Count == 0)
                {
                    ProcedureCode = null;
                }

                break;

            case "procedureReference":
                ProcedureReference = new fhirCsR4.Models.Reference();
                ProcedureReference.DeserializeJson(ref reader, options);
                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "referrer":
                Referrer = new fhirCsR4.Models.Reference();
                Referrer.DeserializeJson(ref reader, options);
                break;

            case "series":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Series = new List <ImagingStudySeries>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ImagingStudySeries objSeries = new fhirCsR4.Models.ImagingStudySeries();
                    objSeries.DeserializeJson(ref reader, options);
                    Series.Add(objSeries);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Series.Count == 0)
                {
                    Series = null;
                }

                break;

            case "started":
                Started = reader.GetString();
                break;

            case "_started":
                _Started = new fhirCsR4.Models.Element();
                _Started.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #19
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "basedOn":
                BasedOn = new fhirCsR4.Models.Reference();
                BasedOn.DeserializeJson(ref reader, options);
                break;

            case "basis":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Basis = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objBasis = new fhirCsR4.Models.Reference();
                    objBasis.DeserializeJson(ref reader, options);
                    Basis.Add(objBasis);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Basis.Count == 0)
                {
                    Basis = null;
                }

                break;

            case "code":
                Code = new fhirCsR4.Models.CodeableConcept();
                Code.DeserializeJson(ref reader, options);
                break;

            case "condition":
                Condition = new fhirCsR4.Models.Reference();
                Condition.DeserializeJson(ref reader, options);
                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "method":
                Method = new fhirCsR4.Models.CodeableConcept();
                Method.DeserializeJson(ref reader, options);
                break;

            case "mitigation":
                Mitigation = reader.GetString();
                break;

            case "_mitigation":
                _Mitigation = new fhirCsR4.Models.Element();
                _Mitigation.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "occurrenceDateTime":
                OccurrenceDateTime = reader.GetString();
                break;

            case "_occurrenceDateTime":
                _OccurrenceDateTime = new fhirCsR4.Models.Element();
                _OccurrenceDateTime.DeserializeJson(ref reader, options);
                break;

            case "occurrencePeriod":
                OccurrencePeriod = new fhirCsR4.Models.Period();
                OccurrencePeriod.DeserializeJson(ref reader, options);
                break;

            case "parent":
                Parent = new fhirCsR4.Models.Reference();
                Parent.DeserializeJson(ref reader, options);
                break;

            case "performer":
                Performer = new fhirCsR4.Models.Reference();
                Performer.DeserializeJson(ref reader, options);
                break;

            case "prediction":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Prediction = new List <RiskAssessmentPrediction>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.RiskAssessmentPrediction objPrediction = new fhirCsR4.Models.RiskAssessmentPrediction();
                    objPrediction.DeserializeJson(ref reader, options);
                    Prediction.Add(objPrediction);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Prediction.Count == 0)
                {
                    Prediction = null;
                }

                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #20
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "achievementStatus":
                AchievementStatus = new fhirCsR4.Models.CodeableConcept();
                AchievementStatus.DeserializeJson(ref reader, options);
                break;

            case "addresses":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Addresses = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objAddresses = new fhirCsR4.Models.Reference();
                    objAddresses.DeserializeJson(ref reader, options);
                    Addresses.Add(objAddresses);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Addresses.Count == 0)
                {
                    Addresses = null;
                }

                break;

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Category = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCategory = new fhirCsR4.Models.CodeableConcept();
                    objCategory.DeserializeJson(ref reader, options);
                    Category.Add(objCategory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Category.Count == 0)
                {
                    Category = null;
                }

                break;

            case "description":
                Description = new fhirCsR4.Models.CodeableConcept();
                Description.DeserializeJson(ref reader, options);
                break;

            case "expressedBy":
                ExpressedBy = new fhirCsR4.Models.Reference();
                ExpressedBy.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "lifecycleStatus":
                LifecycleStatus = reader.GetString();
                break;

            case "_lifecycleStatus":
                _LifecycleStatus = new fhirCsR4.Models.Element();
                _LifecycleStatus.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "outcomeCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                OutcomeCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objOutcomeCode = new fhirCsR4.Models.CodeableConcept();
                    objOutcomeCode.DeserializeJson(ref reader, options);
                    OutcomeCode.Add(objOutcomeCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (OutcomeCode.Count == 0)
                {
                    OutcomeCode = null;
                }

                break;

            case "outcomeReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                OutcomeReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objOutcomeReference = new fhirCsR4.Models.Reference();
                    objOutcomeReference.DeserializeJson(ref reader, options);
                    OutcomeReference.Add(objOutcomeReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (OutcomeReference.Count == 0)
                {
                    OutcomeReference = null;
                }

                break;

            case "priority":
                Priority = new fhirCsR4.Models.CodeableConcept();
                Priority.DeserializeJson(ref reader, options);
                break;

            case "startDate":
                StartDate = reader.GetString();
                break;

            case "_startDate":
                _StartDate = new fhirCsR4.Models.Element();
                _StartDate.DeserializeJson(ref reader, options);
                break;

            case "startCodeableConcept":
                StartCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                StartCodeableConcept.DeserializeJson(ref reader, options);
                break;

            case "statusDate":
                StatusDate = reader.GetString();
                break;

            case "_statusDate":
                _StatusDate = new fhirCsR4.Models.Element();
                _StatusDate.DeserializeJson(ref reader, options);
                break;

            case "statusReason":
                StatusReason = reader.GetString();
                break;

            case "_statusReason":
                _StatusReason = new fhirCsR4.Models.Element();
                _StatusReason.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "target":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Target = new List <GoalTarget>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.GoalTarget objTarget = new fhirCsR4.Models.GoalTarget();
                    objTarget.DeserializeJson(ref reader, options);
                    Target.Add(objTarget);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Target.Count == 0)
                {
                    Target = null;
                }

                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #21
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "accessionIdentifier":
                AccessionIdentifier = new fhirCsR4.Models.Identifier();
                AccessionIdentifier.DeserializeJson(ref reader, options);
                break;

            case "collection":
                Collection = new fhirCsR4.Models.SpecimenCollection();
                Collection.DeserializeJson(ref reader, options);
                break;

            case "condition":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Condition = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCondition = new fhirCsR4.Models.CodeableConcept();
                    objCondition.DeserializeJson(ref reader, options);
                    Condition.Add(objCondition);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Condition.Count == 0)
                {
                    Condition = null;
                }

                break;

            case "container":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Container = new List <SpecimenContainer>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.SpecimenContainer objContainer = new fhirCsR4.Models.SpecimenContainer();
                    objContainer.DeserializeJson(ref reader, options);
                    Container.Add(objContainer);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Container.Count == 0)
                {
                    Container = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "parent":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Parent = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objParent = new fhirCsR4.Models.Reference();
                    objParent.DeserializeJson(ref reader, options);
                    Parent.Add(objParent);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Parent.Count == 0)
                {
                    Parent = null;
                }

                break;

            case "processing":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Processing = new List <SpecimenProcessing>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.SpecimenProcessing objProcessing = new fhirCsR4.Models.SpecimenProcessing();
                    objProcessing.DeserializeJson(ref reader, options);
                    Processing.Add(objProcessing);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Processing.Count == 0)
                {
                    Processing = null;
                }

                break;

            case "receivedTime":
                ReceivedTime = reader.GetString();
                break;

            case "_receivedTime":
                _ReceivedTime = new fhirCsR4.Models.Element();
                _ReceivedTime.DeserializeJson(ref reader, options);
                break;

            case "request":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Request = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objRequest = new fhirCsR4.Models.Reference();
                    objRequest.DeserializeJson(ref reader, options);
                    Request.Add(objRequest);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Request.Count == 0)
                {
                    Request = null;
                }

                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "type":
                Type = new fhirCsR4.Models.CodeableConcept();
                Type.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "asserter":
                Asserter = new fhirCsR4.Models.Reference();
                Asserter.DeserializeJson(ref reader, options);
                break;

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Category = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Category.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Category.Count == 0)
                {
                    Category = null;
                }

                break;

            case "_category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _Category = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_Category = new fhirCsR4.Models.Element();
                    obj_Category.DeserializeJson(ref reader, options);
                    _Category.Add(obj_Category);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_Category.Count == 0)
                {
                    _Category = null;
                }

                break;

            case "clinicalStatus":
                ClinicalStatus = new fhirCsR4.Models.CodeableConcept();
                ClinicalStatus.DeserializeJson(ref reader, options);
                break;

            case "code":
                Code = new fhirCsR4.Models.CodeableConcept();
                Code.DeserializeJson(ref reader, options);
                break;

            case "criticality":
                Criticality = reader.GetString();
                break;

            case "_criticality":
                _Criticality = new fhirCsR4.Models.Element();
                _Criticality.DeserializeJson(ref reader, options);
                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "lastOccurrence":
                LastOccurrence = reader.GetString();
                break;

            case "_lastOccurrence":
                _LastOccurrence = new fhirCsR4.Models.Element();
                _LastOccurrence.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "onsetDateTime":
                OnsetDateTime = reader.GetString();
                break;

            case "_onsetDateTime":
                _OnsetDateTime = new fhirCsR4.Models.Element();
                _OnsetDateTime.DeserializeJson(ref reader, options);
                break;

            case "onsetAge":
                OnsetAge = new fhirCsR4.Models.Age();
                OnsetAge.DeserializeJson(ref reader, options);
                break;

            case "onsetPeriod":
                OnsetPeriod = new fhirCsR4.Models.Period();
                OnsetPeriod.DeserializeJson(ref reader, options);
                break;

            case "onsetRange":
                OnsetRange = new fhirCsR4.Models.Range();
                OnsetRange.DeserializeJson(ref reader, options);
                break;

            case "onsetString":
                OnsetString = reader.GetString();
                break;

            case "_onsetString":
                _OnsetString = new fhirCsR4.Models.Element();
                _OnsetString.DeserializeJson(ref reader, options);
                break;

            case "patient":
                Patient = new fhirCsR4.Models.Reference();
                Patient.DeserializeJson(ref reader, options);
                break;

            case "reaction":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Reaction = new List <AllergyIntoleranceReaction>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.AllergyIntoleranceReaction objReaction = new fhirCsR4.Models.AllergyIntoleranceReaction();
                    objReaction.DeserializeJson(ref reader, options);
                    Reaction.Add(objReaction);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Reaction.Count == 0)
                {
                    Reaction = null;
                }

                break;

            case "recordedDate":
                RecordedDate = reader.GetString();
                break;

            case "_recordedDate":
                _RecordedDate = new fhirCsR4.Models.Element();
                _RecordedDate.DeserializeJson(ref reader, options);
                break;

            case "recorder":
                Recorder = new fhirCsR4.Models.Reference();
                Recorder.DeserializeJson(ref reader, options);
                break;

            case "type":
                Type = reader.GetString();
                break;

            case "_type":
                _Type = new fhirCsR4.Models.Element();
                _Type.DeserializeJson(ref reader, options);
                break;

            case "verificationStatus":
                VerificationStatus = new fhirCsR4.Models.CodeableConcept();
                VerificationStatus.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #23
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                BasedOn = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objBasedOn = new fhirCsR4.Models.Reference();
                    objBasedOn.DeserializeJson(ref reader, options);
                    BasedOn.Add(objBasedOn);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (BasedOn.Count == 0)
                {
                    BasedOn = null;
                }

                break;

            case "category":
                Category = new fhirCsR4.Models.CodeableConcept();
                Category.DeserializeJson(ref reader, options);
                break;

            case "context":
                Context = new fhirCsR4.Models.Reference();
                Context.DeserializeJson(ref reader, options);
                break;

            case "dateAsserted":
                DateAsserted = reader.GetString();
                break;

            case "_dateAsserted":
                _DateAsserted = new fhirCsR4.Models.Element();
                _DateAsserted.DeserializeJson(ref reader, options);
                break;

            case "derivedFrom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                DerivedFrom = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objDerivedFrom = new fhirCsR4.Models.Reference();
                    objDerivedFrom.DeserializeJson(ref reader, options);
                    DerivedFrom.Add(objDerivedFrom);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (DerivedFrom.Count == 0)
                {
                    DerivedFrom = null;
                }

                break;

            case "dosage":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Dosage = new List <Dosage>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Dosage objDosage = new fhirCsR4.Models.Dosage();
                    objDosage.DeserializeJson(ref reader, options);
                    Dosage.Add(objDosage);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Dosage.Count == 0)
                {
                    Dosage = null;
                }

                break;

            case "effectiveDateTime":
                EffectiveDateTime = reader.GetString();
                break;

            case "_effectiveDateTime":
                _EffectiveDateTime = new fhirCsR4.Models.Element();
                _EffectiveDateTime.DeserializeJson(ref reader, options);
                break;

            case "effectivePeriod":
                EffectivePeriod = new fhirCsR4.Models.Period();
                EffectivePeriod.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "informationSource":
                InformationSource = new fhirCsR4.Models.Reference();
                InformationSource.DeserializeJson(ref reader, options);
                break;

            case "medicationCodeableConcept":
                MedicationCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                MedicationCodeableConcept.DeserializeJson(ref reader, options);
                break;

            case "medicationReference":
                MedicationReference = new fhirCsR4.Models.Reference();
                MedicationReference.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "partOf":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PartOf = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPartOf = new fhirCsR4.Models.Reference();
                    objPartOf.DeserializeJson(ref reader, options);
                    PartOf.Add(objPartOf);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PartOf.Count == 0)
                {
                    PartOf = null;
                }

                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "statusReason":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                StatusReason = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objStatusReason = new fhirCsR4.Models.CodeableConcept();
                    objStatusReason.DeserializeJson(ref reader, options);
                    StatusReason.Add(objStatusReason);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (StatusReason.Count == 0)
                {
                    StatusReason = null;
                }

                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #24
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "code":
                Code = new fhirCsR4.Models.CodeableConcept();
                Code.DeserializeJson(ref reader, options);
                break;

            case "contributedToDeath":
                ContributedToDeath = reader.GetBoolean();
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "onsetAge":
                OnsetAge = new fhirCsR4.Models.Age();
                OnsetAge.DeserializeJson(ref reader, options);
                break;

            case "onsetRange":
                OnsetRange = new fhirCsR4.Models.Range();
                OnsetRange.DeserializeJson(ref reader, options);
                break;

            case "onsetPeriod":
                OnsetPeriod = new fhirCsR4.Models.Period();
                OnsetPeriod.DeserializeJson(ref reader, options);
                break;

            case "onsetString":
                OnsetString = reader.GetString();
                break;

            case "_onsetString":
                _OnsetString = new fhirCsR4.Models.Element();
                _OnsetString.DeserializeJson(ref reader, options);
                break;

            case "outcome":
                Outcome = new fhirCsR4.Models.CodeableConcept();
                Outcome.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.BackboneElement) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #25
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "about":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                About = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objAbout = new fhirCsR4.Models.Reference();
                    objAbout.DeserializeJson(ref reader, options);
                    About.Add(objAbout);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (About.Count == 0)
                {
                    About = null;
                }

                break;

            case "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                BasedOn = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objBasedOn = new fhirCsR4.Models.Reference();
                    objBasedOn.DeserializeJson(ref reader, options);
                    BasedOn.Add(objBasedOn);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (BasedOn.Count == 0)
                {
                    BasedOn = null;
                }

                break;

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Category = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCategory = new fhirCsR4.Models.CodeableConcept();
                    objCategory.DeserializeJson(ref reader, options);
                    Category.Add(objCategory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Category.Count == 0)
                {
                    Category = null;
                }

                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "inResponseTo":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                InResponseTo = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objInResponseTo = new fhirCsR4.Models.Reference();
                    objInResponseTo.DeserializeJson(ref reader, options);
                    InResponseTo.Add(objInResponseTo);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (InResponseTo.Count == 0)
                {
                    InResponseTo = null;
                }

                break;

            case "instantiatesCanonical":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                InstantiatesCanonical = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    InstantiatesCanonical.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (InstantiatesCanonical.Count == 0)
                {
                    InstantiatesCanonical = null;
                }

                break;

            case "_instantiatesCanonical":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _InstantiatesCanonical = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_InstantiatesCanonical = new fhirCsR4.Models.Element();
                    obj_InstantiatesCanonical.DeserializeJson(ref reader, options);
                    _InstantiatesCanonical.Add(obj_InstantiatesCanonical);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_InstantiatesCanonical.Count == 0)
                {
                    _InstantiatesCanonical = null;
                }

                break;

            case "instantiatesUri":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                InstantiatesUri = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    InstantiatesUri.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (InstantiatesUri.Count == 0)
                {
                    InstantiatesUri = null;
                }

                break;

            case "_instantiatesUri":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _InstantiatesUri = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_InstantiatesUri = new fhirCsR4.Models.Element();
                    obj_InstantiatesUri.DeserializeJson(ref reader, options);
                    _InstantiatesUri.Add(obj_InstantiatesUri);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_InstantiatesUri.Count == 0)
                {
                    _InstantiatesUri = null;
                }

                break;

            case "medium":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Medium = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objMedium = new fhirCsR4.Models.CodeableConcept();
                    objMedium.DeserializeJson(ref reader, options);
                    Medium.Add(objMedium);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Medium.Count == 0)
                {
                    Medium = null;
                }

                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "partOf":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PartOf = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPartOf = new fhirCsR4.Models.Reference();
                    objPartOf.DeserializeJson(ref reader, options);
                    PartOf.Add(objPartOf);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PartOf.Count == 0)
                {
                    PartOf = null;
                }

                break;

            case "payload":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Payload = new List <CommunicationPayload>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CommunicationPayload objPayload = new fhirCsR4.Models.CommunicationPayload();
                    objPayload.DeserializeJson(ref reader, options);
                    Payload.Add(objPayload);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Payload.Count == 0)
                {
                    Payload = null;
                }

                break;

            case "priority":
                Priority = reader.GetString();
                break;

            case "_priority":
                _Priority = new fhirCsR4.Models.Element();
                _Priority.DeserializeJson(ref reader, options);
                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objReasonCode = new fhirCsR4.Models.CodeableConcept();
                    objReasonCode.DeserializeJson(ref reader, options);
                    ReasonCode.Add(objReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonCode.Count == 0)
                {
                    ReasonCode = null;
                }

                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ReasonReference = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReasonReference = new fhirCsR4.Models.Reference();
                    objReasonReference.DeserializeJson(ref reader, options);
                    ReasonReference.Add(objReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (ReasonReference.Count == 0)
                {
                    ReasonReference = null;
                }

                break;

            case "received":
                Received = reader.GetString();
                break;

            case "_received":
                _Received = new fhirCsR4.Models.Element();
                _Received.DeserializeJson(ref reader, options);
                break;

            case "recipient":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Recipient = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objRecipient = new fhirCsR4.Models.Reference();
                    objRecipient.DeserializeJson(ref reader, options);
                    Recipient.Add(objRecipient);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Recipient.Count == 0)
                {
                    Recipient = null;
                }

                break;

            case "sender":
                Sender = new fhirCsR4.Models.Reference();
                Sender.DeserializeJson(ref reader, options);
                break;

            case "sent":
                Sent = reader.GetString();
                break;

            case "_sent":
                _Sent = new fhirCsR4.Models.Element();
                _Sent.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "statusReason":
                StatusReason = new fhirCsR4.Models.CodeableConcept();
                StatusReason.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "topic":
                Topic = new fhirCsR4.Models.CodeableConcept();
                Topic.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "authorizingPrescription":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                AuthorizingPrescription = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objAuthorizingPrescription = new fhirCsR4.Models.Reference();
                    objAuthorizingPrescription.DeserializeJson(ref reader, options);
                    AuthorizingPrescription.Add(objAuthorizingPrescription);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (AuthorizingPrescription.Count == 0)
                {
                    AuthorizingPrescription = null;
                }

                break;

            case "category":
                Category = new fhirCsR4.Models.CodeableConcept();
                Category.DeserializeJson(ref reader, options);
                break;

            case "context":
                Context = new fhirCsR4.Models.Reference();
                Context.DeserializeJson(ref reader, options);
                break;

            case "daysSupply":
                DaysSupply = new fhirCsR4.Models.Quantity();
                DaysSupply.DeserializeJson(ref reader, options);
                break;

            case "destination":
                Destination = new fhirCsR4.Models.Reference();
                Destination.DeserializeJson(ref reader, options);
                break;

            case "detectedIssue":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                DetectedIssue = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objDetectedIssue = new fhirCsR4.Models.Reference();
                    objDetectedIssue.DeserializeJson(ref reader, options);
                    DetectedIssue.Add(objDetectedIssue);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (DetectedIssue.Count == 0)
                {
                    DetectedIssue = null;
                }

                break;

            case "dosageInstruction":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                DosageInstruction = new List <Dosage>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Dosage objDosageInstruction = new fhirCsR4.Models.Dosage();
                    objDosageInstruction.DeserializeJson(ref reader, options);
                    DosageInstruction.Add(objDosageInstruction);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (DosageInstruction.Count == 0)
                {
                    DosageInstruction = null;
                }

                break;

            case "eventHistory":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                EventHistory = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objEventHistory = new fhirCsR4.Models.Reference();
                    objEventHistory.DeserializeJson(ref reader, options);
                    EventHistory.Add(objEventHistory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (EventHistory.Count == 0)
                {
                    EventHistory = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "location":
                Location = new fhirCsR4.Models.Reference();
                Location.DeserializeJson(ref reader, options);
                break;

            case "medicationCodeableConcept":
                MedicationCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                MedicationCodeableConcept.DeserializeJson(ref reader, options);
                break;

            case "medicationReference":
                MedicationReference = new fhirCsR4.Models.Reference();
                MedicationReference.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "partOf":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                PartOf = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPartOf = new fhirCsR4.Models.Reference();
                    objPartOf.DeserializeJson(ref reader, options);
                    PartOf.Add(objPartOf);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (PartOf.Count == 0)
                {
                    PartOf = null;
                }

                break;

            case "performer":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Performer = new List <MedicationDispensePerformer>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.MedicationDispensePerformer objPerformer = new fhirCsR4.Models.MedicationDispensePerformer();
                    objPerformer.DeserializeJson(ref reader, options);
                    Performer.Add(objPerformer);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Performer.Count == 0)
                {
                    Performer = null;
                }

                break;

            case "quantity":
                Quantity = new fhirCsR4.Models.Quantity();
                Quantity.DeserializeJson(ref reader, options);
                break;

            case "receiver":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Receiver = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objReceiver = new fhirCsR4.Models.Reference();
                    objReceiver.DeserializeJson(ref reader, options);
                    Receiver.Add(objReceiver);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Receiver.Count == 0)
                {
                    Receiver = null;
                }

                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "statusReasonCodeableConcept":
                StatusReasonCodeableConcept = new fhirCsR4.Models.CodeableConcept();
                StatusReasonCodeableConcept.DeserializeJson(ref reader, options);
                break;

            case "statusReasonReference":
                StatusReasonReference = new fhirCsR4.Models.Reference();
                StatusReasonReference.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "substitution":
                Substitution = new fhirCsR4.Models.MedicationDispenseSubstitution();
                Substitution.DeserializeJson(ref reader, options);
                break;

            case "supportingInformation":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                SupportingInformation = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objSupportingInformation = new fhirCsR4.Models.Reference();
                    objSupportingInformation.DeserializeJson(ref reader, options);
                    SupportingInformation.Add(objSupportingInformation);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (SupportingInformation.Count == 0)
                {
                    SupportingInformation = null;
                }

                break;

            case "type":
                Type = new fhirCsR4.Models.CodeableConcept();
                Type.DeserializeJson(ref reader, options);
                break;

            case "whenHandedOver":
                WhenHandedOver = reader.GetString();
                break;

            case "_whenHandedOver":
                _WhenHandedOver = new fhirCsR4.Models.Element();
                _WhenHandedOver.DeserializeJson(ref reader, options);
                break;

            case "whenPrepared":
                WhenPrepared = reader.GetString();
                break;

            case "_whenPrepared":
                _WhenPrepared = new fhirCsR4.Models.Element();
                _WhenPrepared.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #27
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "code":
                Code = new fhirCsR4.Models.CodeableConcept();
                Code.DeserializeJson(ref reader, options);
                break;

            case "date":
                Date = reader.GetString();
                break;

            case "_date":
                _Date = new fhirCsR4.Models.Element();
                _Date.DeserializeJson(ref reader, options);
                break;

            case "emptyReason":
                EmptyReason = new fhirCsR4.Models.CodeableConcept();
                EmptyReason.DeserializeJson(ref reader, options);
                break;

            case "encounter":
                Encounter = new fhirCsR4.Models.Reference();
                Encounter.DeserializeJson(ref reader, options);
                break;

            case "entry":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Entry = new List <ListEntry>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ListEntry objEntry = new fhirCsR4.Models.ListEntry();
                    objEntry.DeserializeJson(ref reader, options);
                    Entry.Add(objEntry);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Entry.Count == 0)
                {
                    Entry = null;
                }

                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "mode":
                Mode = reader.GetString();
                break;

            case "_mode":
                _Mode = new fhirCsR4.Models.Element();
                _Mode.DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Annotation objNote = new fhirCsR4.Models.Annotation();
                    objNote.DeserializeJson(ref reader, options);
                    Note.Add(objNote);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Note.Count == 0)
                {
                    Note = null;
                }

                break;

            case "orderedBy":
                OrderedBy = new fhirCsR4.Models.CodeableConcept();
                OrderedBy.DeserializeJson(ref reader, options);
                break;

            case "source":
                Source = new fhirCsR4.Models.Reference();
                Source.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "subject":
                Subject = new fhirCsR4.Models.Reference();
                Subject.DeserializeJson(ref reader, options);
                break;

            case "title":
                Title = reader.GetString();
                break;

            case "_title":
                _Title = new fhirCsR4.Models.Element();
                _Title.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }