package cn.axzo.workflow.common.enums;

import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * 自动过审参数
 */

@Getter
public enum AutoApprovalTypeEnum {

    NO_AUTO_APPROVAL("noAutoApproval", "不自动过审"),
    CONTINUOUS_NODES_AUTO_APPROVAL("continuousNodesAutoApproval", "连续节点自动过审");

    private final String type;
    private final String desc;

    AutoApprovalTypeEnum(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static AutoApprovalTypeEnum fromType(String type) {
        if (!StringUtils.hasText(type)) {
            return null;
        }
        for (AutoApprovalTypeEnum typeEnum : AutoApprovalTypeEnum.values()) {
            if (typeEnum.type.equals(type)) {
                return typeEnum;
            }
        }
        return null;
    }
}
