using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using YGNT.QuestionLibrary.Core.BaseData;
using YGNT.QuestionLibrary.Core.Chapters;
using YGNT.QuestionLibrary.Core.Disciplines;
using YGNT.QuestionLibrary.Core.Models;

namespace YGNT.QuestionLibrary.Core.Questions
{
    /// <summary>
    /// 试题
    /// </summary>
    public class Question : Entity<long>, IFullAudited, IPassivable
    {
        public Question()
        {
            QuestionKnowledgePoints = new List<QuestionKnowledgePoint>();
        }

        /// <summary>
        /// 试题简称
        /// </summary>
        [Required]
        public string ShortName { get; set; }

        /// <summary>
        /// 题型Id
        /// </summary>
        [Required]
        public int QuestionTypeId { get; set; }

        /// <summary>
        /// 学科细分题型Id
        /// </summary>
        [Required]
        public int DisciplineQuestionTypeId { get; set; }

        /// <summary>
        /// 所属学科id
        /// </summary>
        [Required]
        public int DisciplineId { get; set; }

        /// <summary>
        /// 出题年份
        /// </summary>
        public DateTime? AriseTime { get; set; }

        /// <summary>
        /// 考点
        /// </summary>
        public string CheckPoints { get; set; }

        /// <summary>
        /// 章节id
        /// </summary>
        public long? ChapterId { get; set; }

        /// <summary>
        /// 试题真实id
        /// </summary>
        [Required]
        public long QuestionOriginId { get; set; }

        /// <summary>
        /// 难度
        /// </summary>
        [Required]
        public Difficulty Difficulty { get; set; }

        /// <summary>
        /// 学科细分题型
        /// </summary>
        [ForeignKey(nameof(DisciplineQuestionTypeId))]
        public DisciplineQuestionType DisciplineQuestionType { get; set; }

        /// <summary>
        /// 章节
        /// </summary>
        [ForeignKey(nameof(ChapterId))]
        public Chapter Chapter { get; set; }

        /// <summary>
        /// 试题包含知识点
        /// </summary>
        public List<QuestionKnowledgePoint> QuestionKnowledgePoints { get; set; }

        /// <summary>
        /// 题型
        /// </summary>
        [ForeignKey(nameof(QuestionTypeId))]
        [Required]
        public QuestionType QuestionType { get; set; }

        /// <summary>
        /// 所属学科
        /// </summary>
        [ForeignKey(nameof(DisciplineId))]
        public Discipline Discipline { get; set; }

        /// <summary>
        /// 真实试题
        /// </summary>
        public QuestionOrigin QuestionOrigin { get; set; }

        /// <summary>
        /// 是否正在转换中
        /// </summary>
        //public bool IsConverting { get; set; }

        public DateTime CreationTime { get; set; }


        public long? CreatorUserId { get; set; }


        public DateTime? LastModificationTime { get; set; }


        public long? LastModifierUserId { get; set; }


        public bool IsDeleted { get; set; }


        public DateTime? DeletionTime { get; set; }


        public long? DeleterUserId { get; set; }

        /// <summary>
        /// 是否激活
        /// </summary>
        public bool IsActive { get; set; }
    }
}