/// Internal counters used for future filtering, reporting, and scheduling hints.
///
/// These are intentionally quiet metadata. They should not become noisy UI by
/// default. This is a public starter placeholder while persistence and reporting
/// needs are still being shaped by the V1 plan.
class TaskStatistics {
  const TaskStatistics({
    this.skippedDuringBurnoutCount = 0,
    this.manuallyPushedCount = 0,
    this.autoPushedCount = 0,
    this.movedToBacklogCount = 0,
    this.restoredFromBacklogCount = 0,
    this.missedCount = 0,
    this.cancelledCount = 0,
    this.completedLateCount = 0,
    this.completedDuringLockedHoursCount = 0,
    this.completedDuringLockedHoursMinutes = 0,
  });

  final int skippedDuringBurnoutCount;
  final int manuallyPushedCount;
  final int autoPushedCount;
  final int movedToBacklogCount;
  final int restoredFromBacklogCount;
  final int missedCount;
  final int cancelledCount;
  final int completedLateCount;
  final int completedDuringLockedHoursCount;
  final int completedDuringLockedHoursMinutes;

  TaskStatistics copyWith({
    int? skippedDuringBurnoutCount,
    int? manuallyPushedCount,
    int? autoPushedCount,
    int? movedToBacklogCount,
    int? restoredFromBacklogCount,
    int? missedCount,
    int? cancelledCount,
    int? completedLateCount,
    int? completedDuringLockedHoursCount,
    int? completedDuringLockedHoursMinutes,
  }) {
    return TaskStatistics(
      skippedDuringBurnoutCount:
          skippedDuringBurnoutCount ?? this.skippedDuringBurnoutCount,
      manuallyPushedCount: manuallyPushedCount ?? this.manuallyPushedCount,
      autoPushedCount: autoPushedCount ?? this.autoPushedCount,
      movedToBacklogCount: movedToBacklogCount ?? this.movedToBacklogCount,
      restoredFromBacklogCount:
          restoredFromBacklogCount ?? this.restoredFromBacklogCount,
      missedCount: missedCount ?? this.missedCount,
      cancelledCount: cancelledCount ?? this.cancelledCount,
      completedLateCount: completedLateCount ?? this.completedLateCount,
      completedDuringLockedHoursCount: completedDuringLockedHoursCount ??
          this.completedDuringLockedHoursCount,
      completedDuringLockedHoursMinutes: completedDuringLockedHoursMinutes ??
          this.completedDuringLockedHoursMinutes,
    );
  }

  TaskStatistics incrementMovedToBacklog() {
    return copyWith(movedToBacklogCount: movedToBacklogCount + 1);
  }

  TaskStatistics incrementSkippedDuringBurnout() {
    return copyWith(skippedDuringBurnoutCount: skippedDuringBurnoutCount + 1);
  }

  TaskStatistics incrementManualPush() {
    return copyWith(manuallyPushedCount: manuallyPushedCount + 1);
  }

  TaskStatistics incrementAutoPush() {
    return copyWith(autoPushedCount: autoPushedCount + 1);
  }

  TaskStatistics incrementRestoredFromBacklog() {
    return copyWith(restoredFromBacklogCount: restoredFromBacklogCount + 1);
  }

  TaskStatistics incrementMissed() {
    return copyWith(missedCount: missedCount + 1);
  }

  TaskStatistics incrementCancelled() {
    return copyWith(cancelledCount: cancelledCount + 1);
  }

  TaskStatistics incrementCompletedLate() {
    return copyWith(completedLateCount: completedLateCount + 1);
  }

  TaskStatistics incrementCompletedDuringLockedHours(int minutes) {
    return copyWith(
      completedDuringLockedHoursCount: completedDuringLockedHoursCount + 1,
      completedDuringLockedHoursMinutes:
          completedDuringLockedHoursMinutes + minutes,
    );
  }
}
