/// IDO 团队总览（对齐 Web `StakingTeamOverview`）
class StakingTeamOverview {
  final int directNum;
  final int teamNum;
  final num teamPerformance;
  final num totalRevenue;
  final num lockTotal;
  final String nodeLevel;

  const StakingTeamOverview({
    this.directNum = 0,
    this.teamNum = 0,
    this.teamPerformance = 0,
    this.totalRevenue = 0,
    this.lockTotal = 0,
    this.nodeLevel = 'NORMAL',
  });

  factory StakingTeamOverview.fromJson(Map<String, dynamic> json) {
    num parseNum(dynamic v) {
      final n = num.tryParse('$v');
      return n ?? 0;
    }

    return StakingTeamOverview(
      directNum: int.tryParse('${json['directNum'] ?? 0}') ?? 0,
      teamNum: int.tryParse('${json['teamNum'] ?? 0}') ?? 0,
      teamPerformance: parseNum(json['teamPerformance']),
      totalRevenue: parseNum(json['totalRevenue']),
      lockTotal: parseNum(json['lockTotal']),
      nodeLevel: '${json['nodeLevel'] ?? 'NORMAL'}',
    );
  }
}

/// 直推成员（对齐 Web `StakingDirectMember`）
class StakingDirectMember {
  final String directAddress;
  final String level;
  final num buyAmount;
  final num reward;

  const StakingDirectMember({
    this.directAddress = '',
    this.level = '',
    this.buyAmount = 0,
    this.reward = 0,
  });

  factory StakingDirectMember.fromJson(Map<String, dynamic> json) {
    num parseNum(dynamic v) {
      final n = num.tryParse('$v');
      return n ?? 0;
    }

    return StakingDirectMember(
      directAddress: '${json['directAddress'] ?? ''}',
      level: '${json['level'] ?? ''}',
      buyAmount: parseNum(json['buyAmount']),
      reward: parseNum(json['reward']),
    );
  }
}

class StakingDirectListPage {
  final List<StakingDirectMember> content;
  final int totalPages;
  final int pageNo;
  final bool hasMore;

  const StakingDirectListPage({
    required this.content,
    required this.totalPages,
    required this.pageNo,
    required this.hasMore,
  });
}
