import 'package:krow_domain/krow_domain.dart';
import 'package:staff_home/src/domain/repositories/home_repository.dart';

/// Use case for fetching all shifts displayed on the home screen.
///
/// This use case aggregates shift data from multiple time periods
/// (today, tomorrow, and recommended) into a single response.
class GetHomeShifts {
  final HomeRepository repository;

  GetHomeShifts(this.repository);

  /// Executes the use case to fetch all home screen shift data.
  ///
  /// Returns a [HomeShifts] object containing today's shifts,
  /// tomorrow's shifts, and recommended shifts.
  Future<HomeShifts> call() async {
    final today = await repository.getTodayShifts();
    final tomorrow = await repository.getTomorrowShifts();
    final recommended = await repository.getRecommendedShifts();
    return HomeShifts(
      today: today,
      tomorrow: tomorrow,
      recommended: recommended,
    );
  }
}

/// Data transfer object containing all shifts for the home screen.
///
/// Groups shifts by time period for easy presentation layer consumption.
class HomeShifts {
  final List<Shift> today;
  final List<Shift> tomorrow;
  final List<Shift> recommended;

  HomeShifts({
    required this.today,
    required this.tomorrow,
    required this.recommended,
  });
}
