import 'package:krow_domain/krow_domain.dart';

/// Repository interface for Clock In/Out functionality
abstract class ClockInRepository {
  
  /// Retrieves the shift assigned to the user for the current day.
  /// Returns null if no shift is assigned for today.
  Future<Shift?> getTodaysShift();

  /// Gets the current attendance status (e.g., checked in or not, times).
  /// This helps in restoring the UI state if the app was killed.
  Future<AttendanceStatus> getAttendanceStatus();

  /// Checks the user in for the specified [shiftId].
  /// Returns the updated [AttendanceStatus].
  Future<AttendanceStatus> clockIn({required String shiftId, String? notes});

  /// Checks the user out for the currently active shift.
  /// Optionally accepts [breakTimeMinutes] if tracked.
  Future<AttendanceStatus> clockOut({String? notes, int? breakTimeMinutes});

  /// Retrieves a list of recent clock-in/out activities.
  Future<List<Map<String, dynamic>>> getActivityLog();
}

/// Simple entity to hold attendance state
class AttendanceStatus {
  final bool isCheckedIn;
  final DateTime? checkInTime;
  final DateTime? checkOutTime;
  final String? activeShiftId;

  const AttendanceStatus({
    this.isCheckedIn = false,
    this.checkInTime,
    this.checkOutTime,
    this.activeShiftId,
  });
}
