using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenAuth.Repository.Domain
{
    [SugarTable("wf_task")]
    public class WFTask
    {
        #region 实体成员

        /// <summary> 
        /// 主键 
        /// </summary> 
        [SugarColumn(IsPrimaryKey = true)]
        public string Id { get; set; }

        /// <summary> 
        /// 1.审核任务 2传阅任务 3.子流程 4.重新创建 5.会签任务 6 加签审核 7单任务审核 10.脚本任务 21.等待任务（系统自己完成）22.取消等待任务 23.找不到审核人直接跳过 24.自动审核规则跳过 25.会签任务记录
        /// </summary> 
        public int? Type { get; set; }

        /// <summary> 
        /// 流程实例主键 
        /// </summary>
        public string ProcessId { get; set; }

        /// <summary>
        /// 流程模板编码
        /// </summary>
        public string ProcessCode { get; set; }

        /// <summary>
        /// 流程实例标题
        /// </summary>
        public string ProcessTitle { get; set; }

        /// <summary>
        /// 子流程进程主键
        /// </summary>
        public string ChildProcessId { get; set; }

        /// <summary>
        /// 流程提交人id
        /// </summary>
        public string ProcessUserId { get; set; }

        /// <summary>
        /// 流程提交人名称
        /// </summary>
        public string ProcessUserName { get; set; }

        /// <summary>
        /// 任务令牌；同一节点生成相同的任务令牌同一次流转中
        /// </summary>
        public string Token { get; set; }

        /// <summary> 
        /// 流程节点ID 
        /// </summary> 
        public string UnitId { get; set; }

        /// <summary> 
        /// 流程节点名称 
        /// </summary> 
        public string UnitName { get; set; }

        /// <summary> 
        /// 上一个任务节点Id 
        /// </summary> 
        public string PrevUnitId { get; set; }

        /// <summary> 
        /// 上一个节点名称 
        /// </summary> 
        public string PrevUnitName { get; set; }

        /// <summary>
        /// 上一个任务的token
        /// </summary>
        public string PrevToken { get; set; }

        /// <summary>
        /// 上一个任务的Id
        /// </summary>
        public string PrevTaskId { get; set; }

        /// <summary>
        /// 触发状态更新的任务ID
        /// </summary>
        public string UpdateTaskId { get; set; }

        /// <summary>
        /// 任务执行人
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// 任务执行人名称
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 任务执行人部门id
        /// </summary>
        public string UserDepartmentId { get; set; }

        /// <summary>
        /// 任务执行人公司Id
        /// </summary>
        public string UserCompanyId { get; set; }

        /// <summary> 
        /// 任务状态 1.激活 2.待激活 3.完成 4.关闭 5.加签状态 6.转移给其他人 7.作废
        /// </summary> 
        public int? State { get; set; }

        /// <summary>
        /// 是否同意 0 不同意 1 同意（不是驳回的操作都属于同意，具体执行操作看任务日志）  2 没有做选择
        /// </summary>
        public int? IsAgree { get; set; }

        /// <summary>
        /// 是否是最近的任务 1.是 0 不是
        /// </summary>
        public int? IsLast { get; set; }

        /// <summary>
        /// 任务排序
        /// </summary>
        public int Sort { get; set; }

        /// <summary> 
        /// 任务超时流转到下一个节点时间 
        /// </summary> 
        public DateTime? TimeoutAction { get; set; }

        /// <summary> 
        /// 任务超时提醒消息时间 
        /// </summary> 
        public DateTime? TimeoutNotice { get; set; }

        /// <summary> 
        /// 任务超时消息提醒间隔时间 
        /// </summary>
        public int? TimeoutInterval { get; set; }

        /// <summary> 
        /// 任务超时消息发送策略编码 
        /// </summary> 
        public string TimeoutStrategy { get; set; }

        /// <summary> 
        /// 任务创建时间 
        /// </summary> 
        public DateTime? CreateDate { get; set; }

        /// <summary> 
        /// 任务创建人员 
        /// </summary> 
        public string CreateUserId { get; set; }

        /// <summary> 
        /// 任务创建人员名称 
        /// </summary> 
        public string CreateUserName { get; set; }

        /// <summary> 
        /// 是否被催办 1 被催办了
        /// </summary> 
        public int? IsUrge { get; set; }

        /// <summary>
        /// 催办时间
        /// </summary>
        public DateTime? UrgeTime { get; set; }

        /// <summary> 
        /// 加签情况下最初的任务ID
        /// </summary> 
        public string FirstId { get; set; }

        /// <summary>
        /// 批量审核 1是允许 其他值都不允许
        /// </summary>
        public int? IsBatchAudit { get; set; }

        /// <summary>
        /// 是否是驳回生成的任务
        /// </summary>
        public int? IsReject { get; set; }

        /// <summary>
        /// 子流程的流程模板id
        /// </summary>
        public string ChildSchemeInfoId { get; set; }

        /// <summary>
        /// 子流程的流程模板code
        /// </summary>
        public string ChildSchemeInfoCode { get; set; }

        /// <summary> 
        /// 是否被督办 1 被催办了
        /// </summary> 
        public int? IsSupervise { get; set; }

        /// <summary>
        /// 催办时间
        /// </summary>
        public DateTime? SuperviseTime { get; set; }

        public long SuperviseId { get; set; }

        /// <summary> 
        /// 是否超时（0未超时，1超时，2严重超时）
        /// </summary> 
        public int? IsOutTime { get; set; }

        /// <summary>
        /// 是否是撤回流程（0否，1是）
        /// </summary>
        public int? IsRetract { get; set; }

        #endregion


        #region 扩展属性

        /// <summary> 
        /// 任务完成动作 
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public string OperationName { get; set; }

        /// <summary> 
        /// 任务完成人ID 
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public string MakeUserId { get; set; }

        /// <summary> 
        /// 是否允许撤销 
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public int? IsCancel { get; set; }


        /// <summary> 
        /// 流程进程是否结束1是0不是 
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public int? IsFinished { get; set; }

        /// <summary> 
        /// 关联的任务用户中间表 
        /// </summary> 
        [SugarColumn(IsIgnore = true)]
        public List<WFTaskUser> WFTaskUser { get; set; }

        [SugarColumn(IsIgnore = true)] public string SchemeContent { get; set; }
        [SugarColumn(IsIgnore = true)] public object ExtendInfo { get; set; }

        [SugarColumn(IsIgnore = true, IsJson = true)]
        public WFInstanceInfo InstanceInfo { get; set; }
        [SugarColumn(IsIgnore = true)]
        public int? IsDrawback { get; set; }
        #endregion
    }
}