package com.winsun.constant;

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

/**
 * 排序
 * @author Liph
 * @datetime 2019-09-19/9/27 11:19
 */
public enum UserType {
    //1：老客户；0新客户;2:老客户续约3：融合 4：抽奖；5：单宽；6：羊城通卡
    NEWCUSTOMER("0", "新客户办理"),
    OLDCUSTOMER("1", "老客户办理"),
    OLDCUSTOMERRENEW ("2", "老客户续约"),
    RH("3", "融合办理"),
    LUCKYDRAW("4", "抽奖"),
    DY("5", "单宽业务"),
    YCTK("6", "羊城通业务"),
    TYY("7", "天翼云"),
    YZF("8", "翼支付"),
    BYSTH("9", "毕业生融合"),
    DKJR("10", "单宽进融");
    UserType(String id, String name) {
        this.id = id;
        this.name = name;
    };

    private static final Map<String, UserType> DATAS = new HashMap<>();
    static {
        Arrays.asList(values()).forEach(data -> DATAS.put(data.getId(), data));
    }

    private String id;

    private String name;

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static UserType findById(String id) {
        return DATAS.getOrDefault(id, null);
    }
}
