internal static ConnectionMonitorHttpConfiguration DeserializeConnectionMonitorHttpConfiguration(JsonElement element)
        {
            Optional <int> port = default;
            Optional <HttpConfigurationMethod> method = default;
            Optional <string> path = default;
            Optional <IList <HttpHeader> > requestHeaders        = default;
            Optional <IList <string> >     validStatusCodeRanges = default;
            Optional <bool> preferHTTPS = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("port"))
                {
                    port = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("method"))
                {
                    method = new HttpConfigurationMethod(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("path"))
                {
                    path = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("requestHeaders"))
                {
                    List <HttpHeader> array = new List <HttpHeader>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(HttpHeader.DeserializeHttpHeader(item));
                    }
                    requestHeaders = array;
                    continue;
                }
                if (property.NameEquals("validStatusCodeRanges"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    validStatusCodeRanges = array;
                    continue;
                }
                if (property.NameEquals("preferHTTPS"))
                {
                    preferHTTPS = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new ConnectionMonitorHttpConfiguration(Optional.ToNullable(port), Optional.ToNullable(method), path.Value, Optional.ToList(requestHeaders), Optional.ToList(validStatusCodeRanges), Optional.ToNullable(preferHTTPS)));
        }
        internal static ConnectionMonitorHttpConfiguration DeserializeConnectionMonitorHttpConfiguration(JsonElement element)
        {
            int?port = default;
            HttpConfigurationMethod?method           = default;
            string             path                  = default;
            IList <HttpHeader> requestHeaders        = default;
            IList <string>     validStatusCodeRanges = default;
            bool?preferHTTPS = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("port"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    port = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("method"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    method = new HttpConfigurationMethod(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("path"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    path = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("requestHeaders"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <HttpHeader> array = new List <HttpHeader>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(HttpHeader.DeserializeHttpHeader(item));
                        }
                    }
                    requestHeaders = array;
                    continue;
                }
                if (property.NameEquals("validStatusCodeRanges"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(item.GetString());
                        }
                    }
                    validStatusCodeRanges = array;
                    continue;
                }
                if (property.NameEquals("preferHTTPS"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    preferHTTPS = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new ConnectionMonitorHttpConfiguration(port, method, path, requestHeaders, validStatusCodeRanges, preferHTTPS));
        }