import '../../domain/entities/trading_account.dart';

class TradingAccountModel extends TradingAccount {
  const TradingAccountModel({
    required super.accountSequence,
    required super.shareBalance,
    required super.cashBalance,
    required super.availableShares,
    required super.availableCash,
    required super.frozenShares,
    required super.frozenCash,
    required super.totalBought,
    required super.totalSold,
  });

  factory TradingAccountModel.fromJson(Map<String, dynamic> json) {
    return TradingAccountModel(
      accountSequence: json['accountSequence']?.toString() ?? '',
      shareBalance: json['shareBalance']?.toString() ?? '0',
      cashBalance: json['cashBalance']?.toString() ?? '0',
      availableShares: json['availableShares']?.toString() ?? '0',
      availableCash: json['availableCash']?.toString() ?? '0',
      frozenShares: json['frozenShares']?.toString() ?? '0',
      frozenCash: json['frozenCash']?.toString() ?? '0',
      totalBought: json['totalBought']?.toString() ?? '0',
      totalSold: json['totalSold']?.toString() ?? '0',
    );
  }
}
