import 'package:krow_core/core.dart';
import '../arguments/get_coverage_stats_arguments.dart';
import '../repositories/coverage_repository.dart';
import '../ui_entities/coverage_entities.dart';

/// Use case for fetching coverage statistics for a specific date.
///
/// This use case encapsulates the logic for retrieving coverage metrics including
/// total workers needed, confirmed, checked in, en route, and late.
/// It delegates the data retrieval to the [CoverageRepository].
///
/// Follows the KROW Clean Architecture pattern by:
/// - Extending from [UseCase] base class
/// - Using [GetCoverageStatsArguments] for input
/// - Returning domain entities ([CoverageStats])
/// - Delegating to repository abstraction
class GetCoverageStatsUseCase
    implements UseCase<GetCoverageStatsArguments, CoverageStats> {
  /// Creates a [GetCoverageStatsUseCase].
  GetCoverageStatsUseCase(this._repository);

  final CoverageRepository _repository;

  @override
  Future<CoverageStats> call(GetCoverageStatsArguments arguments) {
    return _repository.getCoverageStats(date: arguments.date);
  }
}
