import 'package:pweb/models/currency.dart'; import 'package:pweb/models/wallet.dart'; abstract class WalletsService { Future> getWallets(); Future getBalance(String walletRef); } class MockWalletsService implements WalletsService { final List _wallets = [ Wallet(id: '1124', walletUserID: 'WA-12345667', name: 'Main Wallet', balance: 10000000.0, currency: Currency.rub), Wallet(id: '2124', walletUserID: 'WA-76654321', name: 'Savings', balance: 2500.5, currency: Currency.usd), ]; @override Future> getWallets() async { return _wallets; } @override Future getWallet(String walletId) async { return _wallets.firstWhere( (wallet) => wallet.id == walletId, orElse: () => throw Exception('Wallet not found'), ); } @override Future getBalance(String walletRef) async { final wallet = _wallets.firstWhere( (w) => w.id == walletRef, orElse: () => throw Exception('Wallet not found'), ); return wallet.balance; } }