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

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


/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 9/1/20 5:57 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 9/1/20 5:57 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum UnifiedChannelSyncCompanyTypeEnum {

	运营商(1, "运营商"),
	渠道商(2, "渠道商");

	private Integer key;
	private String  desc;

	UnifiedChannelSyncCompanyTypeEnum(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 (UnifiedChannelSyncCompanyTypeEnum c : UnifiedChannelSyncCompanyTypeEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}
//		return null;
		return "未开票";
	}

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

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

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