using System.Collections.Generic;
using GxPress.Common.Tools;
using Datory;
using Datory.Annotations;
using GxPress.EnumConst;

namespace GxPress.Entity.WorkFlow
{
    /// <summary>
    /// 办公流定义
    /// </summary>
    [DataTable("tede_flow")]
    public class Flow : Datory.Entity
    {
        /// <summary>
        /// 工作流规则id
        /// </summary>
        [DataColumn] 
        public int ProcessId { get; set; }

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

        /// <summary>
        /// 流程状态(Meeting上会， Checked已通过， Denied已拒绝)
        /// </summary>
        [DataColumn]
        public FlowState State { get; set; }

        /// <summary>
        /// 当前流程节点
        /// </summary>
        [DataColumn] 
        public int ProcessNodeId { get; set; }

        /// <summary>
        /// 审核人Id列表
        /// </summary>
        [DataColumn(Text = true)]
        public string ApproverCheckUserIdCollection { get; set; }

        /// <summary>
        /// 审核人Id列表
        /// </summary>
        public IEnumerable<int> ApproverCheckUserIds
        {
            get => StringUtils.StringCollectionToIntList(ApproverCheckUserIdCollection);
            set => ApproverCheckUserIdCollection = string.Join(",", value);
        }

        /// <summary>
        /// 抄送人Id列表
        /// </summary>
        [DataColumn(Text = true)]
        public string CarbonCopyUserIdCollection { get; set; }

        /// <summary>
        /// 抄送人Id列表
        /// </summary>
        public IEnumerable<int> CarbonCopyUserIds
        {
            get => StringUtils.StringCollectionToIntList(CarbonCopyUserIdCollection);
            set => CarbonCopyUserIdCollection = string.Join(",", value);
        }

        /// <summary>
        /// 审批编号
        /// </summary>
        [DataColumn]
        public string No { get; set; }

         /// <summary>
        /// 是否阅读
        /// </summary>
        /// <value></value>
        [DataColumn]
        public bool IsRead { get; set; }
    }
}