package com.diagbot.enums;

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

/**
 * @Description:化验数据来源
 * @Author:zhaops
 * @time: 2018/12/26 16:37
 */
public enum LisSourceEnum  implements KeyedNamed {
    Inner(0, "ICSS-内部"),
    Outer(1, "外部");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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