package cn.superdesk.uniorder.common.enums.pay;

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

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 7/8/20 11:44 AM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/8/20 11:44 AM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum UnifiedOrderPayTypeEnum {

    未支付(0, "未支付"),

    余额支付(1, "余额支付"),
    后台付款(11, "后台付款"),

    在线支付(2, "在线支付"),
    微信支付(21, "微信支付"),
    支付宝支付(22, "支付宝支付"),
    银联支付(23, "银联支付"),
    余额微信(24, "余额微信"),
    云闪付(25, "云闪付"),
    饭卡支付(26, "饭卡支付"),

    企业月结(3, "企业月结"),

    组合支付(4, "组合支付"),

    积分支付(5, "积分支付"),
    ;

    private Integer key;
    private String  desc;

    UnifiedOrderPayTypeEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public Integer getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(Integer key) {
        for (UnifiedOrderPayTypeEnum c : UnifiedOrderPayTypeEnum.values()) {
            if (c.key.equals(key)) {
                return c.getDesc();
            }
        }
//		return null;
        return "未定义";
    }

    private static final Map<Integer, UnifiedOrderPayTypeEnum> LOOKUP = new HashMap<>();

    static {
        for (UnifiedOrderPayTypeEnum s : EnumSet.allOf(UnifiedOrderPayTypeEnum.class)) {
            LOOKUP.put(s.getKey(), s);
        }
    }

    public static UnifiedOrderPayTypeEnum get(Integer key) {
        return LOOKUP.get(key);
    }

}
