package com.diagbot.enums;

import com.diagbot.core.KeyedNamed;

import lombok.Setter;

public enum DisclaimerCodeEnum implements KeyedNamed{
	
	DiagnoseDisclaimer(1, "诊断免责信息"),
	PushLiability(2, "推送免责信息"),
	Disclaimer(3,"免责声明");
	
	@Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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