package com.diagbot.enums;

import lombok.Setter;

/**
 * @author wangfeng
 * @date 2018年11月21日 下午2:31:42
 */
public enum LockEnum{
    LOCK("0", "锁定"),
    UNLOCK("1", "解锁");

    @Setter
    private String key;

    @Setter
    private String name;

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

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

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

    public String getKey() {
        return key;
    }

    public String getName() {
        return name;
    }
}

