import 'package:equatable/equatable.dart';

/// Domain entity representing coverage statistics.
///
/// Aggregates coverage metrics for a specific date.
class CoverageStats extends Equatable {
  /// Creates a [CoverageStats].
  const CoverageStats({
    required this.totalNeeded,
    required this.totalConfirmed,
    required this.checkedIn,
    required this.enRoute,
    required this.late,
  });

  /// The total number of workers needed.
  final int totalNeeded;

  /// The total number of confirmed workers.
  final int totalConfirmed;

  /// The number of workers who have checked in.
  final int checkedIn;

  /// The number of workers en route.
  final int enRoute;

  /// The number of late workers.
  final int late;

  /// Calculates the overall coverage percentage.
  int get coveragePercent {
    if (totalNeeded == 0) return 0;
    return ((totalConfirmed / totalNeeded) * 100).round();
  }

  @override
  List<Object?> get props => <Object?>[
        totalNeeded,
        totalConfirmed,
        checkedIn,
        enRoute,
        late,
      ];
}
