import 'package:intl/intl.dart';

String formatMoney(dynamic piasters, {bool showCurrency = true}) {
  final amount = (piasters is int ? piasters : int.tryParse(piasters.toString()) ?? 0) / 100;
  final formatted = NumberFormat('#,##0.00', 'ar').format(amount);
  return showCurrency ? '$formatted ج.م' : formatted;
}

String formatMoneyEn(dynamic piasters, {bool showCurrency = true}) {
  final amount = (piasters is int ? piasters : int.tryParse(piasters.toString()) ?? 0) / 100;
  final formatted = NumberFormat('#,##0.00', 'en').format(amount);
  return showCurrency ? 'EGP $formatted' : formatted;
}
