using Jiaowu.Api.Domain.Common;

namespace Jiaowu.Api.Domain.Academic;

public sealed class CourseAdjustment : EntityBase
{
    public Guid TeachingTaskId { get; set; }
    public TeachingTask? TeachingTask { get; set; }
    public CourseAdjustmentType Type { get; set; }
    public CourseAdjustmentStatus Status { get; set; } = CourseAdjustmentStatus.Draft;
    public Guid ApplicantUserId { get; set; }

    // The concrete published timetable occurrence being adjusted.
    public Guid? SourceScheduleEntryId { get; set; }
    public int? SourceWeek { get; set; }
    public DateOnly? SourceDate { get; set; }
    public int? SourceStartPeriod { get; set; }
    public int? SourcePeriodCount { get; set; }
    public Guid? SourceClassroomId { get; set; }

    // Target occurrence for Reschedule / Makeup
    public DateOnly? TargetDate { get; set; }
    public int? DayOfWeek { get; set; }
    public int? StartPeriod { get; set; }
    public int? PeriodCount { get; set; }
    public Guid? ClassroomId { get; set; }
    public Classroom? Classroom { get; set; }

    // For Substitute
    public Guid? SubstituteTeacherId { get; set; }
    public Teacher? SubstituteTeacher { get; set; }

    // For Cancel
    public int? CancelWeek { get; set; }
    public DateOnly? CancelDate { get; set; }

    public string Reason { get; set; } = "";
    public string? ReviewComment { get; set; }
    public DateTime? SubmittedAt { get; set; }
    public DateTime? ReviewedAt { get; set; }
    public Guid? ReviewedByUserId { get; set; }
}

public enum CourseAdjustmentType
{
    Reschedule = 1,
    Cancel = 2,
    Makeup = 3,
    Substitute = 4
}

public enum CourseAdjustmentStatus
{
    Draft = 1,
    Submitted = 2,
    Approved = 3,
    Rejected = 4
}
