using Hotline.Orders;
using Hotline.Share.Dtos.File;
using Hotline.Share.Enums.Article;
using Hotline.Users;
using SqlSugar;
using XF.Domain.Repository;

namespace Hotline.Article
{
    /// <summary>
    /// 通知
    /// </summary>
    public class Circular: CreationEntity
    {
        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        [SugarColumn(ColumnDataType = "varchar(8000)")]
        public string Content { get; set; }

        /// <summary>
        /// 通知类型
        /// </summary>
        public string CircularTypeId { get; set; }

        /// <summary>
        /// 通知类型名称
        /// </summary>
        public string CircularTypeName { get; set; }

        /// <summary>
        /// 是否必读
        /// </summary>
        public bool IsMustRead { get; set; }

        /// <summary>
        /// 通知对象
        /// </summary>
        public ECircularType CircularType { get; set; }

        /// <summary>
        /// 通知时间
        /// </summary>
        public DateTime? CircularTime { get; set; }

        /// <summary>
        /// 失效时间
        /// </summary>
        public DateTime? LostEfficacyTime { get; set; }

        /// <summary>
        /// 通知状态
        /// </summary>
        public ECircularState CircularState { get; set; }
        /// <summary>
        /// 来源单位ID
        /// </summary>
        public string SourceOrgId { get; set; }

        /// <summary>
        /// 来源单位名称
        /// </summary>
        public string SourceOrgName { get; set; }

        /// <summary>
        /// 需要阅读数量
        /// </summary>
        public int NeedReadNum { get; set; }

        /// <summary>
        /// 已读数量
        /// </summary>
        public int ReadedNum { get; set; }

        /// <summary>
        /// 阅读明细
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(CircularReadGroup.CircularId))]
        public List<CircularReadGroup> CircularReadGroups { get; set; }

        /// <summary>
        /// 提交时间
        /// </summary>
        public DateTime? CommitTime { get; set; }

        /// <summary>
        /// 审核意见
        /// </summary>
        public string? ExaminOpinion { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        public string? ExaminManId { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(ExaminManId))]
        public User? ExaminMan { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? ExaminTime { get; set; }

        /// <summary>
        /// 附件
        /// </summary>
        [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true)]
        public List<FileJson>? FileJson { get; set; }
    }
}
