package cn.axzo.workflow.common.enums;

import cn.axzo.framework.rocketmq.Event;

/**
 * 流程实例相关的 MQ 事件枚举定义
 *
 * @author wangli
 * @since 2023/9/25 11:47
 */
public enum ProcessInstanceEventEnum {

    PROCESS_INSTANCE_CREATED("process-instance", "process-instance-created", "流程实例已创建"),
    PROCESS_INSTANCE_STARTED("process-instance", "process-instance-started", "流程实例已开始"),
    PROCESS_INSTANCE_CANCELLED("process-instance", "process-instance-cancelled", "流程实例已撤回"),
    PROCESS_INSTANCE_REJECTED("process-instance", "process-instance-rejected", "流程实例已驳回"),
    PROCESS_INSTANCE_ABORTED("process-instance", "process-instance-aborted", "流程实例已中止"),
    PROCESS_INSTANCE_COMPLETED("process-instance", "process-instance-completed", "流程实例已结束"),
    ;
    private final String module;
    private final String tag;
    private final String desc;
    private Event.EventCode eventCode;

    ProcessInstanceEventEnum(String module, String tag, String desc) {
        this.eventCode = Event.EventCode.builder()
                .module(module)
                .name(tag)
                .build();
        this.module = module;
        this.tag = tag;
        this.desc = desc;
    }

    public String getModule() {
        return module;
    }

    public String getTag() {
        return tag;
    }

    public String getDesc() {
        return desc;
    }

    public Event.EventCode getEventCode() {
        return eventCode;
    }
}
