package cn.hanghui.outapi.platform.tenant.entity.enums;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author shisl
 * @package cn.hanghui.outapi.platform.tenant.entity.dto
 * @class RiskRespCodeEnum
 * @date 2024/1/17 上午10:19
 * @description
 */
@Getter
@AllArgsConstructor
public enum RiskRespCodeEnum {

    SUCCESS("00", "成功"),
    PARAM_ERROR("02", "参数无效"),
    PARAM_INCOMPLETE("03", "缺少参数"),
    TOKEN_ERROR("1000", "token无效"),
    REQUEST_TOKEN_OVER_LIMIT("1001", "缺少token的获取次数超过限制参数"),
    IP_WHITELIST_ERROR("1002", "请求ip不在白名单之内"),
    PARAM_IDNUMBER_ERROR("2003", "身份证号格式无效"),
    PARAM_EXCEPTION("2007", "数据异常，未能获取结果"),
    UNAUTHORIZED("0401", "账号没有接口权限"),
    REQUEST_OVER_LIMIT("0402", "接口调用次数超过套餐限制"),
    COMMON_REQUEST_ERROR("99", "通用请求错误"),
    ;

    public static RiskRespCodeEnum getRiskRespCodeEnumByCode(String code) {
        if (StrUtil.isBlank(code)) {
            return null;
        }
        for (RiskRespCodeEnum enumObject : values()) {
            if (enumObject.code.equals(code)) {
                return enumObject;
            }
        }
        return null;
    }

    private String code;
    private String desc;


}
