import '../../domain/entities/contribution.dart';

class ContributionModel extends Contribution {
  const ContributionModel({
    required super.accountSequence,
    required super.personalContribution,
    required super.systemContribution,
    required super.teamLevelContribution,
    required super.teamBonusContribution,
    required super.totalContribution,
    required super.effectiveContribution,
    required super.hasAdopted,
    required super.directReferralAdoptedCount,
    required super.unlockedLevelDepth,
    required super.unlockedBonusTiers,
  });

  factory ContributionModel.fromJson(Map<String, dynamic> json) {
    return ContributionModel(
      accountSequence: json['accountSequence']?.toString() ?? '',
      personalContribution: json['personalContribution']?.toString() ?? '0',
      systemContribution: json['systemContribution']?.toString() ?? '0',
      teamLevelContribution: json['teamLevelContribution']?.toString() ?? '0',
      teamBonusContribution: json['teamBonusContribution']?.toString() ?? '0',
      totalContribution: json['totalContribution']?.toString() ?? '0',
      effectiveContribution: json['effectiveContribution']?.toString() ?? '0',
      hasAdopted: json['hasAdopted'] == true,
      directReferralAdoptedCount: json['directReferralAdoptedCount'] ?? 0,
      unlockedLevelDepth: json['unlockedLevelDepth'] ?? 0,
      unlockedBonusTiers: json['unlockedBonusTiers'] ?? 0,
    );
  }
}
