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

class AssetDisplayModel extends AssetDisplay {
  const AssetDisplayModel({
    required super.miningShareBalance,
    required super.tradingShareBalance,
    required super.shareBalance,
    required super.cashBalance,
    required super.frozenShares,
    required super.frozenCash,
    required super.availableShares,
    required super.availableCash,
    required super.currentPrice,
    required super.burnMultiplier,
    required super.effectiveShares,
    required super.displayAssetValue,
    required super.assetGrowthPerSecond,
    required super.totalBought,
    required super.totalSold,
  });

  factory AssetDisplayModel.fromJson(Map<String, dynamic> json) {
    return AssetDisplayModel(
      miningShareBalance: json['miningShareBalance']?.toString() ?? '0',
      tradingShareBalance: json['tradingShareBalance']?.toString() ?? '0',
      shareBalance: json['shareBalance']?.toString() ?? '0',
      cashBalance: json['cashBalance']?.toString() ?? '0',
      frozenShares: json['frozenShares']?.toString() ?? '0',
      frozenCash: json['frozenCash']?.toString() ?? '0',
      availableShares: json['availableShares']?.toString() ?? '0',
      availableCash: json['availableCash']?.toString() ?? '0',
      currentPrice: json['currentPrice']?.toString() ?? '0',
      burnMultiplier: json['burnMultiplier']?.toString() ?? '0',
      effectiveShares: json['effectiveShares']?.toString() ?? '0',
      displayAssetValue: json['displayAssetValue']?.toString() ?? '0',
      assetGrowthPerSecond: json['assetGrowthPerSecond']?.toString() ?? '0',
      totalBought: json['totalBought']?.toString() ?? '0',
      totalSold: json['totalSold']?.toString() ?? '0',
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'miningShareBalance': miningShareBalance,
      'tradingShareBalance': tradingShareBalance,
      'shareBalance': shareBalance,
      'cashBalance': cashBalance,
      'frozenShares': frozenShares,
      'frozenCash': frozenCash,
      'availableShares': availableShares,
      'availableCash': availableCash,
      'currentPrice': currentPrice,
      'burnMultiplier': burnMultiplier,
      'effectiveShares': effectiveShares,
      'displayAssetValue': displayAssetValue,
      'assetGrowthPerSecond': assetGrowthPerSecond,
      'totalBought': totalBought,
      'totalSold': totalSold,
    };
  }
}
