using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using YGNT.QuestionLibrary.Core.BaseData.Enum;
using YGNT.QuestionLibrary.Core.Models;
using YGNT.QuestionLibrary.Core.Tasks.Enum;

namespace YGNT.QuestionLibrary.Core.Questions
{
    /// <summary>
    /// 试题原数据
    /// </summary>
    public class QuestionOrigin : Entity<long>, IHasCreationTime, IModificationAudited
    {
        private DateTime? _lastModificationTime;

        public QuestionOrigin()
        {
            QuestionCategory = QuestionCategory.非客观题;
            Difficulty = Difficulty.容易;
        }

        /// <summary>
        /// 题型名称
        /// </summary>
        [Required]
        public string QuestionTypeName { get; set; }

        public QuestionCategory QuestionCategory { get; set; }

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

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

        /// <summary>
        /// 试题html
        /// </summary>
        public string Html { get; set; }

        /// <summary>
        /// 答案html
        /// </summary>
        public string Answer { get; set; }

        /// <summary>
        /// 解析html
        /// </summary>
        public string Analysis { get; set; }

        /// <summary>
        /// 是否已被修改
        /// </summary>
        public bool IsModified { get; set; }

        /// <summary>
        /// 试题转换状态
        /// </summary>
        public QuestionConvertState QuestionConvertState { get; set; }

        /// <summary>
        /// 试题结构
        /// </summary>
        public List<Resolve> Resolves { get; set; }

        /// <summary>
        /// 试题存储路径
        /// </summary>
        //public bool Path { get; set; }

        public DateTime CreationTime { get; set; }

        public DateTime? LastModificationTime
        {
            get => _lastModificationTime;
            set
            {
                IsModified = true;
                _lastModificationTime = value;
            }
        }

        public long? LastModifierUserId { get; set; }
    }
}