part of 'bank_account_bloc.dart';

@immutable
class BankAccountState {
  final BankAcc? bankAcc;
  final bool inLoading;

  final bool success;

  const BankAccountState(
      {this.inLoading = false, this.success = false, this.bankAcc});

  BankAccountState copyWith({
    BankAcc? bankAcc,
    bool? inLoading,
    bool? success,
  }) {
    return BankAccountState(
      inLoading: inLoading ?? false,
      success: success ?? false,
      bankAcc: bankAcc ?? this.bankAcc,
    );
  }

  Map<String, BankAccField> mapFromBankAccount() {
    return {
      'holder_name': BankAccField(
        title: 'account_holder_name'.tr(),
        value: bankAcc?.holderName,
      ),
      'bank_name': BankAccField(
        title: 'bank_name'.tr(),
        value: bankAcc?.bankName,
      ),
      'number': BankAccField(
        title: 'account_number'.tr(),
        value: bankAcc?.number,
      ),
      'routing_number': BankAccField(
          title: 'routing_number_us'.tr(),
          value: bankAcc?.routingNumber,
          optional: true),
      'country': BankAccField(
        title: 'country'.tr(),
        value: bankAcc?.country,
      ),
      'state': BankAccField(
        title: 'state'.tr(),
        value: bankAcc?.state,
      ),
      'city': BankAccField(
        title: 'city'.tr(),
        value: bankAcc?.city,
      ),
      'street': BankAccField(
        title: 'street_address'.tr(),
        value: bankAcc?.street,
      ),
      'building': BankAccField(
          title: 'apt_suite_building'.tr(),
          value: bankAcc?.building,
          optional: true),
      'zip': BankAccField(
        title: 'zip_code'.tr(),
        value: bankAcc?.zip,
      ),
    };
  }
}

class BankAccField {
  String title;
  String? value;
  bool optional;

  BankAccField({required this.title, this.value = '', this.optional = false});
}
