import 'package:pshared/models/wallet/wallet.dart' as domain;
import 'package:pshared/models/payment/wallet.dart';
import 'package:pshared/utils/currency.dart';


extension WalletUiMapper on domain.WalletModel {
  Wallet toUi() => Wallet(
    id: walletRef,
    walletUserID: walletRef,
    balance: availableMoney?.toDouble() ?? balance?.available?.toDouble() ?? 0,
    currency: currencyStringToCode(asset.tokenSymbol),
    calculatedAt: balance?.calculatedAt ?? DateTime.now(),
    depositAddress: depositAddress,
    network: asset.chain,
    tokenSymbol: asset.tokenSymbol,
    contractAddress: asset.contractAddress,
    describable: describable,
  );
}
