package com.goafanti.order.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 特批类型 0其他，1=无前期款，2=暂无合同款，3=含高风险条款，4=新产品首单，5=通过率低于80%，6=3万以下会员，7=认证首期5K以下
 */
public enum ApprovalTypeEnums {

    QT(0,"其他"),
    WQQK(1,"无前期款"),
    ZWHTK(2,"暂无合同款"),
    HGFXTK(3,"含高风险条款"),
    XCPSD(4,"新产品首单"),
    TGLDY(5,"通过率低于80%"),
    HY3WYX(6,"3万以下会员"),
    RZSQ5KYX(7,"认证首期5K以下");

    private Integer code;
    private String desc;

    private ApprovalTypeEnums(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    private static Map<Integer, ApprovalTypeEnums> status = new HashMap<Integer, ApprovalTypeEnums>();

    static {
        for (ApprovalTypeEnums value : ApprovalTypeEnums.values()) {
            status.put(value.getCode(), value);
        }
    }
    public static ApprovalTypeEnums getStatus(Integer code) {
        if (containsType(code)) {
            return status.get(code);
        }
        return QT;
    }
    public static String getDesc(Integer code) {
        if (containsType(code)) {
            return status.get(code).getDesc();
        }
        return QT.getDesc();
    }

    public static String getDesc(String code) {
        return getDesc(Integer.valueOf(code));
    }

    public static boolean containsType(Integer code) {
        return status.containsKey(code);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
