internal static RoleAssignment DeserializeRoleAssignment(JsonElement element)
        {
            Optional <string> id   = default;
            Optional <string> name = default;
            Optional <string> type = default;
            Optional <RoleAssignmentPropertiesWithScope> properties = 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"))
                {
                    properties = RoleAssignmentPropertiesWithScope.DeserializeRoleAssignmentPropertiesWithScope(property.Value);
                    continue;
                }
            }
            return(new RoleAssignment(id.Value, name.Value, type.Value, properties.Value));
        }
        internal static RoleAssignment DeserializeRoleAssignment(JsonElement element)
        {
            string id   = default;
            string name = default;
            string type = default;
            RoleAssignmentPropertiesWithScope properties = 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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    properties = RoleAssignmentPropertiesWithScope.DeserializeRoleAssignmentPropertiesWithScope(property.Value);
                    continue;
                }
            }
            return(new RoleAssignment(id, name, type, properties));
        }
 /// <summary>
 /// Initializes a new instance of RoleAssignment.
 /// </summary>
 /// <param name="id"> The role assignment ID. </param>
 /// <param name="name"> The role assignment name. </param>
 /// <param name="type"> The role assignment type. </param>
 /// <param name="properties"> Role assignment properties. </param>
 public static RoleAssignment RoleAssignment(string id, string name, string type, RoleAssignmentPropertiesWithScope properties) =>
 new RoleAssignment(id, name, type, properties);