package com.naz.sdkdemo.http;

import android.app.Activity;
import android.text.TextUtils;
import android.util.Log;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Progress;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.request.base.Request;
import com.naz.sdkdemo.base.Callback;
import com.naz.sdkdemo.base.CallbackNew;
import com.naz.sdkdemo.bean.AdBean;
import com.naz.sdkdemo.bean.LbBean;
import com.naz.sdkdemo.bean.OperateResult;
import com.naz.sdkdemo.bean.OrderListInfo;
import com.naz.sdkdemo.bean.ScanInfo;
import com.naz.sdkdemo.bean.ScanRecycleInfo;
import com.naz.sdkdemo.bean.StatusInfo;
import com.naz.sdkdemo.bean.StockInfo;
import com.naz.sdkdemo.bean.TrademarkInfo;
import com.naz.sdkdemo.okgo.callback.DialogCallback;
import com.naz.sdkdemo.okgo.module.BaseResponse;
import com.naz.sdkdemo.okgo.module.BaseResponse2;
import com.naz.sdkdemo.utils.FileHelper;
import com.naz.sdkdemo.utils.SPUtils;
import com.naz.sdkdemo.weight.UserCache;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

public class ApiHelper {

    /**
     *
     * @param activity
     * @param type 1=IN存标、2=UP上标、3=LEAD领标,4=UPKEEP维修,5=PRINT散标打印
     * @param callback
     */
    public static void operateApply(Activity activity, int type, CallbackNew<OperateResult> callback) {
        JSONObject body = new JSONObject();
        try {
            JSONObject data = new JSONObject();
            body.put("bizTypeEk", "LOWCODE");
            body.put("dynamicFormId", "533124397126959104");
            body.put("bizId", "-1");

            JSONObject device_operate_apply = new JSONObject();
//            device_operate_apply.put("device_code_show", "测试设备");
            device_operate_apply.put("device_code", UserCache.getDeviceId());
            //IN存标/UP上标/LEAD领标
            if (type == 1) {
                device_operate_apply.put("bus_type_dk", "IN");
                device_operate_apply.put("bus_type_dk_show", "存标");
            } else if (type == 2) {
                device_operate_apply.put("bus_type_dk", "UP");
                device_operate_apply.put("bus_type_dk_show", "上标");
            } else if (type == 5){
                device_operate_apply.put("bus_type_dk", "PRINT");
                device_operate_apply.put("bus_type_dk_show", "散标打印");
            }else{
                device_operate_apply.put("bus_type_dk", "LEAD");
                device_operate_apply.put("bus_type_dk_show", "领标");
            }
            data.put("device_operate_apply", device_operate_apply);
            body.put("data", data);
        } catch (JSONException e) {
        }
        OkGo.<OperateResult>post(Api.deviceOperateApply())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<OperateResult>(activity) {
                    @Override
                    public void onSuccess(Response<OperateResult> response) {
                        callback.onResult(response.body());
                    }
                });
    }

    private static final int PERIOD = 5 * 1000;
    private static final int DELAY = 0;
    private static Timer mTimer;
    private static TimerTask mTimerTask;
    private static boolean isSuccess = false;
    private static boolean canRequest = true;
    public static void loopMonitionOpen(Activity activity, int type, Callback callback){
        Log.e("---------->","-------->loopMonitionOpen");
        isSuccess = false;
        canRequest = true;
        mTimer = new Timer();
        mTimerTask = new TimerTask() {
            @Override
            public void run() {
                Log.e("---------->","-------->isSuccess="+isSuccess+", canRequest = "+canRequest);
                if (!isSuccess && canRequest){
                    canRequest = false;
                    openDoorState(activity, type, callback);
                }
            }
        };
        mTimer.schedule(mTimerTask,DELAY,PERIOD);
    }

    //1,CK00004 一号门，0,CK00001三号门
    private static void openDoorState(Activity activity, int type, Callback callback) {
        JSONObject body = new JSONObject();
        try {
            body.put("device_code", UserCache.getDeviceId());
            String boxCode = "";
            if (type == 0){//三号门
                boxCode = "CK00001";
            }else if (type == 1){
                boxCode = "CK00004";//一号门
            }else {//二号门暂时保留
                boxCode = "CK00004";
            }
            body.put("box_code", boxCode);
        } catch (JSONException e) {
        }
        OkGo.<StatusInfo>post(Api.openCommandUrl())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<StatusInfo>(activity) {
                    @Override
                    public void onSuccess(Response<StatusInfo> response) {
                        if (TextUtils.equals(response.body().status, "200")) {
                            Log.e("---------->","-------->isSuccess=成功");
                            if (mTimer != null) {
                                mTimer.cancel();
                                mTimerTask.cancel();
                            }
                            isSuccess = true;
                            canRequest = true;
                            callback.onSuccess(Callback.SUCCESS, null, null);
                        } else {
                            canRequest = true;
//                            callback.onSuccess(Callback.ERROR, null, null);
                        }
                    }

                    @Override
                    public void onError(Response<StatusInfo> response) {
                        super.onError(response);
                        canRequest = true;
                    }
                });
    }

    public static void cancelLoop(){
        if (mTimer != null) {
            mTimer.cancel();
            mTimerTask.cancel();
        }
    }


    public static void operateRecord(Activity activity, int type, CallbackNew<OperateResult> callback) {
        JSONObject body = new JSONObject();
        try {
            JSONObject data = new JSONObject();
            body.put("bizTypeEk", "LOWCODE");
            body.put("dynamicFormId", "527015507758989313");
            body.put("bizId", "-1");

            String status = "";
            String statueShow = "";
            if (type == 0){
                status = "CLOSE";
                statueShow = "关柜";
            }else {
                status = "OPEN";
                statueShow = "开柜";
            }
            JSONObject device_operate_apply = new JSONObject();
            device_operate_apply.put("device_code", UserCache.getDeviceId());
            device_operate_apply.put("box_code","CK00001");
            device_operate_apply.put("box_code_show", "设备仓");
            device_operate_apply.put("status_dk", status);
            device_operate_apply.put("status_dk_show", statueShow);
            data.put("device_operate_record", device_operate_apply);
            body.put("data", data);
        } catch (JSONException e) {
        }
        OkGo.<OperateResult>post(Api.deviceOperateRecord())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<OperateResult>(activity, false) {
                    @Override
                    public void onSuccess(Response<OperateResult> response) {
                        callback.onResult(response.body());
                    }
                });
    }



    public static void getOrderList(String orderId, String code, Activity activity, int type, Callback callback) {
        JSONObject body = new JSONObject();
        String param = "prod_trademark_compare_view.brand_code";
        String codeStr = "";
        if(type == 0) {
            param = "material_code-material_code_show";
        }else {//领标不用传，整卷领标需要
            codeStr = code;
        }
        try {
            body.put("device_code", UserCache.getDeviceId());
            body.put("direction", "DESC");
            body.put("property", "id");
            body.put("fromClientType", "pc");
            body.put("number", 0);
            body.put("sorts", new JSONArray());
            body.put("size", 15);
            body.put("specialConditions", new JSONArray());
            body.put("workflowSearchBean", new JSONObject());
            body.put("dynamicFormCode", "sale_order");
            body.put("dynamicFormCode", null);
            body.put("ignoreField", true);
            body.put("developmentSystemId", null);

            JSONArray rules = new JSONArray();
            JSONObject item1 = new JSONObject();
            item1.put("field", "exe_sale_order_b.no");
            item1.put("option", "LIKE_ANYWHERE");
            item1.put("values", new JSONArray().put(orderId));
            rules.put(item1);

            JSONObject item2 = new JSONObject();
            item2.put("field", param);
            item2.put("option", "LIKE_ANYWHERE");
            item2.put("values", new JSONArray().put(codeStr));
            rules.put(item2);
            body.put("rules", rules);
        } catch (JSONException e) {

        }
        OkGo.<OrderListInfo>post(Api.POST_FULL_APPLY_ORDER_LIST())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<OrderListInfo>(activity) {
                    @Override
                    public void onSuccess(Response<OrderListInfo> response) {
                        callback.onSuccess(0, null, response.body());
                    }
                });
    }

    public static void getStorehouseList(Activity activity, CallbackNew<List<StockInfo>> callback) {
        JSONObject body = new JSONObject();
        try {
            body.put("device_code", UserCache.getDeviceId());
        } catch (JSONException e) {

        }
        OkGo.<BaseResponse<StockInfo>>post(Api.POST_STORE_LIST())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<BaseResponse<StockInfo>>(activity) {
                    @Override
                    public void onSuccess(Response<BaseResponse<StockInfo>> response) {
                        callback.onResult(response.body().data);
                    }
                });
    }

    public static void getLB(Activity activity, List<LbBean> list, CallbackNew<List<StockInfo>> callback) {
        JSONObject body = new JSONObject();
        try {
            body.put("token", "Bearer "+ SPUtils.getString("TOKEN"));
            JSONArray rules = new JSONArray();
            for (LbBean bean: list) {
                JSONObject item = new JSONObject();
                item.put("title", bean.title);
                item.put("num", bean.num);
                item.put("restore_qty", bean.restore_qty);
                item.put("product_code", bean.product_code);
                item.put("product_code_show", bean.product_code_show);
                item.put("order_item_id", bean.order_item_id);
                item.put("order_item_id_show", bean.order_item_id_show);
                rules.put(item);
//                rules.put(new Gson().toJson(bean));
            }
            body.put("list", rules);

        } catch (JSONException e) {

        }
        OkGo.<BaseResponse<StockInfo>>post(Api.getLB())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<BaseResponse<StockInfo>>(activity) {
                    @Override
                    public void onSuccess(Response<BaseResponse<StockInfo>> response) {
                        callback.onResult(response.body().data);
                    }
                });
    }

    public static void getOrderBrandList(Activity activity, String codeStr, CallbackNew<OrderListInfo> callback) {
        JSONObject body = new JSONObject();
        try {
            JSONArray rules = new JSONArray();
            JSONObject item = new JSONObject();
            item.put("field", "no");
            item.put("option", "LIKE_ANYWHERE");
            item.put("values", new JSONArray().put(codeStr));
            rules.put(item);

            body.put("direction", "DESC");
            body.put("property", "id");
            body.put("fromClientType", "pc");
            body.put("number", 0);
            body.put("sorts", new JSONArray());
            body.put("rules", rules);
            body.put("size", 15);
            body.put("specialConditions", new JSONArray());
            body.put("workflowSearchBean", new JSONObject());
            body.put("dynamicFormCode", "sale_order");
            body.put("dynamicFormTable", null);
            body.put("ignoreField", true);
            body.put("developmentSystemId", null);
        } catch (JSONException e) {

        }
        OkGo.<OrderListInfo>post(Api.POST_APPLY_ORDER_LIST())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<OrderListInfo>(activity) {
                    @Override
                    public void onSuccess(Response<OrderListInfo> response) {
                        callback.onResult(response.body());
                    }
                });
    }

    public static void getScanInfo(String data, Activity activity, CallbackNew<ScanInfo> callback) {
        JSONObject raw = new JSONObject();
        try {
            raw.put("roll_qr_code", data);
        } catch (JSONException e) {

        }
        OkGo.<BaseResponse2<ScanInfo>>post(Api.POST_SCAN_CODE())
                .tag(activity)
                .upJson(raw)
                .execute(new DialogCallback<BaseResponse2<ScanInfo>>(activity) {
                    @Override
                    public void onSuccess(Response<BaseResponse2<ScanInfo>> response) {
                        ScanInfo detail = response.body().data;
                        callback.onResult(detail);
                    }
                });
    }

    public static void callThird(ScanInfo info, Activity activity, CallbackNew<ScanInfo> callback,int type) {
        JSONObject body = new JSONObject();
        try {
            String keyStr = "";
            String boxCode = "";
            String boxCodeShow = "";
            String detailCode = "brand_out_stock_dtl_qr";
            String box_code = "receive_box_code";
            String box_code_show = "receive_box_code_show";
            if (type == 1){
                keyStr = "IN";
                boxCode = "CK00001";
                boxCodeShow = "设备仓";
                detailCode = "brand_in_stock_dtl_qr";
            }else if (type == 2){
                keyStr = "UP";
                boxCode = info.box_code;
                boxCodeShow = info.box_code_show;
            }else {
                keyStr = "LEAD";
                boxCode = info.box_code;
                boxCodeShow = info.box_code_show;
                box_code = "send_box_code";
                box_code_show = "send_box_code_show";
            }
            body.put("key", UserCache.getDeviceId()+keyStr);
            JSONArray value = new JSONArray();
            JSONObject obj = new JSONObject();
            if (null != info) {
                obj.put("material_code", info.material_code);
                obj.put("material_code_show", info.material_code_show);
                obj.put("specs", info.specs);
                obj.put("unit_code", info.unit_code);
                obj.put("unit_code_show", info.unit_code_show);
                obj.put("qty", info.qty);
                obj.put("roll_qty", "1");
                obj.put("item_no", info.item_no);
                obj.put("mainKey", info.item_no);
                obj.put(box_code, boxCode);
                obj.put(box_code_show, boxCodeShow);

                JSONArray value2 = new JSONArray();
                JSONObject obj2 = new JSONObject();
                obj2.put("roll_qr_code", info.roll_qr_code);
                obj2.put("qty", info.qty);
                obj2.put("parentKey", info.item_no);
                value2.put(obj2);
                obj.put(detailCode, value2);
            }
            value.put(obj);
            body.put("value", value);
        } catch (JSONException e) {

        }
        OkGo.<BaseResponse2<ScanInfo>>post(Api.callThirdUrl())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<BaseResponse2<ScanInfo>>(activity) {
                    @Override
                    public void onSuccess(Response<BaseResponse2<ScanInfo>> response) {
                        ScanInfo detail = response.body().data;
                        callback.onResult(detail);
                    }
                });
    }

    public static void lendBind(String materialCode, String materialCodeShow, String orderNoList, List<String> qrList, Activity activity, CallbackNew<Integer> callback) {
        JSONObject body = new JSONObject();
        try {
            body.put("key", UserCache.getDeviceId());
            JSONArray array = new JSONArray();
            JSONArray value = new JSONArray();
            JSONObject obj = new JSONObject();
            obj.put("material_code", materialCode);
            obj.put("material_code_show", materialCodeShow);
            for (String qr:qrList) {
                value.put(qr);
            }
            obj.put("brand_qr_code_list", value);
            obj.put("order_no_list", orderNoList);
            array.put(obj);
            body.put("material_list", array);
        } catch (JSONException e) {

        }
        OkGo.<BaseResponse2<Void>>post(Api.leadBind())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<BaseResponse2<Void>>(activity, false) {
                    @Override
                    public void onSuccess(Response<BaseResponse2<Void>> response) {
                        if ("success".equals(response.body().status)){
                            callback.onResult(1);
                        }
                    }
                });
    }

    public static void lendBindOutStock(List<TrademarkInfo> mData, List<StockInfo> list, Activity activity, CallbackNew<Integer> callback) {
        JSONObject body = new JSONObject();
        try {
            JSONArray array = new JSONArray();
            for (int i = 0; i < list.size(); i++) {
                JSONObject obj = new JSONObject();
                obj.put("send_box_code", list.get(i).box_code);
                obj.put("send_box_code_show", list.get(i).box_code_show);
                obj.put("device_code", UserCache.getDeviceId());
                obj.put("get_brand_source_dk", "SALE_ORDER");

                JSONArray value = new JSONArray();
                StockInfo stockInfo = list.get(i);
                JSONObject obj2 = new JSONObject();
                obj2.put("item_no", i*10+10);
                obj2.put("material_code", stockInfo.material_code);
                obj2.put("restore_qty", stockInfo.restore_qty);
                obj2.put("material_code_show", stockInfo.material_code_show);
                obj2.put("specs", stockInfo.specs);
                obj2.put("unit_code", stockInfo.unit_code);
                obj2.put("unit_code_show", stockInfo.unit_code_show);
                obj2.put("qty", stockInfo.send_qty);
                obj2.put("bus_type_dk", "SALE_ORDER");
                obj2.put("bus_type_dk_show", "销售订单");
                TrademarkInfo trademarkInfo = mData.get(0);
                obj2.put("bus_no", trademarkInfo.id);
                obj2.put("bus_no_show", trademarkInfo.exe_sale_order_b.no);
                value.put(obj2);

                obj.put("brand_out_stock_dtl", value);

                array.put(obj);
            }
            body.put("brand_out_stock_list", array);
        } catch (JSONException e) {

        }
        OkGo.<BaseResponse2<Void>>post(Api.leadBindOutStock())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<BaseResponse2<Void>>(activity, false) {
                    @Override
                    public void onSuccess(Response<BaseResponse2<Void>> response) {
                        if ("success".equals(response.body().status)){
                            callback.onResult(1);
                        }
                    }
                });
    }

    public static void brandRecharge(TrademarkInfo mSelectInfo, List<TrademarkInfo> mData, List<StockInfo> list, Activity activity, CallbackNew<Integer> callback) {
        JSONObject body = new JSONObject();
        JSONObject data = new JSONObject();
        JSONObject brandSpoilRecharge = new JSONObject();
        JSONObject orderNoBizData = new JSONObject();
        try {
            orderNoBizData.put("customer_code_show", mSelectInfo.customer_code_show);
            orderNoBizData.put("customer_code", mSelectInfo.customer_code);
            orderNoBizData.put("jingxiaoshang_show", mSelectInfo.jingxiaoshang_show);
            orderNoBizData.put("jingxiaoshang", mSelectInfo.jingxiaoshang);
            orderNoBizData.put("order_type_code_show", mSelectInfo.order_type_code_show);
            orderNoBizData.put("order_type_code", mSelectInfo.order_type_code);
            orderNoBizData.put("order_date", mSelectInfo.order_date);
            orderNoBizData.put("no", mSelectInfo.no);
            orderNoBizData.put("customer_name", mSelectInfo.customer_name);
            orderNoBizData.put("total_order_quantity", mSelectInfo.total_order_quantity);
            orderNoBizData.put("dynamic_form_value_id", mSelectInfo.dynamic_form_value_id);
            orderNoBizData.put("id", mSelectInfo.id);
            orderNoBizData.put("checked", true);
            orderNoBizData.put("checkDisabled", false);

            brandSpoilRecharge.put("order_no", mSelectInfo.no);
            brandSpoilRecharge.put("order_no_show", mSelectInfo.no);
            brandSpoilRecharge.put("order_no_biz_data", orderNoBizData);

            JSONArray array = new JSONArray();
            for (int i = 0; i < list.size(); i++) {
                StockInfo stockInfo = list.get(i);
                JSONObject obj = new JSONObject();
                obj.put("item_no", i*10+10);
                obj.put("product_code", stockInfo.product_code);
                obj.put("product_code_show", stockInfo.product_code);
                obj.put("material_code", stockInfo.material_code);
                obj.put("material_code_show", stockInfo.material_code_show);
                obj.put("specs", stockInfo.specs);
                obj.put("unit_code", stockInfo.unit_code);
                obj.put("unit_code_show", stockInfo.unit_code_show);
                obj.put("qty", stockInfo.send_qty);
                obj.put("order_item_id", stockInfo.order_item_id);
                obj.put("order_item_id_show", stockInfo.order_item_id_show);
                obj.put("lineId", i*10+10);
                obj.put("checked", false);
                array.put(obj);
            }
            data.put("brand_spoil_recharge", brandSpoilRecharge);
            data.put("brand_spoil_recharge_dtl", array);
            body.put("bizTypeEk", "LOWCODE");
            body.put("bizId", -1);
            body.put("dynamicFormId", "547666717268557825");
            body.put("showModelId", "547692408362024960");
            body.put("data", data);
        } catch (JSONException e) {

        }
        OkGo.<BaseResponse2<Void>>post(Api.brandRecharge())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<BaseResponse2<Void>>(activity, false) {
                    @Override
                    public void onSuccess(Response<BaseResponse2<Void>> response) {
                        if ("success".equals(response.body().status)){
                            callback.onResult(1);
                        }
                    }
                });
    }

    public static void getBrandQrCodeInfo(String data, Activity activity, CallbackNew<ScanRecycleInfo> callback) {
        JSONObject raw = new JSONObject();
        try {
            raw.put("brand_qr_code", data);
        } catch (JSONException e) {

        }
        OkGo.<BaseResponse2<ScanRecycleInfo>>post(Api.brandQrCode())
                .tag(activity)
                .upJson(raw)
                .execute(new DialogCallback<BaseResponse2<ScanRecycleInfo>>(activity) {
                    @Override
                    public void onSuccess(Response<BaseResponse2<ScanRecycleInfo>> response) {
                        ScanRecycleInfo detail = response.body().data;
                        callback.onResult(detail);
                    }
                });
    }

    public static void getBrandRecover(String no, List<ScanRecycleInfo> mData, Activity activity, Callback callback) {
        JSONObject body = new JSONObject();
        try {
            body.put("bizTypeEk", "LOWCODE");
            body.put("bizId", "-1");
            body.put("dynamicFormId", "527025819581202433");
            body.put("showModelId", "527673418315251716");

            JSONArray array = new JSONArray();
            for (ScanRecycleInfo info:mData) {
                JSONObject obj = new JSONObject();
                obj.put("qty", "1");
                obj.put("material_code_show", info.material_code_show);
                obj.put("material_code", info.material_code);
                obj.put("item_no", info.item_no);
                array.put(obj);
            }

            JSONObject obj2 = new JSONObject();
            obj2.put("device_code", UserCache.getDeviceId());
            obj2.put("recover_box_code", "CK00002");
            obj2.put("recover_date", "2024-01-17T16:00:00.000Z");
            obj2.put("no", no);
            obj2.put("in_out_type_code", "RK");
            obj2.put("recover_box_code_show", "商标回收仓");
            obj2.put("in_out_type_code_show", "入库");

            JSONObject obj3 = new JSONObject();
            obj3.put("brand_recover", obj2);
            obj3.put("brand_recover_dtl", array);

            body.put("data", obj3);
        } catch (JSONException e) {

        }
        OkGo.<OrderListInfo>post(Api.brandRecover())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<OrderListInfo>(activity) {
                    @Override
                    public void onSuccess(Response<OrderListInfo> response) {
                        callback.onSuccess(0, null, response.body());
                    }
                });
    }

    public static void getVideoUrl(Activity activity, CallbackNew<AdBean> callback) {
        JSONObject body = new JSONObject();
        try {
            body.put("token", "Bearer "+ SPUtils.getString("TOKEN"));
        } catch (JSONException e) {

        }
        OkGo.<BaseResponse2<AdBean>>post(Api.getVideoUrl())
                .tag(activity)
                .upJson(body)
                .execute(new DialogCallback<BaseResponse2<AdBean>>(activity) {
                    @Override
                    public void onSuccess(Response<BaseResponse2<AdBean>> response) {
                        callback.onResult(response.body().data);
                    }
                });
    }

    public static void uploadPicture(Activity activity, File file, String path, String name) {
        List<File> files = new ArrayList<File>();
        files.add(file);

        OkGo.<BaseResponse<Void>>post(Api.POST_UPLOAD_PICTURE())
                .tag(activity)
                .isMultipart(true)
                .params("path", path)
                .params("name", name)
                .addFileParams("image", files)// 设置是否是上传文件
                .execute(new com.lzy.okgo.callback.Callback<BaseResponse<Void>>() {
                    @Override
                    public void onStart(Request<BaseResponse<Void>, ? extends Request> request) {

                    }

                    @Override
                    public void onSuccess(Response<BaseResponse<Void>> response) {
                        Log.e("--------->","--------->成功");
                        Log.i("--------->", "-------->uploadPicture onSuccess " + file.getAbsolutePath());
                        FileHelper.deleteImageFile(file.getAbsolutePath());
                    }

                    @Override
                    public void onCacheSuccess(Response<BaseResponse<Void>> response) {

                    }

                    @Override
                    public void onError(Response<BaseResponse<Void>> response) {

                    }

                    @Override
                    public void onFinish() {

                    }

                    @Override
                    public void uploadProgress(Progress progress) {

                    }

                    @Override
                    public void downloadProgress(Progress progress) {

                    }

                    @Override
                    public BaseResponse<Void> convertResponse(okhttp3.Response response) throws Throwable {
                        return null;
                    }
                });
    }
}
