package cn.axzo.workflow.common.enums;

import java.util.Arrays;
import java.util.Objects;

/**
 * 审批方式枚举
 *
 * @author wangli
 * @since 2023/11/16 10:10
 */
public enum ApprovalMethodEnum {

    human("human", "人工审批", ""),
    autoPassed("autoPassed", "自动通过", "[仅审批节点可能选该值]"),
    autoPassed_empty("autoPassed", "自动通过", "该枚举仅日志处理使用"),
    autoRejection("autoRejection", "自动驳回", "[仅审批节点可能选该值]"),
    autoRejection_empty("autoRejection", "自动驳回", "该枚举仅日志处理使用"),
    nobody("nobody", "不设置审批人", "[仅业务节点可能有该值]"),
    bizSpecify("bizSpecify", "业务指定审批人", "[仅业务节点可能有该值]"),
    transferToAdmin("transferToAdmin", "转办给管理员", "该枚举仅日志处理使用"),
    unknown("unknown", "未知", "兜底")
    ;

    private String type;
    private String desc;
    private String remark;

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

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public static ApprovalMethodEnum valueOfType(String type) {
        return Arrays.stream(ApprovalMethodEnum.values())
            .filter(i -> Objects.equals(i.getType(), type))
            .findAny()
            .orElse(null);
    }
}
