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

                AlternateMaterial = new List <CodeableConcept>();

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

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

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

                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 "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 "manufacturedItem":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                ManufacturedItem = new List <Reference>();

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

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

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

                break;

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

                Manufacturer = new List <Reference>();

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

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

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

                break;

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

                Material = new List <CodeableConcept>();

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

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

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

                break;

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

                OtherCharacteristics = new List <CodeableConcept>();

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

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

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

                break;

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

                PackageItem = new List <MedicinalProductPackagedPackageItem>();

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

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

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

                break;

            case "physicalCharacteristics":
                PhysicalCharacteristics = new fhirCsR4.Models.ProdCharacteristic();
                PhysicalCharacteristics.DeserializeJson(ref reader, options);
                break;

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

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

                ShelfLifeStorage = new List <ProductShelfLife>();

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

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

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

                break;

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

            default:
                ((fhirCsR4.Models.BackboneElement) 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 "ingredient":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Ingredient = new List <Reference>();

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

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

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

                break;

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

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

                Manufacturer = new List <Reference>();

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

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

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

                break;

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

                OtherCharacteristics = new List <CodeableConcept>();

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

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

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

                break;

            case "physicalCharacteristics":
                PhysicalCharacteristics = new fhirCsR4.Models.ProdCharacteristic();
                PhysicalCharacteristics.DeserializeJson(ref reader, options);
                break;

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

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

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }