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：羊城通卡
    OLDCUSTOMER("1", "老客户"),
    NEWCUSTOMER("0", "新客户"),
    OLDCUSTOMERRENEW ("2", "老客户续约"),
    RH("3", "融合"),
    LUCKYDRAW("4", "抽奖"),
    DY("5", "单宽"),
    YCTK("6", "羊城通卡");
    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);
    }
}
