using System; using System.Collections.Generic; using Demo.Data.LocalData.Entity; using Demo.Data.Repository; namespace Demo.Domain.UseCase { public class AttendanceUseCase { private readonly AttendanceRepositoryImpl _attendanceRepository; public AttendanceUseCase(AttendanceRepositoryImpl attendanceRepository) { _attendanceRepository = attendanceRepository ?? throw new ArgumentNullException(nameof(attendanceRepository)); } public List GetAllAttendances() { return _attendanceRepository.GetAllAttendances() ?? new List(); } public void AddAttendance(Attendance attendance) { if (attendance == null) throw new ArgumentNullException(nameof(attendance)); _attendanceRepository.AddAttendance(attendance); } public bool UpdateAttendance(Attendance attendance) { if (attendance == null) throw new ArgumentNullException(nameof(attendance)); return _attendanceRepository.UpdateAttendance(attendance); } public bool RemoveAttendance(Guid userGuid, DateOnly date) { return _attendanceRepository.RemoveAttendance(userGuid, date); } public List GetAttendancesByGroupAndDate(int groupId, DateOnly date) { return _attendanceRepository.GetAttendancesByGroupAndDate(groupId, date); } public List GetAttendancesByGroupAndDateRange(int groupId, DateOnly startDate, DateOnly endDate) { return _attendanceRepository.GetAttendancesByGroupAndDateRange(groupId, startDate, endDate); } } }