/// 团队信息响应 (来自 contribution-service)
class ReferralInfoResponse {
  final String accountSequence;
  final int personalPlantingCount;
  final int teamPlantingCount;
  final int directReferralCount;

  ReferralInfoResponse({
    required this.accountSequence,
    required this.personalPlantingCount,
    required this.teamPlantingCount,
    required this.directReferralCount,
  });

  factory ReferralInfoResponse.fromJson(Map<String, dynamic> json) {
    return ReferralInfoResponse(
      accountSequence: json['accountSequence']?.toString() ?? '',
      personalPlantingCount: json['personalPlantingCount'] ?? 0,
      teamPlantingCount: json['teamPlantingCount'] ?? 0,
      directReferralCount: json['directReferralCount'] ?? 0,
    );
  }
}

/// 引荐成员信息
class DirectReferralInfo {
  final String accountSequence;
  final int personalPlantingCount;
  final int teamPlantingCount;
  final int directReferralCount;

  DirectReferralInfo({
    required this.accountSequence,
    required this.personalPlantingCount,
    required this.teamPlantingCount,
    required this.directReferralCount,
  });

  factory DirectReferralInfo.fromJson(Map<String, dynamic> json) {
    return DirectReferralInfo(
      accountSequence: json['accountSequence']?.toString() ?? '',
      personalPlantingCount: json['personalPlantingCount'] ?? 0,
      teamPlantingCount: json['teamPlantingCount'] ?? 0,
      directReferralCount: json['directReferralCount'] ?? 0,
    );
  }
}

/// 引荐列表响应
class DirectReferralsResponse {
  final List<DirectReferralInfo> referrals;
  final int total;
  final bool hasMore;

  DirectReferralsResponse({
    required this.referrals,
    required this.total,
    required this.hasMore,
  });

  factory DirectReferralsResponse.fromJson(Map<String, dynamic> json) {
    return DirectReferralsResponse(
      referrals: (json['referrals'] as List? ?? [])
          .map((e) => DirectReferralInfo.fromJson(e))
          .toList(),
      total: json['total'] ?? 0,
      hasMore: json['hasMore'] ?? false,
    );
  }
}
