package com.diagbot.enums;

import com.diagbot.core.KeyedNamed;

import lombok.Setter;
/**
 * 
 * @author rgb
 * @Description: TODO
 * @date 2018年12月11日 下午2:31:42
 */
public enum SexTypeEnum implements KeyedNamed {
    Disable(1, "男"),
    Enable(2, "女");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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

