Esempio n. 1
0
        internal static ProductConfigurations DeserializeProductConfigurations(JsonElement element)
        {
            Optional <IReadOnlyList <ProductConfiguration> > value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ProductConfiguration> array = new List <ProductConfiguration>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ProductConfiguration.DeserializeProductConfiguration(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new ProductConfigurations(Optional.ToList(value), nextLink.Value));
        }
        internal static EdgeOrderProduct DeserializeEdgeOrderProduct(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 <ProductConfiguration> > configurations          = 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("configurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ProductConfiguration> array = new List <ProductConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ProductConfiguration.DeserializeProductConfiguration(item));
                            }
                            configurations = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new EdgeOrderProduct(displayName.Value, description.Value, Optional.ToList(imageInformation), costInformation.Value, availabilityInformation.Value, hierarchyInformation.Value, Optional.ToList(filterableProperties), Optional.ToList(configurations)));
        }