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

namespace YBEE.EQM.Core;

/// <summary>
/// 试卷
/// </summary>
[Comment("试卷")]
public class ExamPaper : 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 int ExamCourseId { get; set; }
    /// <summary>
    /// 科目ID
    /// </summary>
    [Comment("科目ID")]
    [Required]
    public short CourseId { get; set; }
    /// <summary>
    /// 名称
    /// </summary>
    [Comment("名称")]
    [Required]
    public string Name { get; set; }
    /// <summary>
    /// 总分
    /// </summary>
    [Comment("总分")]
    [Required, Column(TypeName = "decimal(10, 2)")]
    public decimal Score { get; set; } = 0;
    /// <summary>
    /// 备注
    /// </summary>
    [Comment("备注")]
    [StringLength(200)]
    public string Remark { get; set; } = "";

    /// <summary>
    /// 问题
    /// </summary>
    [Comment("问题")]
    [StringLength(4000)]
    public string Questions { get; set; } = "";
    /// <summary>
    /// 建议
    /// </summary>
    [Comment("建议")]
    [StringLength(4000)]
    public string Suggestions { get; set; } = "";


    /// <summary>
    /// 双向细目表编制状态
    /// </summary>
    [Comment("状态")]
    [Required, Column(TypeName = "smallint")]
    public AuditStatus TwclStatus { get; set; } = AuditStatus.UNSUBMIT;
    /// <summary>
    /// 双向细目表编制审核记录
    /// </summary>
    [Comment("双向细目表编制审核记录")]
    [Required, Column(TypeName = "json")]
    public string TwclAudits { get; set; } = "[]";
    /// <summary>
    /// 双向细目表编制人用户ID
    /// </summary>
    [Comment("双向细目表编制人用户ID")]
    public int? TwclSysUserId { get; set; }


    /// <summary>
    /// 问题建议撰写状态
    /// </summary>
    [Comment("问题建议撰写状态")]
    [Required, Column(TypeName = "smallint")]
    public AuditStatus SuggestionStatus { get; set; } = AuditStatus.UNSUBMIT;
    /// <summary>
    /// 问题建议撰写审核记录
    /// </summary>
    [Comment("问题建议撰写审核记录")]
    [Required, Column(TypeName = "json")]
    public string SuggestionAudits { get; set; } = "[]";
    /// <summary>
    /// 问题建议撰写人用户ID
    /// </summary>
    [Comment("问题建议撰写人用户ID")]
    public int? SuggestionSysUserId { get; set; }



    /// <summary>
    /// 一对一引用（监测信息）
    /// </summary>
    public virtual ExamPlan ExamPlan { get; set; }
    /// <summary>
    /// 一对一引用（年级）
    /// </summary>
    public virtual Grade Grade { get; set; }
    /// <summary>
    /// 一对一引用（科目）
    /// </summary>
    public virtual Course Course { get; set; }
    /// <summary>
    /// 一对一引用（双向细目表编制人)
    /// </summary>
    public virtual SysUser TwclSysUser { get; set; }
    /// <summary>
    /// 一对一引用（问题建议撰写人）
    /// </summary>
    public virtual SysUser SuggestionSysUser { get; set; }

    /// <summary>
    /// 一对多引用（试卷小题）
    /// </summary>
    public ICollection<ExamPaperQuestionMinor> ExamPaperQuestionMinors { get; } = new List<ExamPaperQuestionMinor>();
}
