import 'package:equatable/equatable.dart'; import '../../../core/ui/view_status.dart'; import '../data/models/wallet.dart'; import '../data/models/wallet_txn.dart'; enum WalletAction { none, toppingUp, topupFailed, topupDone } class WalletState extends Equatable { const WalletState({ this.status = ViewStatus.idle, this.wallet, this.transactions = const [], this.action = WalletAction.none, this.error, }); final ViewStatus status; final Wallet? wallet; final List transactions; /// فعلٌ جارٍ داخل الشاشة — منفصل عن [status] كي لا يُخفي الشحنُ الرصيدَ /// المعروض خلفه. final WalletAction action; final String? error; String get currency => wallet?.currency ?? ''; WalletState copyWith({ ViewStatus? status, Wallet? wallet, List? transactions, WalletAction? action, String? error, }) { return WalletState( status: status ?? this.status, wallet: wallet ?? this.wallet, transactions: transactions ?? this.transactions, action: action ?? this.action, error: error ?? this.error, ); } @override List get props => [status, wallet, transactions, action, error]; }