import 'package:equatable/equatable.dart';

/// Account type (Checking, Savings, etc).
enum BankAccountType {
  checking,
  savings,
  other,
}

/// Represents bank account details for payroll.
class BankAccount extends Equatable {

  const BankAccount({
    required this.id,
    required this.userId,
    required this.bankName,
    required this.accountNumber,
    required this.accountName,
    this.sortCode,
    this.type = BankAccountType.checking,
    this.isPrimary = false,
    this.last4,
  });
  /// Unique identifier.
  final String id;

  /// The [User] owning the account.
  final String userId;

  /// Name of the bank.
  final String bankName;

  /// Account number.
  final String accountNumber;

  /// Name on the account.
  final String accountName;

  /// Sort code (if applicable).
  final String? sortCode;

  /// Type of account.
  final BankAccountType type;

  /// Whether this is the primary account.
  final bool isPrimary;
  
  /// Last 4 digits.
  final String? last4;

  @override
  List<Object?> get props => <Object?>[id, userId, bankName, accountNumber, accountName, sortCode, type, isPrimary, last4];
}