using Jiaowu.Api.Domain.Common;

namespace Jiaowu.Api.Domain.Academic;

public sealed class GraduationAuditBatch : EntityBase
{
    public required string Name { get; set; }
    public int GraduationYear { get; set; }
    public int EnrollmentYear { get; set; }
    public GraduationAuditBatchStatus Status { get; set; } =
        GraduationAuditBatchStatus.Draft;
    public string? Notes { get; set; }
    public DateTime? CalculatedAt { get; set; }
    public DateTime? PublishedAt { get; set; }
    public ICollection<GraduationAuditResult> Results { get; set; } = [];
}

public sealed class GraduationAuditResult : EntityBase
{
    public Guid GraduationAuditBatchId { get; set; }
    public GraduationAuditBatch? GraduationAuditBatch { get; set; }
    public Guid StudentId { get; set; }
    public Student? Student { get; set; }
    public Guid? CurriculumPlanId { get; set; }
    public CurriculumPlan? CurriculumPlan { get; set; }
    public StudentStatus StudentStatusSnapshot { get; set; }
    public decimal RequiredCredits { get; set; }
    public decimal EarnedCredits { get; set; }
    public int RequiredCourseCount { get; set; }
    public int PassedRequiredCourseCount { get; set; }
    public int FailedCourseCount { get; set; }
    public required string MissingCourseNames { get; set; }
    public GraduationAuditConclusion CalculatedConclusion { get; set; }
    public GraduationAuditConclusion Conclusion { get; set; }
    public bool IsOverridden { get; set; }
    public string? ReviewComment { get; set; }
    public DateTime? ReviewedAt { get; set; }
}

public enum GraduationAuditBatchStatus
{
    Draft = 1,
    Published = 2
}

public enum GraduationAuditConclusion
{
    Ineligible = 1,
    Eligible = 2
}
