internal MatchCondition(IList <MatchVariable> matchVariables, WebApplicationFirewallOperator @operator, bool?negationConditon, IList <string> matchValues, IList <WebApplicationFirewallTransform> transforms)
 {
     MatchVariables   = matchVariables ?? new List <MatchVariable>();
     Operator         = @operator;
     NegationConditon = negationConditon;
     MatchValues      = matchValues ?? new List <string>();
     Transforms       = transforms;
 }
        internal static MatchCondition DeserializeMatchCondition(JsonElement element)
        {
            IList <MatchVariable>          matchVariables = default;
            WebApplicationFirewallOperator @operator      = default;
            Optional <bool> negationConditon = default;
            IList <string>  matchValues      = default;
            Optional <IList <WebApplicationFirewallTransform> > transforms = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("matchVariables"))
                {
                    List <MatchVariable> array = new List <MatchVariable>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(MatchVariable.DeserializeMatchVariable(item));
                    }
                    matchVariables = array;
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new WebApplicationFirewallOperator(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("negationConditon"))
                {
                    negationConditon = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("matchValues"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    matchValues = array;
                    continue;
                }
                if (property.NameEquals("transforms"))
                {
                    List <WebApplicationFirewallTransform> array = new List <WebApplicationFirewallTransform>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new WebApplicationFirewallTransform(item.GetString()));
                    }
                    transforms = array;
                    continue;
                }
            }
            return(new MatchCondition(matchVariables, @operator, Optional.ToNullable(negationConditon), matchValues, Optional.ToList(transforms)));
        }
        public MatchCondition(IEnumerable <MatchVariable> matchVariables, WebApplicationFirewallOperator @operator, IEnumerable <string> matchValues)
        {
            if (matchVariables == null)
            {
                throw new ArgumentNullException(nameof(matchVariables));
            }
            if (matchValues == null)
            {
                throw new ArgumentNullException(nameof(matchValues));
            }

            MatchVariables = matchVariables.ToList();
            Operator       = @operator;
            MatchValues    = matchValues.ToList();
        }