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

class PriceInfoModel extends PriceInfo {
  const PriceInfoModel({
    required super.price,
    required super.greenPoints,
    required super.blackHoleAmount,
    required super.circulationPool,
    required super.effectiveDenominator,
    required super.burnMultiplier,
    required super.minuteBurnRate,
    required super.snapshotTime,
    required super.priceChangePercent,
    required super.initialPrice,
  });

  factory PriceInfoModel.fromJson(Map<String, dynamic> json) {
    return PriceInfoModel(
      price: json['price']?.toString() ?? '0',
      greenPoints: json['greenPoints']?.toString() ?? '0',
      blackHoleAmount: json['blackHoleAmount']?.toString() ?? '0',
      circulationPool: json['circulationPool']?.toString() ?? '0',
      effectiveDenominator: json['effectiveDenominator']?.toString() ?? '0',
      burnMultiplier: json['burnMultiplier']?.toString() ?? '0',
      minuteBurnRate: json['minuteBurnRate']?.toString() ?? '0',
      snapshotTime: json['snapshotTime'] != null
          ? DateTime.parse(json['snapshotTime'].toString())
          : DateTime.now(),
      priceChangePercent: json['priceChangePercent']?.toString() ?? '0',
      initialPrice: json['initialPrice']?.toString() ?? '0',
    );
  }
}
