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

namespace YBEE.EQM.Core;

/// <summary>
/// 试卷小题
/// </summary>
[Comment("试卷小题")]
public class ExamPaperQuestionMinor : DEntityBase
{
    /// <summary>
    /// 双向细目表头ID
    /// </summary>
    [Comment("双向细目表头ID")]
    [Required]
    public int ExamPaperId { get; set; }
    /// <summary>
    /// 题型类别
    /// </summary>
    [Comment("题型类别")]
    [Column(TypeName = "smallint")]
    public QuestionCatalog? QuestionCatalog { get; set; }
    /// <summary>
    /// 大题ID
    /// </summary>
    [Comment("大题ID")]
    public int? ExamPaperQuestionMajorId { get; set; }
    /// <summary>
    /// 成绩文件列名
    /// </summary>
    [Comment("成绩文件列名")]
    [Required, StringLength(100)]
    public string ColumnName { get; set; }
    /// <summary>
    /// 小题名称
    /// </summary>
    [Comment("小题名称")]
    [Required, StringLength(100)]
    public string Name { get; set; }
    /// <summary>
    /// 顺序
    /// </summary>
    [Comment("顺序")]
    public int Sequence { get; set; } = 0;
    /// <summary>
    /// 分值
    /// </summary>
    [Comment("分值")]
    [Required, Column(TypeName = "decimal(10, 2)")]
    public decimal Score { get; set; } = 0;
    /// <summary>
    /// 知识模块
    /// </summary>
    [Comment("知识模块")]
    [StringLength(200)]
    public string KnowledgeModule { get; set; }
    /// <summary>
    /// 知识点
    /// </summary>
    [Comment("知识点")]
    [StringLength(200)]
    public string KnowledgePoint { get; set; }
    /// <summary>
    /// 认知能力
    /// </summary>
    [Comment("认知能力")]
    [Column(TypeName = "smallint")]
    public CognitiveAbility? CognitiveAbility { get; set; }
    /// <summary>
    /// 预估难度
    /// </summary>
    [Comment("预估难度")]
    [Required, Column(TypeName = "decimal(10, 2)")]
    public decimal EstimatedDifficulty { get; set; } = 0;
    /// <summary>
    /// 是否选做
    /// </summary>
    [Comment("是否选做")]
    [Required]
    public bool IsChoose { get; set; } = false;

    /// <summary>
    /// 是否最小计分项
    /// </summary>
    [Comment("是否最小计分项")]
    [Required]
    public bool IsLeaf { get; set; } = true;


    /// <summary>                     
    /// 一对一引用（试卷）
    /// </summary>
    public virtual ExamPaper ExamPaper { get; set; }
    /// <summary>
    /// 一对一引用（试卷大题）
    /// </summary>
    public virtual ExamPaperQuestionMajor ExamPaperQuestionMajor { get; set; }

}
