namespace Domain.Ports.Repositories; using Domain.Entities; using Domain.ReadModels; /// /// Repository interface for enrollment persistence operations. /// public interface IEnrollmentRepository { /// /// Gets an enrollment by its unique identifier. /// Task GetByIdAsync(int id, CancellationToken ct = default); /// /// Gets an enrollment by student and subject combination. /// Task GetByStudentAndSubjectAsync(int studentId, int subjectId, CancellationToken ct = default); /// /// Gets all enrollments for a specific student with related entities. /// Task> GetByStudentIdAsync(int studentId, CancellationToken ct = default); /// /// Gets all enrollments for a specific subject with related entities. /// Task> GetBySubjectIdAsync(int subjectId, CancellationToken ct = default); /// /// Gets classmates (other students) enrolled in the same subject. /// Task> GetClassmatesAsync(int studentId, int subjectId, CancellationToken ct = default); /// /// Batch query to get classmates for multiple subjects in a single database call. /// Eliminates N+1 query problem when loading classmates for all enrolled subjects. /// Task>> GetClassmatesBatchAsync( int studentId, IEnumerable subjectIds, CancellationToken ct = default); /// /// Adds a new enrollment to the context. /// void Add(Enrollment enrollment); /// /// Removes an enrollment from the context. /// void Delete(Enrollment enrollment); }