using Core.Entities;

namespace Core.Calculation;

/// <summary>
/// Represents a single time slot in the team meeting schedule.
/// </summary>
public class TeamScheduleTimeSlot
{
    /// <summary>
    /// Gets or sets the name of this time slot.
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// Gets or sets the teams scheduled in this time slot.
    /// </summary>
    public Team[] Teams;

    /// <summary>
    /// Gets or sets the students who are not scheduled in any team during this time slot.
    /// </summary>
    public Student[] UnscheduledStudents;

    /// <summary>
    /// Gets or sets the students who have overlapping team meetings in this time slot.
    /// </summary>
    public IEnumerable<(Student student, IEnumerable<Team> teams)> StudentOverlaps;

    /// <summary>
    /// Checks if a student has overlapping team meetings in this time slot.
    /// </summary>
    /// <param name="student">The student to check</param>
    /// <returns>True if the student has overlaps, otherwise false</returns>
    public bool StudentHasOverlaps(Student student)
    {
        return StudentOverlaps.Any(o => o.student.Equals(student));
    }
}