import '../../entities/shifts/shift.dart';
import '../../entities/clock_in/attendance_status.dart';

/// Adapter for Clock In related data.
class ClockInAdapter {
  
  /// Converts primitive attendance data to [AttendanceStatus].
  static AttendanceStatus toAttendanceStatus({
    required String status,
    DateTime? checkInTime,
    DateTime? checkOutTime,
    String? activeShiftId,
    String? activeApplicationId,
  }) {
    final bool isCheckedIn = status == 'CHECKED_IN' || status == 'LATE'; // Assuming LATE is also checked in?
    
    // Statuses that imply active attendance: CHECKED_IN, LATE.
    // Statuses that imply completed: CHECKED_OUT.
    
    return AttendanceStatus(
      isCheckedIn: isCheckedIn,
      checkInTime: checkInTime,
      checkOutTime: checkOutTime,
      activeShiftId: activeShiftId,
      activeApplicationId: activeApplicationId,
    );
  }
}
