part of 'generated.dart';

class ListAccountsVariablesBuilder {
  
  final FirebaseDataConnect _dataConnect;
  ListAccountsVariablesBuilder(this._dataConnect, );
  Deserializer<ListAccountsData> dataDeserializer = (dynamic json)  => ListAccountsData.fromJson(jsonDecode(json));
  
  Future<QueryResult<ListAccountsData, void>> execute() {
    return ref().execute();
  }

  QueryRef<ListAccountsData, void> ref() {
    
    return _dataConnect.query("listAccounts", dataDeserializer, emptySerializer, null);
  }
}

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

    final ListAccountsAccounts otherTyped = other as ListAccountsAccounts;
    return id == otherTyped.id && 
    bank == otherTyped.bank && 
    type == otherTyped.type && 
    last4 == otherTyped.last4 && 
    isPrimary == otherTyped.isPrimary && 
    ownerId == otherTyped.ownerId && 
    accountNumber == otherTyped.accountNumber && 
    routeNumber == otherTyped.routeNumber && 
    expiryTime == otherTyped.expiryTime && 
    createdAt == otherTyped.createdAt;
    
  }
  @override
  int get hashCode => Object.hashAll([id.hashCode, bank.hashCode, type.hashCode, last4.hashCode, isPrimary.hashCode, ownerId.hashCode, accountNumber.hashCode, routeNumber.hashCode, expiryTime.hashCode, createdAt.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 (routeNumber != null) {
      json['routeNumber'] = nativeToJson<String?>(routeNumber);
    }
    if (expiryTime != null) {
      json['expiryTime'] = expiryTime!.toJson();
    }
    if (createdAt != null) {
      json['createdAt'] = createdAt!.toJson();
    }
    return json;
  }

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

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

    final ListAccountsData otherTyped = other as ListAccountsData;
    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;
  }

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

