class ReputationEntity {
  final int total;
  final double average;
  final int totalPro;
  final double averagePro;

  const ReputationEntity({
    required this.total,
    required this.average,
    required this.totalPro,
    required this.averagePro,
  });

  static ReputationEntity fromDocument(Map<String, dynamic> doc) {
    final total = doc['total'] ?? 0;
    final totalPro = doc['total_pro'] ?? 0;
    final average = doc['average'] ?? 0.0;
    final averagePro = doc['average_pro'] ?? 0.0;

    return ReputationEntity(
      total: int.parse(total.toString()),
      average: double.parse(average.toString()),
      totalPro: int.parse(totalPro.toString()),
      averagePro: double.parse(averagePro.toString()),
    );
  }

  Map<String, dynamic> toDocument() {
    return {
      'total': total,
      'average': average,
      'total_pro': totalPro,
      'average_pro': averagePro,
    };
  }
}
