internal static ManagementPolicyRule DeserializeManagementPolicyRule(JsonElement element)
        {
            Optional <bool>            enabled    = default;
            string                     name       = default;
            RuleType                   type       = default;
            ManagementPolicyDefinition definition = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("enabled"))
                {
                    enabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new RuleType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("definition"))
                {
                    definition = ManagementPolicyDefinition.DeserializeManagementPolicyDefinition(property.Value);
                    continue;
                }
            }
            return(new ManagementPolicyRule(Optional.ToNullable(enabled), name, type, definition));
        }
        internal static ManagementPolicyRule DeserializeManagementPolicyRule(JsonElement element)
        {
            bool?  enabled = default;
            string name    = default;
            string type    = default;
            ManagementPolicyDefinition definition = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("enabled"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    enabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("definition"))
                {
                    definition = ManagementPolicyDefinition.DeserializeManagementPolicyDefinition(property.Value);
                    continue;
                }
            }
            return(new ManagementPolicyRule(enabled, name, type, definition));
        }