class StakingConfig {
  final int id;
  final String productName;
  final String coinUnit;
  final String minAmount;
  final String maxAmount;
  final int lockDays;
  final int releaseType;
  final int releasePeriod;
  final String releaseRate;
  final int status;

  const StakingConfig({
    required this.id,
    required this.productName,
    required this.coinUnit,
    required this.minAmount,
    required this.maxAmount,
    required this.lockDays,
    required this.releaseType,
    required this.releasePeriod,
    required this.releaseRate,
    required this.status,
  });

  factory StakingConfig.fromJson(Map<String, dynamic> json) {
    return StakingConfig(
      id: int.tryParse('${json['id'] ?? 0}') ?? 0,
      productName: '${json['productName'] ?? ''}',
      coinUnit: '${json['coinUnit'] ?? ''}'.toUpperCase(),
      minAmount: '${json['minAmount'] ?? '0'}',
      maxAmount: '${json['maxAmount'] ?? '0'}',
      lockDays: int.tryParse('${json['lockDays'] ?? 0}') ?? 0,
      releaseType: int.tryParse('${json['releaseType'] ?? 0}') ?? 0,
      releasePeriod: int.tryParse('${json['releasePeriod'] ?? 0}') ?? 0,
      releaseRate: '${json['releaseRate'] ?? '0'}',
      status: int.tryParse('${json['status'] ?? 0}') ?? 0,
    );
  }
}
