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

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

/**
 * @Description: 差异原因:100-结算中心未找到符合条件的商品订单;101-第三方与结算中心的对账金额不相待;
 * @Author: linjinyu
 * @CreateDate: 2022/6/10 10:40 上午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/6/10 10:40 上午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SysQuartzScheduleTaskStatementOfAccountDefineErrorEnum {

    初始(0, ""),
    正常(1, ""),

    结算中心未找到符合条件的商品订单(100, "结算中心未找到符合条件的商品订单"),
    第三方与结算中心的对账金额不相等(101, "第三方与结算中心的对账金额不相等"),

    // mark by linjinyu at 2022-06-17 15:57:35 - 需求上没写，但可能发生的问题 start
    订单商品存在已锁定(110, "订单商品存在已锁定"),
    订单商品存在已对账(111, "订单商品存在已对账"),
    订单商品存在已对账已锁定(112, "订单商品存在已对账已锁定"),
    // mark by linjinyu at 2022-06-17 15:57:35 - 需求上没写，但可能发生的问题   end
    ;

    private Integer key;
    private String  desc;

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

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

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

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