part of 'generated.dart';

class FilterUsersVariablesBuilder {
  Optional<String> _id = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _email = Optional.optional(nativeFromJson, nativeToJson);
  Optional<UserBaseRole> _role = Optional.optional((data) => UserBaseRole.values.byName(data), enumSerializer);
  Optional<String> _userRole = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;
  FilterUsersVariablesBuilder id(String? t) {
   _id.value = t;
   return this;
  }
  FilterUsersVariablesBuilder email(String? t) {
   _email.value = t;
   return this;
  }
  FilterUsersVariablesBuilder role(UserBaseRole? t) {
   _role.value = t;
   return this;
  }
  FilterUsersVariablesBuilder userRole(String? t) {
   _userRole.value = t;
   return this;
  }

  FilterUsersVariablesBuilder(this._dataConnect, );
  Deserializer<FilterUsersData> dataDeserializer = (dynamic json)  => FilterUsersData.fromJson(jsonDecode(json));
  Serializer<FilterUsersVariables> varsSerializer = (FilterUsersVariables vars) => jsonEncode(vars.toJson());
  Future<QueryResult<FilterUsersData, FilterUsersVariables>> execute() {
    return ref().execute();
  }

  QueryRef<FilterUsersData, FilterUsersVariables> ref() {
    FilterUsersVariables vars= FilterUsersVariables(id: _id,email: _email,role: _role,userRole: _userRole,);
    return _dataConnect.query("filterUsers", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class FilterUsersUsers {
  final String id;
  final String? email;
  final String? fullName;
  final EnumValue<UserBaseRole> role;
  final String? userRole;
  final String? photoUrl;
  FilterUsersUsers.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  email = json['email'] == null ? null : nativeFromJson<String>(json['email']),
  fullName = json['fullName'] == null ? null : nativeFromJson<String>(json['fullName']),
  role = userBaseRoleDeserializer(json['role']),
  userRole = json['userRole'] == null ? null : nativeFromJson<String>(json['userRole']),
  photoUrl = json['photoUrl'] == null ? null : nativeFromJson<String>(json['photoUrl']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterUsersUsers otherTyped = other as FilterUsersUsers;
    return id == otherTyped.id && 
    email == otherTyped.email && 
    fullName == otherTyped.fullName && 
    role == otherTyped.role && 
    userRole == otherTyped.userRole && 
    photoUrl == otherTyped.photoUrl;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, email.hashCode, fullName.hashCode, role.hashCode, userRole.hashCode, photoUrl.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if (email != null) {
      json['email'] = nativeToJson<String?>(email);
    }
    if (fullName != null) {
      json['fullName'] = nativeToJson<String?>(fullName);
    }
    json['role'] = 
    userBaseRoleSerializer(role)
    ;
    if (userRole != null) {
      json['userRole'] = nativeToJson<String?>(userRole);
    }
    if (photoUrl != null) {
      json['photoUrl'] = nativeToJson<String?>(photoUrl);
    }
    return json;
  }

  FilterUsersUsers({
    required this.id,
    this.email,
    this.fullName,
    required this.role,
    this.userRole,
    this.photoUrl,
  });
}

@immutable
class FilterUsersData {
  final List<FilterUsersUsers> users;
  FilterUsersData.fromJson(dynamic json):
  
  users = (json['users'] as List<dynamic>)
        .map((e) => FilterUsersUsers.fromJson(e))
        .toList();
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterUsersData otherTyped = other as FilterUsersData;
    return users == otherTyped.users;
    
  }
  @override
  int get hashCode => users.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['users'] = users.map((e) => e.toJson()).toList();
    return json;
  }

  FilterUsersData({
    required this.users,
  });
}

@immutable
class FilterUsersVariables {
  late final Optional<String>id;
  late final Optional<String>email;
  late final Optional<UserBaseRole>role;
  late final Optional<String>userRole;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  FilterUsersVariables.fromJson(Map<String, dynamic> json) {
  
  
    id = Optional.optional(nativeFromJson, nativeToJson);
    id.value = json['id'] == null ? null : nativeFromJson<String>(json['id']);
  
  
    email = Optional.optional(nativeFromJson, nativeToJson);
    email.value = json['email'] == null ? null : nativeFromJson<String>(json['email']);
  
  
    role = Optional.optional((data) => UserBaseRole.values.byName(data), enumSerializer);
    role.value = json['role'] == null ? null : UserBaseRole.values.byName(json['role']);
  
  
    userRole = Optional.optional(nativeFromJson, nativeToJson);
    userRole.value = json['userRole'] == null ? null : nativeFromJson<String>(json['userRole']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterUsersVariables otherTyped = other as FilterUsersVariables;
    return id == otherTyped.id && 
    email == otherTyped.email && 
    role == otherTyped.role && 
    userRole == otherTyped.userRole;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, email.hashCode, role.hashCode, userRole.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if(id.state == OptionalState.set) {
      json['id'] = id.toJson();
    }
    if(email.state == OptionalState.set) {
      json['email'] = email.toJson();
    }
    if(role.state == OptionalState.set) {
      json['role'] = role.toJson();
    }
    if(userRole.state == OptionalState.set) {
      json['userRole'] = userRole.toJson();
    }
    return json;
  }

  FilterUsersVariables({
    required this.id,
    required this.email,
    required this.role,
    required this.userRole,
  });
}

