using Furion.JsonSerialization;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace YBEE.EQM.Core;

/// <summary>
/// 监测科目
/// </summary>
[Comment("监测科目")]
public class ExamCourse : DEntityBase
{
    /// <summary>
    /// 监测计划ID
    /// </summary>
    [Comment("监测计划ID")]
    [Required]
    public int ExamPlanId { get; set; }
    /// <summary>
    /// 监测年级ID
    /// </summary>
    [Comment("监测年级ID")]
    [Required]
    public int ExamGradeId { get; set; }
    /// <summary>
    /// 年级ID
    /// </summary>
    [Comment("年级ID")]
    [Required]
    public short GradeId { get; set; }
    /// <summary>
    /// 科目ID
    /// </summary>
    [Comment("科目ID")]
    [Required]
    public short CourseId { get; set; }

    /// <summary>
    /// 总分
    /// </summary>
    [Comment("总分")]
    [Required]
    public decimal TotalScore { get; set; } = 100;

    /// <summary>
    /// 分数分段类型
    /// </summary>
    public ExamScoreRangeType ExamScoreRangeType { get; set; } = ExamScoreRangeType.EXAM_100;

    /// <summary>
    /// 成绩上报模板配置信息
    /// </summary>
    [Comment("模板配置信息")]
    [Required, Column(TypeName = "json")]
    public string ScoreReportConfig { get; set; } = JSON.Serialize(new ExamCourseScoreReportConfig());


    /// <summary>
    /// 一对一引用（监测年级）
    /// </summary>
    public virtual ExamGrade ExamGrade { get; set; }
    /// <summary>
    /// 一对一引用（科目）
    /// </summary>
    public virtual Course Course { get; set; }
}
