part of 'generated.dart';

class FilterAccountsVariablesBuilder {
  Optional<String> _bank = Optional.optional(nativeFromJson, nativeToJson);
  Optional<AccountType> _type = Optional.optional((data) => AccountType.values.byName(data), enumSerializer);
  Optional<bool> _isPrimary = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _ownerId = Optional.optional(nativeFromJson, nativeToJson);

  final FirebaseDataConnect _dataConnect;
  FilterAccountsVariablesBuilder bank(String? t) {
   _bank.value = t;
   return this;
  }
  FilterAccountsVariablesBuilder type(AccountType? t) {
   _type.value = t;
   return this;
  }
  FilterAccountsVariablesBuilder isPrimary(bool? t) {
   _isPrimary.value = t;
   return this;
  }
  FilterAccountsVariablesBuilder ownerId(String? t) {
   _ownerId.value = t;
   return this;
  }

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

  QueryRef<FilterAccountsData, FilterAccountsVariables> ref() {
    FilterAccountsVariables vars= FilterAccountsVariables(bank: _bank,type: _type,isPrimary: _isPrimary,ownerId: _ownerId,);
    return _dataConnect.query("filterAccounts", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class FilterAccountsAccounts {
  final String id;
  final String bank;
  final EnumValue<AccountType> type;
  final String last4;
  final bool? isPrimary;
  final String ownerId;
  final String? accountNumber;
  final Timestamp? expiryTime;
  final String? routeNumber;
  FilterAccountsAccounts.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']),
  bank = nativeFromJson<String>(json['bank']),
  type = accountTypeDeserializer(json['type']),
  last4 = nativeFromJson<String>(json['last4']),
  isPrimary = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']),
  ownerId = nativeFromJson<String>(json['ownerId']),
  accountNumber = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']),
  expiryTime = json['expiryTime'] == null ? null : Timestamp.fromJson(json['expiryTime']),
  routeNumber = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final FilterAccountsAccounts otherTyped = other as FilterAccountsAccounts;
    return id == otherTyped.id && 
    bank == otherTyped.bank && 
    type == otherTyped.type && 
    last4 == otherTyped.last4 && 
    isPrimary == otherTyped.isPrimary && 
    ownerId == otherTyped.ownerId && 
    accountNumber == otherTyped.accountNumber && 
    expiryTime == otherTyped.expiryTime && 
    routeNumber == otherTyped.routeNumber;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, expiryTime.hashCode, routeNumber.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    json['bank'] = nativeToJson<String>(bank);
    json['type'] = 
    accountTypeSerializer(type)
    ;
    json['last4'] = nativeToJson<String>(last4);
    if (isPrimary != null) {
      json['isPrimary'] = nativeToJson<bool?>(isPrimary);
    }
    json['ownerId'] = nativeToJson<String>(ownerId);
    if (accountNumber != null) {
      json['accountNumber'] = nativeToJson<String?>(accountNumber);
    }
    if (expiryTime != null) {
      json['expiryTime'] = expiryTime!.toJson();
    }
    if (routeNumber != null) {
      json['routeNumber'] = nativeToJson<String?>(routeNumber);
    }
    return json;
  }

  FilterAccountsAccounts({
    required this.id,
    required this.bank,
    required this.type,
    required this.last4,
    this.isPrimary,
    required this.ownerId,
    this.accountNumber,
    this.expiryTime,
    this.routeNumber,
  });
}

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

    final FilterAccountsData otherTyped = other as FilterAccountsData;
    return accounts == otherTyped.accounts;
    
  }
  @override
  int get hashCode => accounts.hashCode;
  

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

  FilterAccountsData({
    required this.accounts,
  });
}

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

    final FilterAccountsVariables otherTyped = other as FilterAccountsVariables;
    return bank == otherTyped.bank && 
    type == otherTyped.type && 
    isPrimary == otherTyped.isPrimary && 
    ownerId == otherTyped.ownerId;
    
  }
  @override
  int get hashCode => Object.hashAll([bank.hashCode, type.hashCode, isPrimary.hashCode, ownerId.hashCode]);
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if(bank.state == OptionalState.set) {
      json['bank'] = bank.toJson();
    }
    if(type.state == OptionalState.set) {
      json['type'] = type.toJson();
    }
    if(isPrimary.state == OptionalState.set) {
      json['isPrimary'] = isPrimary.toJson();
    }
    if(ownerId.state == OptionalState.set) {
      json['ownerId'] = ownerId.toJson();
    }
    return json;
  }

  FilterAccountsVariables({
    required this.bank,
    required this.type,
    required this.isPrimary,
    required this.ownerId,
  });
}

