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

namespace YBEE.EQM.Core;

/// <summary>
/// 抽样方案学生
/// </summary>
[Comment("抽样方案学生")]
public class ExamSampleStudent : IEntity
{
    /// <summary>
    /// 主键
    /// </summary>
    [Comment("主键")]
    [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public long Id { get; set; }
    /// <summary>
    /// 抽样方案ID
    /// </summary>
    [Comment("抽样方案ID")]
    [Required]
    public int ExamSampleId { get; set; }
    /// <summary>
    /// 监测样本学生ID
    /// </summary>
    [Comment("监测样本学生ID")]
    [Required]
    public long ExamStudentId { get; set; }
    /// <summary>
    /// 监测号
    /// </summary>
    [Comment("监测号")]
    [Required, StringLength(20)]
    public string ExamNumber { get; set; } = "";
    /// <summary>
    /// 序号
    /// </summary>
    [Comment("序号")]
    [Required]
    public int Sequence { get; set; } = 0;
    /// <summary>
    /// 监测抽样类型
    /// </summary>
    [Comment("监测抽样类型")]
    [Required, Column(TypeName = "smallint")]
    public ExamSampleType ExamSampleType { get; set; } = ExamSampleType.SCHOOL_EXAM;
    /// <summary>
    /// 是否为特殊学生
    /// </summary>
    [Comment("是否为特殊学生")]
    [Required]
    public bool IsSpecialStudent { get; set; } = false;
    /// <summary>
    /// 前期总成绩
    /// </summary>
    [Comment("前期总成绩")]
    [Required, Column(TypeName = "decimal(10, 2)")]
    public decimal PreTotalScore { get; set; } = 0;

    /// <summary>
    /// 一对一引用（监测学生）
    /// </summary>
    public virtual ExamStudent ExamStudent { get; set; }
    /// <summary>
    /// 一对一引用（监测抽样）
    /// </summary>
    public virtual ExamSample ExamSample { get; set; }
}
