import 'package:flutter/widgets.dart';

import 'package:pshared/models/ledger/account.dart';
import 'package:pshared/utils/currency.dart';

import 'package:pweb/utils/money_display.dart';


class LedgerBalanceFormatter {
  const LedgerBalanceFormatter._();

  static String format(BuildContext context, LedgerAccount account) {
    return formatMoneyUi(context, account.balance?.balance);
  }

  static String formatMasked(LedgerAccount account) {
    final currency = account.currency.trim();
    if (currency.isEmpty) return '••••';

    final symbol = currencySymbolFromCode(currency);
    if (symbol == null || symbol.trim().isEmpty) {
      return '•••• $currency';
    }
    return '•••• $symbol';
  }
}
