using System.Collections.Generic;
using System.Text.Json.Serialization;
using Datory;
using Datory.Annotations;
using GxPress.Common.Tools;

namespace GxPress.Entity.WorkFlow
{
    /// <summary>
    /// 审批待办事项
    /// </summary>
    [DataTable("tede_flow_todo")]
    public class FlowTodo : Datory.Entity
    {
        /// <summary>
        /// 流规则id
        /// </summary>
        [DataColumn]
        public int ProcessId { get; set; }

        /// <summary>
        /// 流id
        /// </summary>
        [DataColumn]
        public int FlowId { get; set; }

        /// <summary>
        /// 用户id
        /// </summary>
        [DataColumn]
        public int UserId { get; set; }

        /// <summary>
        /// 待办工作类型(TodoTypeConst)：ApproverCheck审核,CarbonCopy抄送
        /// </summary>
        [DataColumn]
        public string Type { get; set; }

        /// <summary>
        /// 是否处理完毕
        /// </summary>
        [DataColumn]
        public bool IsDone { get; set; }

        /// <summary>
        /// 是否审核通过
        /// </summary>
        [DataColumn]
        public bool IsChecked { get; set; }
        /// <summary>
        /// 处理状态 1 上会 2 待定
        /// </summary>
        /// <value></value>
        [DataColumn]
        public int DoneType { get; set; }
        /// <summary>
        /// 是否可操作
        /// </summary>
        /// <value></value>
        [DataColumn]
        public bool IsOperate { get; set; }
        /// <summary>
        /// 审批/抄送意见
        /// </summary>
        [DataColumn]
        public string Message { get; set; }

        /// <summary>
        /// 附件列表
        /// </summary>
        [JsonIgnore]
        [DataColumn]
        private string FileIdCollection { get; set; }
        /// <summary>
        /// 是否阅读
        /// </summary>
        /// <value></value>
        [DataColumn]
        public bool IsRead { get; set; }
        /// <summary>
        /// 是否催办
        /// </summary>
        /// <value></value>
        [DataColumn]
        public bool IsRemind { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        /// <value></value>
        [DataColumn]
        public int Sort { get; set; }

        /// <summary>
        /// 是否专审
        /// </summary>
        /// <value></value>
        [DataColumn]
        public bool IsReferral { get; set; }

        /// <summary>
        /// 是否或签
        /// </summary>
        /// <value></value>
        [DataColumn]
        public bool IsCaseOr{ get; set; }

          /// <summary>
        /// 父级ID
        /// </summary>
        /// <value></value>
        [DataColumn]
        public int ParentId{ get; set; }
        /// <summary>
        /// 附件列表
        /// </summary>
        public IEnumerable<int> FileIds
        {
            get => StringUtils.StringCollectionToIntList(FileIdCollection);
            set => FileIdCollection = StringUtils.ObjectCollectionToString(value);
        }
    }
}