internal static NetworkRuleSet DeserializeNetworkRuleSet(JsonElement element)
        {
            Optional <string>        id            = default;
            Optional <string>        name          = default;
            Optional <string>        type          = default;
            Optional <DefaultAction> defaultAction = default;
            Optional <IList <NWRuleSetVirtualNetworkRules> > virtualNetworkRules = default;
            Optional <IList <NWRuleSetIpRules> >             ipRules             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("defaultAction"))
                        {
                            defaultAction = new DefaultAction(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("virtualNetworkRules"))
                        {
                            List <NWRuleSetVirtualNetworkRules> array = new List <NWRuleSetVirtualNetworkRules>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NWRuleSetVirtualNetworkRules.DeserializeNWRuleSetVirtualNetworkRules(item));
                            }
                            virtualNetworkRules = array;
                            continue;
                        }
                        if (property0.NameEquals("ipRules"))
                        {
                            List <NWRuleSetIpRules> array = new List <NWRuleSetIpRules>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NWRuleSetIpRules.DeserializeNWRuleSetIpRules(item));
                            }
                            ipRules = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new NetworkRuleSet(id.Value, name.Value, type.Value, Optional.ToNullable(defaultAction), Optional.ToList(virtualNetworkRules), Optional.ToList(ipRules)));
        }
        internal static NetworkRuleSet DeserializeNetworkRuleSet(JsonElement element)
        {
            string        id            = default;
            string        name          = default;
            string        type          = default;
            DefaultAction?defaultAction = default;
            IList <NWRuleSetVirtualNetworkRules> virtualNetworkRules = default;
            IList <NWRuleSetIpRules>             ipRules             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("defaultAction"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            defaultAction = new DefaultAction(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("virtualNetworkRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <NWRuleSetVirtualNetworkRules> array = new List <NWRuleSetVirtualNetworkRules>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(NWRuleSetVirtualNetworkRules.DeserializeNWRuleSetVirtualNetworkRules(item));
                                }
                            }
                            virtualNetworkRules = array;
                            continue;
                        }
                        if (property0.NameEquals("ipRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <NWRuleSetIpRules> array = new List <NWRuleSetIpRules>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(NWRuleSetIpRules.DeserializeNWRuleSetIpRules(item));
                                }
                            }
                            ipRules = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new NetworkRuleSet(id, name, type, defaultAction, virtualNetworkRules, ipRules));
        }