package com.diagbot.enums;

import com.diagbot.core.KeyedNamed;
import lombok.Setter;

/**
 * @Description:输入模式
 * @Author:zhaops
 * @time: 2018/12/4 10:44
 */
public enum InputModeEnum implements KeyedNamed {
    Structured(1, "结构化"),
    Text(2, "文本");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

    @Override
    public int getKey() {
        return key;
    }

    @Override
    public String getName() {
        return name;
    }
}
