/// 券持有记录
class CouponHolding {
  final BigInt tokenId;
  final int index;
  final BigInt? batchId;

  CouponHolding({
    required this.tokenId,
    required this.index,
    this.batchId,
  });

  factory CouponHolding.fromJson(Map<String, dynamic> json) {
    return CouponHolding(
      tokenId: BigInt.parse(json['tokenId'].toString()),
      index: json['index'] as int,
      batchId: json['batchId'] != null
          ? BigInt.parse(json['batchId'].toString())
          : null,
    );
  }

  Map<String, dynamic> toJson() => {
        'tokenId': tokenId.toString(),
        'index': index,
        if (batchId != null) 'batchId': batchId.toString(),
      };
}
