import 'package:pshared/models/ledger/account.dart';
import 'package:pshared/models/payment/wallet.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


String walletDisplayName(Wallet wallet, AppLocalizations l10n) {
  return sourceDisplayName(name: wallet.name, fallback: l10n.paymentTypeWallet);
}

String ledgerDisplayName(LedgerAccount ledger, AppLocalizations l10n) {
  return sourceDisplayName(name: ledger.name, fallback: l10n.paymentTypeLedger);
}

String sourceDisplayName({required String name, required String fallback}) {
  final normalized = name.trim();
  if (normalized.isNotEmpty) return normalized;
  return fallback;
}
