internal ProductConfiguration(string displayName, ProductDescription description, IReadOnlyList <ImageInformation> imageInformation, CostInformation costInformation, AvailabilityInformation availabilityInformation, HierarchyInformation hierarchyInformation, IReadOnlyList <FilterableProperty> filterableProperties, IReadOnlyList <ProductSpecification> specifications, ProductDimensions dimensions)
 {
     DisplayName             = displayName;
     Description             = description;
     ImageInformation        = imageInformation;
     CostInformation         = costInformation;
     AvailabilityInformation = availabilityInformation;
     HierarchyInformation    = hierarchyInformation;
     FilterableProperties    = filterableProperties;
     Specifications          = specifications;
     Dimensions = dimensions;
 }
        internal static ProductConfiguration DeserializeProductConfiguration(JsonElement element)
        {
            Optional <string>             displayName = default;
            Optional <ProductDescription> description = default;
            Optional <IReadOnlyList <ImageInformation> > imageInformation            = default;
            Optional <CostInformation>                       costInformation         = default;
            Optional <AvailabilityInformation>               availabilityInformation = default;
            Optional <HierarchyInformation>                  hierarchyInformation    = default;
            Optional <IReadOnlyList <FilterableProperty> >   filterableProperties    = default;
            Optional <IReadOnlyList <ProductSpecification> > specifications          = default;
            Optional <ProductDimensions>                     dimensions = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("displayName"))
                        {
                            displayName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("description"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            description = ProductDescription.DeserializeProductDescription(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("imageInformation"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ImageInformation> array = new List <ImageInformation>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Models.ImageInformation.DeserializeImageInformation(item));
                            }
                            imageInformation = array;
                            continue;
                        }
                        if (property0.NameEquals("costInformation"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            costInformation = CostInformation.DeserializeCostInformation(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("availabilityInformation"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            availabilityInformation = AvailabilityInformation.DeserializeAvailabilityInformation(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hierarchyInformation"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hierarchyInformation = HierarchyInformation.DeserializeHierarchyInformation(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("filterableProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <FilterableProperty> array = new List <FilterableProperty>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(FilterableProperty.DeserializeFilterableProperty(item));
                            }
                            filterableProperties = array;
                            continue;
                        }
                        if (property0.NameEquals("specifications"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ProductSpecification> array = new List <ProductSpecification>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ProductSpecification.DeserializeProductSpecification(item));
                            }
                            specifications = array;
                            continue;
                        }
                        if (property0.NameEquals("dimensions"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dimensions = ProductDimensions.DeserializeProductDimensions(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ProductConfiguration(displayName.Value, description.Value, Optional.ToList(imageInformation), costInformation.Value, availabilityInformation.Value, hierarchyInformation.Value, Optional.ToList(filterableProperties), Optional.ToList(specifications), dimensions.Value));
        }