import 'package:equatable/equatable.dart';

class ShareAccount extends Equatable {
  final String accountSequence;
  final String miningBalance;
  final String tradingBalance;
  final String frozenBalance;
  final String totalMined;
  final String perSecondEarning;
  final String effectiveContribution;
  final DateTime? firstMiningDate;

  const ShareAccount({
    required this.accountSequence,
    required this.miningBalance,
    required this.tradingBalance,
    required this.frozenBalance,
    required this.totalMined,
    required this.perSecondEarning,
    required this.effectiveContribution,
    this.firstMiningDate,
  });

  String get totalBalance {
    final mining = double.tryParse(miningBalance) ?? 0;
    final trading = double.tryParse(tradingBalance) ?? 0;
    final frozen = double.tryParse(frozenBalance) ?? 0;
    return (mining + trading + frozen).toString();
  }

  @override
  List<Object?> get props => [
        accountSequence,
        miningBalance,
        tradingBalance,
        frozenBalance,
        totalMined,
        perSecondEarning,
        effectiveContribution,
        firstMiningDate,
      ];
}
