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

            throw new JsonException($"DeviceRequest.ParameterComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
        /// <summary>
        /// Serialize a FHIR DeviceRequest#Parameter into JSON
        /// </summary>
        public static void SerializeJson(this DeviceRequest.ParameterComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            // Component: DeviceRequest#Parameter, Export: ParameterComponent, Base: BackboneElement (BackboneElement)
            ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false);

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

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

                case Quantity v_Quantity:
                    writer.WritePropertyName("valueQuantity");
                    v_Quantity.SerializeJson(writer, options);
                    break;

                case Range v_Range:
                    writer.WritePropertyName("valueRange");
                    v_Range.SerializeJson(writer, options);
                    break;

                case FhirBoolean v_FhirBoolean:
                    if (v_FhirBoolean != null)
                    {
                        if (v_FhirBoolean.Value != null)
                        {
                            writer.WriteBoolean("valueBoolean", (bool)v_FhirBoolean.Value);
                        }
                        if (v_FhirBoolean.HasExtensions() || (!string.IsNullOrEmpty(v_FhirBoolean.ElementId)))
                        {
                            JsonStreamUtilities.SerializeExtensionList(writer, options, "_valueBoolean", false, v_FhirBoolean.Extension, v_FhirBoolean.ElementId);
                        }
                    }
                    break;
                }
            }
            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
        /// <summary>
        /// Deserialize JSON into a FHIR DeviceRequest#Parameter
        /// </summary>
        public static void DeserializeJsonProperty(this DeviceRequest.ParameterComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "code":
                current.Code = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Code).DeserializeJson(ref reader, options);
                break;

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

            case "valueQuantity":
                current.Value = new Hl7.Fhir.Model.Quantity();
                ((Hl7.Fhir.Model.Quantity)current.Value).DeserializeJson(ref reader, options);
                break;

            case "valueRange":
                current.Value = new Hl7.Fhir.Model.Range();
                ((Hl7.Fhir.Model.Range)current.Value).DeserializeJson(ref reader, options);
                break;

            case "valueBoolean":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Value = new FhirBoolean();
                    reader.Skip();
                }
                else
                {
                    current.Value = new FhirBoolean(reader.GetBoolean());
                }
                break;

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

            // Complex: parameter, Export: ParameterComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }