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


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

/**
 * @Description: 共用 0-订单;1-商品;2-流水;
 * 供应商结算
 * 客户结算
 * 对账单 创建维度
 * @Author: linjinyu
 * @CreateDate: 2020/10/28 下午7:14
 * @UpdateUser: linjinyu
 * @UpdateDate: 2020/10/28 下午7:14
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum AccountingOrderDimCreateByEnum {


    不补(-1, "不补"),
    订单(0, "订单"),
    商品(1, "商品"),
    流水(2, "流水"),
    ;

    private Integer key;
    private String  desc;

    AccountingOrderDimCreateByEnum(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 (AccountingOrderDimCreateByEnum c : AccountingOrderDimCreateByEnum.values()) {
            if (c.key.equals(key)) {
                return c.getDesc();
            }
        }
        return null;
    }

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

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

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