package com.diagbot.enums;

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

/**
 * @Description:
 * @author: wangyu
 * @time: 11:06 2018/9/27
 */
public enum ProductAuditEnum implements KeyedNamed {
    Opended(1,"已开通"),
    Audit(2, "开通中"),
    NotOpend(0, "未开通");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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

