class AirdropEligibility {
  final int inviteCount;
  final int requiredInviteCount;
  final bool inviteTaskCompleted;
  final bool hasActiveStaking;
  final bool hasPendingAirdrop;
  final String claimableAmount;
  final String? claimableCoinUnit;
  final bool eligible;
  final String message;

  const AirdropEligibility({
    required this.inviteCount,
    required this.requiredInviteCount,
    required this.inviteTaskCompleted,
    required this.hasActiveStaking,
    required this.hasPendingAirdrop,
    required this.claimableAmount,
    this.claimableCoinUnit,
    required this.eligible,
    required this.message,
  });

  factory AirdropEligibility.empty() {
    return const AirdropEligibility(
      inviteCount: 0,
      requiredInviteCount: 3,
      inviteTaskCompleted: false,
      hasActiveStaking: false,
      hasPendingAirdrop: false,
      claimableAmount: '0',
      claimableCoinUnit: null,
      eligible: false,
      message: '',
    );
  }

  factory AirdropEligibility.fromJson(Map<String, dynamic> json) {
    return AirdropEligibility(
      inviteCount: int.tryParse('${json['inviteCount'] ?? 0}') ?? 0,
      requiredInviteCount:
          int.tryParse('${json['requiredInviteCount'] ?? 0}') ?? 0,
      inviteTaskCompleted: json['inviteTaskCompleted'] == true,
      hasActiveStaking: json['hasActiveStaking'] == true,
      hasPendingAirdrop: json['hasPendingAirdrop'] == true,
      claimableAmount: '${json['claimableAmount'] ?? '0'}',
      claimableCoinUnit: json['claimableCoinUnit']?.toString(),
      eligible: json['eligible'] == true,
      message: '${json['message'] ?? ''}',
    );
  }
}
