package cn.axzo.workflow.common.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 加签类型
 *
 * @author zuoqinbo
 */
public enum BpmnCountersignTypeEnum {
    /**
     * 向前加签
     */
    FORWARD_COUNTERSIGN("FORWARD_COUNTERSIGN", "向前加签"),
    /**
     * 向后加签
     */
    BACK_COUNTERSIGN("BACK_COUNTERSIGN", "向后加签"),
    /**
     * 共享加签
     */
    SHARE_COUNTERSIGN("SHARE_COUNTERSIGN", "共享加签"),
    ;

    private final String type;
    private final String desc;

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

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static BpmnCountersignTypeEnum valueOfType(String countersignType) {
        if (StringUtils.isBlank(countersignType)) {
            return null;
        }
        BpmnCountersignTypeEnum[] countersignTypeEnums = BpmnCountersignTypeEnum.values();
        for (BpmnCountersignTypeEnum countersign : countersignTypeEnums) {
            if (countersign.getType().equals(countersignType)) {
                return countersign;
            }
        }
        return null;
    }
}
