part of 'generated.dart';

class UpdateAccountVariablesBuilder {
  String id;
  Optional<String> _bank = Optional.optional(nativeFromJson, nativeToJson);
  Optional<AccountType> _type = Optional.optional((data) => AccountType.values.byName(data), enumSerializer);
  Optional<String> _last4 = Optional.optional(nativeFromJson, nativeToJson);
  Optional<bool> _isPrimary = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _accountNumber = Optional.optional(nativeFromJson, nativeToJson);
  Optional<String> _routeNumber = Optional.optional(nativeFromJson, nativeToJson);
  Optional<Timestamp> _expiryTime = Optional.optional((json) => json['expiryTime'] = Timestamp.fromJson(json['expiryTime']), defaultSerializer);

  final FirebaseDataConnect _dataConnect;  UpdateAccountVariablesBuilder bank(String? t) {
   _bank.value = t;
   return this;
  }
  UpdateAccountVariablesBuilder type(AccountType? t) {
   _type.value = t;
   return this;
  }
  UpdateAccountVariablesBuilder last4(String? t) {
   _last4.value = t;
   return this;
  }
  UpdateAccountVariablesBuilder isPrimary(bool? t) {
   _isPrimary.value = t;
   return this;
  }
  UpdateAccountVariablesBuilder accountNumber(String? t) {
   _accountNumber.value = t;
   return this;
  }
  UpdateAccountVariablesBuilder routeNumber(String? t) {
   _routeNumber.value = t;
   return this;
  }
  UpdateAccountVariablesBuilder expiryTime(Timestamp? t) {
   _expiryTime.value = t;
   return this;
  }

  UpdateAccountVariablesBuilder(this._dataConnect, {required  this.id,});
  Deserializer<UpdateAccountData> dataDeserializer = (dynamic json)  => UpdateAccountData.fromJson(jsonDecode(json));
  Serializer<UpdateAccountVariables> varsSerializer = (UpdateAccountVariables vars) => jsonEncode(vars.toJson());
  Future<OperationResult<UpdateAccountData, UpdateAccountVariables>> execute() {
    return ref().execute();
  }

  MutationRef<UpdateAccountData, UpdateAccountVariables> ref() {
    UpdateAccountVariables vars= UpdateAccountVariables(id: id,bank: _bank,type: _type,last4: _last4,isPrimary: _isPrimary,accountNumber: _accountNumber,routeNumber: _routeNumber,expiryTime: _expiryTime,);
    return _dataConnect.mutation("updateAccount", dataDeserializer, varsSerializer, vars);
  }
}

@immutable
class UpdateAccountAccountUpdate {
  final String id;
  UpdateAccountAccountUpdate.fromJson(dynamic json):
  
  id = nativeFromJson<String>(json['id']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateAccountAccountUpdate otherTyped = other as UpdateAccountAccountUpdate;
    return id == otherTyped.id;
    
  }
  @override
  int get hashCode => id.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    return json;
  }

  UpdateAccountAccountUpdate({
    required this.id,
  });
}

@immutable
class UpdateAccountData {
  final UpdateAccountAccountUpdate? account_update;
  UpdateAccountData.fromJson(dynamic json):
  
  account_update = json['account_update'] == null ? null : UpdateAccountAccountUpdate.fromJson(json['account_update']);
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

    final UpdateAccountData otherTyped = other as UpdateAccountData;
    return account_update == otherTyped.account_update;
    
  }
  @override
  int get hashCode => account_update.hashCode;
  

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    if (account_update != null) {
      json['account_update'] = account_update!.toJson();
    }
    return json;
  }

  UpdateAccountData({
    this.account_update,
  });
}

@immutable
class UpdateAccountVariables {
  final String id;
  late final Optional<String>bank;
  late final Optional<AccountType>type;
  late final Optional<String>last4;
  late final Optional<bool>isPrimary;
  late final Optional<String>accountNumber;
  late final Optional<String>routeNumber;
  late final Optional<Timestamp>expiryTime;
  @Deprecated('fromJson is deprecated for Variable classes as they are no longer required for deserialization.')
  UpdateAccountVariables.fromJson(Map<String, dynamic> json):
  
  id = nativeFromJson<String>(json['id']) {
  
  
  
    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']);
  
  
    last4 = Optional.optional(nativeFromJson, nativeToJson);
    last4.value = json['last4'] == null ? null : nativeFromJson<String>(json['last4']);
  
  
    isPrimary = Optional.optional(nativeFromJson, nativeToJson);
    isPrimary.value = json['isPrimary'] == null ? null : nativeFromJson<bool>(json['isPrimary']);
  
  
    accountNumber = Optional.optional(nativeFromJson, nativeToJson);
    accountNumber.value = json['accountNumber'] == null ? null : nativeFromJson<String>(json['accountNumber']);
  
  
    routeNumber = Optional.optional(nativeFromJson, nativeToJson);
    routeNumber.value = json['routeNumber'] == null ? null : nativeFromJson<String>(json['routeNumber']);
  
  
    expiryTime = Optional.optional((json) => json['expiryTime'] = Timestamp.fromJson(json['expiryTime']), defaultSerializer);
    expiryTime.value = json['expiryTime'] == null ? null : Timestamp.fromJson(json['expiryTime']);
  
  }
  @override
  bool operator ==(Object other) {
    if(identical(this, other)) {
      return true;
    }
    if(other.runtimeType != runtimeType) {
      return false;
    }

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

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = {};
    json['id'] = nativeToJson<String>(id);
    if(bank.state == OptionalState.set) {
      json['bank'] = bank.toJson();
    }
    if(type.state == OptionalState.set) {
      json['type'] = type.toJson();
    }
    if(last4.state == OptionalState.set) {
      json['last4'] = last4.toJson();
    }
    if(isPrimary.state == OptionalState.set) {
      json['isPrimary'] = isPrimary.toJson();
    }
    if(accountNumber.state == OptionalState.set) {
      json['accountNumber'] = accountNumber.toJson();
    }
    if(routeNumber.state == OptionalState.set) {
      json['routeNumber'] = routeNumber.toJson();
    }
    if(expiryTime.state == OptionalState.set) {
      json['expiryTime'] = expiryTime.toJson();
    }
    return json;
  }

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

