package com.lantone.common.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 状态 0:禁用，1：启用
 * @author: gaodm
 * @time: 2018/9/3 16:01
 */
public enum StatusEnum {

    Disable("0", "禁用"),
    Enable("1", "启用");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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

}