package com.diagbot.enums;

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

/**
 * @Description:
 * @author: wangyu
 * @time: 11:06 2018/9/27
 */
public enum RenewalsEnum implements KeyedNamed {
    RENEWALS(1,"已续费"),
    NOT_RENEWALS(0, "未续费");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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

