part of 'generated.dart';

class FilterStaffRolesVariablesBuilder {
  Optional<String> _staffId = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _roleId = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _offset = Optional.optional(nativeFromJson, nativeToJson);
  Optional<int> _limit = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;
  FilterStaffRolesVariablesBuilder staffId(String? t) {
   _staffId.value = t;
   return this;
  }
  FilterStaffRolesVariablesBuilder roleId(String? t) {
   _roleId.value = t;
   return this;
  }
  FilterStaffRolesVariablesBuilder offset(int? t) {
   _offset.value = t;
   return this;
  }
  FilterStaffRolesVariablesBuilder limit(int? t) {
   _limit.value = t;
   return this;
  }

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

  QueryRef<FilterStaffRolesData, FilterStaffRolesVariables> ref() {
    FilterStaffRolesVariables vars= FilterStaffRolesVariables(staffId: _staffId,roleId: _roleId,offset: _offset,limit: _limit,);
    return _dataConnect.query("filterStaffRoles", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class FilterStaffRolesStaffRoles {
  final String id;
  final String staffId;
  final String roleId;
  final Timestamp? createdAt;
  final EnumValue<RoleType>? roleType;
  FilterStaffRolesStaffRoles.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  staffId = nativeFromJson<String>(json['staffId']),
  roleId = nativeFromJson<String>(json['roleId']),
  createdAt = json['createdAt'] == null ? null : Timestamp.fromJson(json['createdAt']),
  roleType = json['roleType'] == null ? null : roleTypeDeserializer(json['roleType']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterStaffRolesStaffRoles otherTyped = other as FilterStaffRolesStaffRoles;
    return id == otherTyped.id && 
    staffId == otherTyped.staffId && 
    roleId == otherTyped.roleId && 
    createdAt == otherTyped.createdAt && 
    roleType == otherTyped.roleType;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, staffId.hashCode, roleId.hashCode, createdAt.hashCode, roleType.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['staffId'] = nativeToJson<String>(staffId);
    json['roleId'] = nativeToJson<String>(roleId);
    if (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    if (roleType != null) {
      json['roleType'] = 
    roleTypeSerializer(roleType!)
    ;
    }
    return json;
  }

  FilterStaffRolesStaffRoles({
    required this.id,
    required this.staffId,
    required this.roleId,
    this.createdAt,
    this.roleType,
  });
}

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

    final FilterStaffRolesData otherTyped = other as FilterStaffRolesData;
    return staffRoles == otherTyped.staffRoles;
    
  }
  @override
  int get hashCode => staffRoles.hashCode;
  

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

  FilterStaffRolesData({
    required this.staffRoles,
  });
}

@immutable
class FilterStaffRolesVariables {
  late final Optional<String>staffId;
  late final Optional<String>roleId;
  late final Optional<int>offset;
  late final Optional<int>limit;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  FilterStaffRolesVariables.fromJson(Map<String, dynamic> json) {
  
  
    staffId = Optional.optional(nativeFromJson, nativeToJson);
    staffId.value = json['staffId'] == null ? null : nativeFromJson<String>(json['staffId']);
  
  
    roleId = Optional.optional(nativeFromJson, nativeToJson);
    roleId.value = json['roleId'] == null ? null : nativeFromJson<String>(json['roleId']);
  
  
    offset = Optional.optional(nativeFromJson, nativeToJson);
    offset.value = json['offset'] == null ? null : nativeFromJson<int>(json['offset']);
  
  
    limit = Optional.optional(nativeFromJson, nativeToJson);
    limit.value = json['limit'] == null ? null : nativeFromJson<int>(json['limit']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterStaffRolesVariables otherTyped = other as FilterStaffRolesVariables;
    return staffId == otherTyped.staffId && 
    roleId == otherTyped.roleId && 
    offset == otherTyped.offset && 
    limit == otherTyped.limit;
    
  }
  @override
  int get hashCode => Object.hashAll([staffId.hashCode, roleId.hashCode, offset.hashCode, limit.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if(staffId.state == OptionalState.set) {
      json['staffId'] = staffId.toJson();
    }
    if(roleId.state == OptionalState.set) {
      json['roleId'] = roleId.toJson();
    }
    if(offset.state == OptionalState.set) {
      json['offset'] = offset.toJson();
    }
    if(limit.state == OptionalState.set) {
      json['limit'] = limit.toJson();
    }
    return json;
  }

  FilterStaffRolesVariables({
    required this.staffId,
    required this.roleId,
    required this.offset,
    required this.limit,
  });
}

