package com.fjhx.enums;

import lombok.Getter;

import java.util.HashMap;

@Getter
public enum HandleResultEnum {
    IN_PROGRESS(1, "审批中"),
    SUCCESS(2, "已通过"),
    FAIL(3, "不通过"),
    REVOKE(4, "已撤销");

    private final Integer type;
    private final String name;

    private static final HashMap<Integer, HandleResultEnum> map = new HashMap<>();

    HandleResultEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    static {
        for (HandleResultEnum value : HandleResultEnum.values()) {
            map.put(value.getType(), value);
        }
    }

    /**
     * 根据type获取枚举
     */
    public static HandleResultEnum get(Integer type) {
        return map.get(type);
    }

    /**
     * 根据type值获取枚举
     */
    public static String getName(Integer type) {
        return map.get(type).getName();
    }
}
