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

namespace YBEE.EQM.Core;

/// <summary>
/// 高中分析计划
/// </summary>
public class NceePlan : DEntityBase
{
    /// <summary>
    /// 序，同一学期同年级从1开始计数
    /// </summary>
    [Comment("序，同一学期同年级从1开始计数")]
    [Required]
    public short Sequence { get; set; } = 1;

    /// <summary>
    /// 学期ID
    /// </summary>
    [Comment("学期ID")]
    [Required]
    public short SemesterId { get; set; }
    /// <summary>
    /// 年级ID
    /// </summary>
    [Comment("年级ID")]
    [Required]
    public short GradeId { get; set; }

    /// <summary>
    /// 名称
    /// </summary>
    [Comment("名称")]
    [Required, StringLength(100)]
    public string Name { get; set; }
    /// <summary>
    /// 全称
    /// </summary>
    [Comment("全称")]
    [Required, StringLength(200)]
    public string FullName { get; set; }
    /// <summary>
    /// 简称
    /// </summary>
    [Comment("简称")]
    [Required, StringLength(50)]
    public string ShortName { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [Comment("备注")]
    [StringLength(200)]
    public string Remark { get; set; } = "";
    /// <summary>
    /// 配置
    /// </summary>
    [Comment("配置")]
    [Required, Column(TypeName = "json")]
    public string Config { get; set; } = JSON.Serialize(new NceePlanConfig());

    /// <summary>
    /// 状态
    /// </summary>
    [Comment("状态")]
    [Required]
    public ExamStatus Status { get; set; } = ExamStatus.READY;

    /// <summary>
    /// 开始时间
    /// </summary>
    [Comment("开始时间")]
    public DateTime? BeginTime { get; set; }
    /// <summary>
    /// 结束时间
    /// </summary>
    [Comment("结束时间")]
    public DateTime? EndTime { get; set; }



    /// <summary>
    /// 一对一引用（学期）
    /// </summary>
    public virtual Semester Semester { get; set; }
    /// <summary>
    /// 一对一引用（年级）
    /// </summary>
    public virtual Grade Grade { get; set; }

    /// <summary>
    /// 一对多引用（划线参考）
    /// </summary>
    public ICollection<NceeBaseLine> NceePlans { get; } = new List<NceeBaseLine>();
}
