package cc.smtweb.system.bpm.web.design.flow;

import cc.smtweb.framework.core.common.IntEnum;
import cc.smtweb.framework.core.common.StrEnum;

/**
 * Created by Akmm at 2022/5/24 9:04
 * 工作流常量及枚举定义
 */
public interface FlowConst {
    //操作方式
    class OperatorType {
        public static final int VIEW = 0;//查看
        public static final int NEW = 1;//新增
        public static final int EDIT = 2;//编辑
    }

    //流程按钮
    class Button extends StrEnum {
        public static Button instance = new Button();
        // 作废
        public static StrEnumBean DISUSE = instance.addEnum("disuse", "作废");
        //办理，签收
        public static StrEnumBean HANDLE = instance.addEnum("handle", "签收");
        //提交
        public static StrEnumBean SUBMIT = instance.addEnum("submit", "提交");
        //取回
        public static StrEnumBean RETAKE = instance.addEnum("retake", "取回");
        //驳回
        public static StrEnumBean REJECT = instance.addEnum("reject", "驳回");
        public static StrEnumBean INTERRUPT = instance.addEnum("interrupt", "终止");
        //新增
        public static StrEnumBean ADD = instance.addEnum("add", "新增");
        //删除
        public static StrEnumBean DEL = instance.addEnum("remove", "删除");
        //保存
        public static StrEnumBean SAVE = instance.addEnum("save", "保存");

        //导出Excel
        public static StrEnumBean EXCEL = instance.addEnum("excel", "导出Excel");
        //导出Word
        public static StrEnumBean WORD = instance.addEnum("word", "导出Word");
        //流程历史
        public static StrEnumBean LOG = instance.addEnum("log", "流程历史");

    }

    /**
     * 活动类型 1-开始任务 2-用户任务 3-条件分支 4-并行开始 5-并行结束 6-脚本任务 9-结束任务
     */
    class ActivityType extends IntEnum {
        public static ActivityType instance = new ActivityType();
        public static IntEnumBean START = instance.addEnum(1, "开始任务");
        public static IntEnumBean USER = instance.addEnum(2, "用户任务");
        public static IntEnumBean CONDITION = instance.addEnum(3, "判断分支");
        public static IntEnumBean PARALLEL = instance.addEnum(4, "并行开始");
        public static IntEnumBean GATHER = instance.addEnum(5, "并行结束");
        public static IntEnumBean AUTO = instance.addEnum(6, "脚本任务");
        public static IntEnumBean END = instance.addEnum(9, "结束任务");
    }

    /**
     * 流程活动状态  0-待办 1-办理中 2-已提交 3-已驳回
     */
    class ActivityStatu extends IntEnum {
        public static ActivityStatu instance = new ActivityStatu();
        public static IntEnumBean WAIT = instance.addEnum(0, "待办");
        public static IntEnumBean HANDLE = instance.addEnum(1, "办理中");
        public static IntEnumBean SUBMIT = instance.addEnum(2, "已提交");
        //审批不通过
        public static IntEnumBean INTERRUPT = instance.addEnum(7, "已中止");
        public static IntEnumBean DISUSE = instance.addEnum(8, "已作废");
        public static IntEnumBean REJECT = instance.addEnum(9, "已驳回");
        //并发流程中，因其他任务被驳回，导致该任务的停止
        public static IntEnumBean STOP = instance.addEnum(6, "已停止");
    }

    /**
     * 流程实例状态
     */
    class InstanceStatu extends IntEnum {
        public static ActivityStatu instance = new ActivityStatu();
        public static IntEnumBean BEGIN = instance.addEnum(1, "制单");
        public static IntEnumBean RUNING = instance.addEnum(2, "审批中");
        public static IntEnumBean FINISH = instance.addEnum(99, "生效");
        public static IntEnumBean INTERRUPT = instance.addEnum(98, "中止");
        public static IntEnumBean DISUSE = instance.addEnum(89, "作废");
    }

    /**
     * 流程任务创建方式
     */
    class TaskCreateType extends IntEnum {
        public static TaskCreateType instance = new TaskCreateType();
        public static IntEnumBean AUTO = instance.addEnum(1, "自动");
        public static IntEnumBean RETAKE = instance.addEnum(2, "取回");
        public static IntEnumBean REJECT = instance.addEnum(3, "驳回");
    }

    /**
     * 候选人过滤类别  主办人过滤：制单人所属单位/制单人所属部门/上一步提交人所属单位/上一步提交人所属部门
     */
    class CndFilterType extends IntEnum {
        public static CndFilterType instance = new CndFilterType();
        public static IntEnumBean BILL_CORP = instance.addEnum(1, "单据所属单位");
        public static IntEnumBean BILL_DEPT = instance.addEnum(2, "单据所属部门");
        public static IntEnumBean MAKE_CORP = instance.addEnum(3, "制单人所属单位");
        public static IntEnumBean MAKE_DEPT = instance.addEnum(4, "制单人所属部门");
        public static IntEnumBean SUBMITTER_CORP = instance.addEnum(5, "上一步提交人所属单位");
        public static IntEnumBean SUBMITTER_DEPT = instance.addEnum(6, "上一步提交人所属部门");
    }

    /**
     * 主办人忽略类型：位运算，上一步提交人/过滤制单人
     */
    class CndIgnoreType extends IntEnum {
        public static CndIgnoreType instance = new CndIgnoreType();
        public static IntEnumBean MAKER = instance.addEnum(1, "制单人");
        public static IntEnumBean SUBMITTER = instance.addEnum(2, "上一步提交人");
    }
}
