using Jiaowu.Api.Domain.Common;

namespace Jiaowu.Api.Domain.Academic;

public sealed class GraduationClearanceBatch : EntityBase
{
    public required string Name { get; set; }
    public int GraduationYear { get; set; }
    public GraduationClearanceBatchStatus Status { get; set; } =
        GraduationClearanceBatchStatus.Open;
    public string? Notes { get; set; }
    public DateTime? ClosedAt { get; set; }
    public ICollection<GraduationClearanceItem> Items { get; set; } = [];
}

public sealed class GraduationClearanceItem : EntityBase
{
    public Guid GraduationClearanceBatchId { get; set; }
    public GraduationClearanceBatch? GraduationClearanceBatch { get; set; }
    public required string Code { get; set; }
    public required string Name { get; set; }
    public required string ResponsibleUnit { get; set; }
    public required string ResponsibleRole { get; set; }
    public bool IsRequired { get; set; } = true;
    public int SortOrder { get; set; }
    public ICollection<GraduationClearanceRecord> Records { get; set; } = [];
}

public sealed class GraduationClearanceRecord : EntityBase
{
    public Guid GraduationClearanceItemId { get; set; }
    public GraduationClearanceItem? GraduationClearanceItem { get; set; }
    public Guid StudentId { get; set; }
    public Student? Student { get; set; }
    public GraduationClearanceRecordStatus Status { get; set; } =
        GraduationClearanceRecordStatus.Pending;
    public string? Notes { get; set; }
    public DateTime? CompletedAt { get; set; }
    public Guid? CompletedByUserId { get; set; }
}

public enum GraduationClearanceBatchStatus
{
    Open = 1,
    Closed = 2
}

public enum GraduationClearanceRecordStatus
{
    Pending = 1,
    Completed = 2,
    Waived = 3
}
