package com.lantone.report.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 工作流节点
 * @author: gaodm
 * @time: 2018/9/3 16:01
 */
public enum AppealOperationTypeEnum {

    UP_OR_DEL("0", "删改"),
    ADD_EXIST("1", "新增已有"),
    ADD_NO_EXIST("2", "新增缺失"),
    RECOVER("3", "恢复");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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