package com.diagbot.enums;

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

/**
 * @Description: 
 * @Author: wangyu
 * @Date: 13:07 2018/10/18
 */
public enum CancelRenewalsEnum implements KeyedNamed {
    CANCEL_RENEWALS_ENUM(1,"取消"),
    NOT_CANCEL(0, "未取消");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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

