package com.qmth.distributed.print.business.enums;

import java.util.Objects;

/**
 * @Description: 自定义流程审核用户类型
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2022/1/21
 */
public enum CustomFlowTypeEnum {

    START("开始节点", "start"),

    PROCESS("过程节点", "process"),

    END("结束节点", "end"),

    EXCLUSIVE_GATE_WAY("排他网关", "exclusivegateway"),

    PARALLEL_GATE_WAY("并行网关", "parallelgateway"),

    SEQUENCE("箭头", "flow"),

    USER_TASK("任务节点", "usertask");

    private String title;

    private String id;

    private CustomFlowTypeEnum(String title, String id) {
        this.title = title;
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public String getTitle() {
        return title;
    }

    /**
     * 状态转换 toName
     *
     * @param title
     * @return
     */
    public static String convertToName(String title) {
        for (CustomFlowTypeEnum e : CustomFlowTypeEnum.values()) {
            if (Objects.equals(title, e.getTitle())) {
                return e.name();
            }
        }
        return null;
    }
}
