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

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

/**
 * @Description: 对账单 关联的
 * 订单|商品|流水,共用的对账状态:-1-不对账;1-已对账;2-未对账;3-已作废;4-已锁定
 * 对账状态 是否对账的问题
 * @Author: linjinyu
 * @CreateDate: 6/18/20 8:59 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 6/18/20 8:59 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum CommonAccountingStateEnum {

//之前老版本 先注视掉
//    不对账(-1, "不对账"),
//    已对账(1, "已对账"), // ----
//    未对账(2, "未对账"), // ----
//    已作废(3, "已作废"), // ---- mark by linjinyu 20200713 为了作废订单
//    对账中(4,"对账中"),

    未对账(1, "未对账"),
    对账中(2,"对账中"),
    已对账(3, "已对账"),
    不对账(4, "不对账"),

    ;

    private Integer key;
    private String  desc;

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

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

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

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

}
