public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as RecommendationComponent;

                if (dest == null)
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }

                base.CopyTo(dest);
                if (VaccineCode != null)
                {
                    dest.VaccineCode = new List <Hl7.Fhir.Model.CodeableConcept>(VaccineCode.DeepCopy());
                }
                if (TargetDisease != null)
                {
                    dest.TargetDisease = new List <Hl7.Fhir.Model.CodeableConcept>(TargetDisease.DeepCopy());
                }
                if (ContraindicatedVaccineCode != null)
                {
                    dest.ContraindicatedVaccineCode = new List <Hl7.Fhir.Model.CodeableConcept>(ContraindicatedVaccineCode.DeepCopy());
                }
                if (ForecastStatus != null)
                {
                    dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)ForecastStatus.DeepCopy();
                }
                if (ForecastReason != null)
                {
                    dest.ForecastReason = new List <Hl7.Fhir.Model.CodeableConcept>(ForecastReason.DeepCopy());
                }
                if (DateCriterion != null)
                {
                    dest.DateCriterion = new List <Hl7.Fhir.Model.ImmunizationRecommendation.DateCriterionComponent>(DateCriterion.DeepCopy());
                }
                if (DescriptionElement != null)
                {
                    dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy();
                }
                if (SeriesElement != null)
                {
                    dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopy();
                }
                if (DoseNumberElement != null)
                {
                    dest.DoseNumberElement = (Hl7.Fhir.Model.FhirString)DoseNumberElement.DeepCopy();
                }
                if (SeriesDosesElement != null)
                {
                    dest.SeriesDosesElement = (Hl7.Fhir.Model.FhirString)SeriesDosesElement.DeepCopy();
                }
                if (SupportingImmunization != null)
                {
                    dest.SupportingImmunization = new List <Hl7.Fhir.Model.ResourceReference>(SupportingImmunization.DeepCopy());
                }
                if (SupportingPatientInformation != null)
                {
                    dest.SupportingPatientInformation = new List <Hl7.Fhir.Model.ResourceReference>(SupportingPatientInformation.DeepCopy());
                }
                return(dest);
            }
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as RecommendationComponent;

                if (dest == null)
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }

                base.CopyTo(dest);
                if (DateElement != null)
                {
                    dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy();
                }
                if (VaccineCode != null)
                {
                    dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)VaccineCode.DeepCopy();
                }
                if (TargetDisease != null)
                {
                    dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)TargetDisease.DeepCopy();
                }
                if (DoseNumberElement != null)
                {
                    dest.DoseNumberElement = (Hl7.Fhir.Model.PositiveInt)DoseNumberElement.DeepCopy();
                }
                if (ForecastStatus != null)
                {
                    dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)ForecastStatus.DeepCopy();
                }
                if (DateCriterion != null)
                {
                    dest.DateCriterion = new List <Hl7.Fhir.Model.ImmunizationRecommendation.DateCriterionComponent>(DateCriterion.DeepCopy());
                }
                if (Protocol != null)
                {
                    dest.Protocol = (Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent)Protocol.DeepCopy();
                }
                if (SupportingImmunization != null)
                {
                    dest.SupportingImmunization = new List <Hl7.Fhir.Model.ResourceReference>(SupportingImmunization.DeepCopy());
                }
                if (SupportingPatientInformation != null)
                {
                    dest.SupportingPatientInformation = new List <Hl7.Fhir.Model.ResourceReference>(SupportingPatientInformation.DeepCopy());
                }
                return(dest);
            }
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            ((fhirCsR4.Models.BackboneElement) this).SerializeJson(writer, options, false);

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

                foreach (CodeableConcept valVaccineCode in VaccineCode)
                {
                    valVaccineCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (CodeableConcept valContraindicatedVaccineCode in ContraindicatedVaccineCode)
                {
                    valContraindicatedVaccineCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (CodeableConcept valForecastReason in ForecastReason)
                {
                    valForecastReason.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ImmunizationRecommendationRecommendationDateCriterion valDateCriterion in DateCriterion)
                {
                    valDateCriterion.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Description))
            {
                writer.WriteString("description", (string)Description !);
            }

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

            if (!string.IsNullOrEmpty(Series))
            {
                writer.WriteString("series", (string)Series !);
            }

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

            if (DoseNumberPositiveInt != null)
            {
                writer.WriteNumber("doseNumberPositiveInt", (uint)DoseNumberPositiveInt !);
            }

            if (!string.IsNullOrEmpty(DoseNumberString))
            {
                writer.WriteString("doseNumberString", (string)DoseNumberString !);
            }

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

            if (SeriesDosesPositiveInt != null)
            {
                writer.WriteNumber("seriesDosesPositiveInt", (uint)SeriesDosesPositiveInt !);
            }

            if (!string.IsNullOrEmpty(SeriesDosesString))
            {
                writer.WriteString("seriesDosesString", (string)SeriesDosesString !);
            }

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

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

                foreach (Reference valSupportingImmunization in SupportingImmunization)
                {
                    valSupportingImmunization.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valSupportingPatientInformation in SupportingPatientInformation)
                {
                    valSupportingPatientInformation.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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