package com.cool.store.enums;

import com.google.common.collect.Lists;

import java.util.List;

public enum NodeNoEnum {
    NODE_NO_0(0,"提交任务"),
    NODE_NO_1(1,"第一级审批"),

    ;

    private Integer code;

    private String typeName;

    NodeNoEnum(Integer code, String typeName) {
        this.code = code;
        this.typeName = typeName;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    /**
     * 获取之后的审批节点集合
     * @param nodeNo
     * @return
     */
    public static List<NodeNoEnum> getNextNodeNoList(Integer nodeNo){
        if(NodeNoEnum.NODE_NO_0.getCode().equals(nodeNo)){
            return Lists.newArrayList(NodeNoEnum.NODE_NO_1);
        }
        return Lists.newArrayList();
    }

    public static NodeNoEnum getByCode(Integer code){
        for(NodeNoEnum nodeNoEnum : NodeNoEnum.values()){
            if(nodeNoEnum.getCode().equals(code)){
                return nodeNoEnum;
            }
        }
        return null;
    }
}
