using Jiaowu.Api.Domain.Common;

namespace Jiaowu.Api.Domain.Academic;

public sealed class CurriculumPlan : EntityBase
{
    public Guid MajorId { get; set; }
    public Major? Major { get; set; }
    public required string Name { get; set; }
    public required string Version { get; set; }
    public int EffectiveGrade { get; set; }
    public decimal TotalCredits { get; set; }
    public CurriculumPlanStatus Status { get; set; } = CurriculumPlanStatus.Draft;
    public string? Description { get; set; }
    public DateTime? PublishedAt { get; set; }
    public ICollection<CurriculumModule> Modules { get; set; } = [];
}

public sealed class CurriculumModule : EntityBase
{
    public Guid CurriculumPlanId { get; set; }
    public CurriculumPlan? CurriculumPlan { get; set; }
    public required string Code { get; set; }
    public required string Name { get; set; }
    public decimal RequiredCredits { get; set; }
    public int SortOrder { get; set; }
    public ICollection<CurriculumCourse> Courses { get; set; } = [];
}

public sealed class CurriculumCourse : EntityBase
{
    public Guid CurriculumModuleId { get; set; }
    public CurriculumModule? CurriculumModule { get; set; }
    public Guid CourseId { get; set; }
    public Course? Course { get; set; }
    public int RecommendedSemester { get; set; }
    public CurriculumCourseType Type { get; set; }
    public string? Notes { get; set; }
}

public sealed class CourseGroup : EntityBase
{
    public required string Code { get; set; }
    public required string Name { get; set; }
    public string? Description { get; set; }
    public ICollection<CourseGroupCourse> Courses { get; set; } = [];
}

public sealed class CourseGroupCourse : EntityBase
{
    public Guid CourseGroupId { get; set; }
    public CourseGroup? CourseGroup { get; set; }
    public Guid CourseId { get; set; }
    public Course? Course { get; set; }
}

public enum CurriculumPlanStatus
{
    Draft = 1,
    Published = 2,
    Archived = 3
}

public enum CurriculumCourseType
{
    Required = 1,
    Elective = 2
}
