/// <summary>
        /// Deserialize JSON into a FHIR MedicinalProductIndication#OtherTherapy
        /// </summary>
        public static void DeserializeJson(this MedicinalProductIndication.OtherTherapyComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options)
        {
            string propertyName;

            while (reader.Read())
            {
                if (reader.TokenType == JsonTokenType.EndObject)
                {
                    return;
                }

                if (reader.TokenType == JsonTokenType.PropertyName)
                {
                    propertyName = reader.GetString();
                    if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug)
                    {
                        Console.WriteLine($"MedicinalProductIndication.OtherTherapyComponent >>> MedicinalProductIndication#OtherTherapy.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    reader.Read();
                    current.DeserializeJsonProperty(ref reader, options, propertyName);
                }
            }

            throw new JsonException($"MedicinalProductIndication.OtherTherapyComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
        /// <summary>
        /// Deserialize JSON into a FHIR MedicinalProductIndication#OtherTherapy
        /// </summary>
        public static void DeserializeJsonProperty(this MedicinalProductIndication.OtherTherapyComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "therapyRelationshipType":
                current.TherapyRelationshipType = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.TherapyRelationshipType).DeserializeJson(ref reader, options);
                break;

            case "medicationCodeableConcept":
                current.Medication = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Medication).DeserializeJson(ref reader, options);
                break;

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

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

            writer.WritePropertyName("therapyRelationshipType");
            current.TherapyRelationshipType.SerializeJson(writer, options);

            if (current.Medication != null)
            {
                switch (current.Medication)
                {
                case CodeableConcept v_CodeableConcept:
                    writer.WritePropertyName("medicationCodeableConcept");
                    v_CodeableConcept.SerializeJson(writer, options);
                    break;

                case ResourceReference v_ResourceReference:
                    writer.WritePropertyName("medicationReference");
                    v_ResourceReference.SerializeJson(writer, options);
                    break;
                }
            }
            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }