class PieChartData {
  final int victories;
  final int defeats;
  final int draws;

  const PieChartData({
    required this.victories,
    required this.defeats,
    this.draws = 0,
  });

  int get total => victories + defeats + draws;
  
  double get victoryPercentage => total > 0 ? victories / total : 0;
  double get defeatPercentage => total > 0 ? defeats / total : 0;
  double get drawPercentage => total > 0 ? draws / total : 0;

  Map<String, dynamic> toJson() => {
    'victories': victories,
    'defeats': defeats,
    'draws': draws,
    'total': total,
    'victoryPercentage': victoryPercentage,
    'defeatPercentage': defeatPercentage,
    'drawPercentage': drawPercentage,
  };
}