package com.weiqi.mis;

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

/**
 * Created by yyy on 2024/3/22.
 */
public enum ReturnCode {

    UNREGISTER(104, "_appid未注册(请联系接口提供方)~！"),
    SIGNERROR(107, "_sign签名无效~！"),
    TIMESTAMPERROR(108, "_timestamp无效~！"),
    TIMESTAMPEXPIRES(109, "_timestamp已过期~！"),

    INVALID(0, "无效"),
    LACK_PARAM(101, "缺少必要的请求参数"),
    FORMAT_ERROR(102, "请求参数格式错误"),
    LACK_APPID(103, "缺少参数_appid"),
    APPID_WITHOUT(104, "该appid不存在"),
    APPID_STOP(105, "该_appid已停用"),
    LACK_AUTOGRAPH(106, "缺少签名"),
    AUTOGRAPH_ERROR(107, "缺少签名"),
    LACK_TIMESTAMP(108, "缺少参数_timestamp"),
    REQUEST_INVALID(109, "请求已过期"),
    REDIRECT(110, "请求重发"),
    NOT_HTTPGET(111, "HTTP请求非get方式"),
    NOT_HTTPPOST(112, "HTTP请求非post方式"),
    API_NOT_EXIST(113, "接口版本不存在"),
    NOT_API_AUTH(114, "没有接口访问权限"),
    API_STOP(115, "接口已停用"),
    API_OFFLINE(116, "接口不处于上线状态"),
    BEYOND_FREQUENCY(117, "已超限频阀值"),
    BEYOND_CURRENT_LIMIT(118, "已超限流阀值"),
    IP_INVALID(119, "ip限制不能访问资源"),
    WITHOUT_PCPOPCLUB(120, "获取不到pcpopclub值"),
    PCPOPCLUB_ERROR(121, "pcpopclub解密失败"),
    INFO_ERROR(122, "用户名或密码验证失败"),
    REQUEST_ILLEGAL(123, "请求被拒绝.用来处理业务上认为定义的非法请求"),
    PHONE_ERROR(124, "pcpopclub解密成功，未验证手机号"),
    NOT_MODIFY(125, "pcpopclub解密成功，未修改初始用户名"),
    WITHOUT_RESULT(126, "查询内容不存在"),
    API_ERROR(127, "接口系统错误"),
    TRADE_NO_EXIST(128, "交易号已经存在,重复推送数据"),
    USER_NO_LOGIN(129, "用户未登录"),
    OCR_NO_RESULT(130, "OCR接口识别失败"),
    BAD_SOURCE(131, "source错误"),
    UPLOAD_FAILE(2150137, "上传失败:请上传购车发票"),
    PIC_FORMAT_ERROR(2150138, "上传失败:图片格式错误"),
    USERINFO_ERROR(2150139, "调用用户中心获取用户信息失败"),

    NAKED_PRICE_LACK(2150101, "缺少裸车价"),
    BUY_TIME_LACK(2150102, "缺少购车时间"),
    BUY_TIME_F(2150103, "购车时间不正确"),

    CARPRICE_STATISTICS_EXIST(2160301, "该价格您已经点击过有帮助，不允许重复提交"),
    MARKET_PRICE_EXIST(2160101, "该价格已经保存过，不允许重复保存"),
    MARKET_PRICE_NOT_EXIST(2160102, "该价格不存在"),
    MARKET_INVITE_NOT_EXIST(2160102, "该邀请信息不存在"),
    IS_CURRENT_MEMBER(2160103, "不允许自己邀请自己"),
    MARKET_PRICE_REWARD_EXIST(2160104, "已经发过奖励，不允许再次发送"),
    FILE_LENGTH_OUT_OF_RANGE(105, "字节流超出范围"),


    NOT_BRAND_LACK(2170002, "缺少品牌信息"),
    NOT_SERIES_LACK(2170003, "缺少车系信息"),
    NOT_SPEC_LACK(2170004, "缺少车型信息"),
    NOT_PROVICE_LACK(2170005, "缺少省份信息"),
    NOT_CITY_LACK(2170006, "缺少城市信息"),
    NOT_JXS_LACK(2170007, "缺少经销商信息"),
    NOT_SHOW_TIME_LACK(2170008, "缺少车展日期信息"),
    NOT_CUSTOMER_NAME_LACK(2170009, "缺少客户名称信息"),
    NOT_VERDOR_NAME_LACK(2170010, "缺少商家名称信息"),
    SEND_AUTOSHOW_STATUS_ERROR(2170011, "发送审核状态失败"),
    SEND_OCR_TOOL_CALLBACK_ERROR(2170012, "发送审核状态失败"),
    SEND_CAR_OWNER_STATUS_ERROR(2170013, "发送审核状态失败"),
    NOT_PKUUID_LACK(2170014,"缺少pkuuid"),

    // 验证码相关
    VCODE_MISSING_GVCODE(3000100, "请输入图片验证码"),
    VCODE_BAD_GVCODE(3000201, "图片验证码错误"),
    VCODE_SEND_FAILED(3001101, "验证码发送失败");

    private int code;
    private String desc;

    private ReturnCode(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private static Map<Integer, ReturnCode> codes = new HashMap<Integer, ReturnCode>();

    public int getCode() {
        return this.code;
    }

    public String getDesc() {
        return this.desc;
    }

    public static ReturnCode getReturnCode(int code) {
        ReturnCode[] types = values();
        for (ReturnCode ct : types) {
            if (ct.getCode() == code) {
                return ct;
            }
        }
        return null;
    }


}
