package com.diagbot.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 审核状态
 * @author: gaodm
 * @time: 2018/9/3 16:01
 */
public enum ExampleOperationEnum {
    UP_OR_UP("1", "修改"),
    UP_OR_DEL("2", "删除"),
    ADD_EXIST("3", "新增已有"),
    ADD_NO_EXIST("4", "新增缺失"),
    RECOVER("5", "恢复");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

    ExampleOperationEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public static ExampleOperationEnum getEnum(String key) {
        for (ExampleOperationEnum item : ExampleOperationEnum.values()) {
            if (item.key.equals(key)) {
                return item;
            }
        }
        return null;
    }

    public static String getName(String key) {
        ExampleOperationEnum item = getEnum(key);
        return item != null ? item.name : null;
    }
}
