package com.police.policedatasystem.http;

import androidx.annotation.NonNull;

import okhttp3.Call;

public abstract class CustomCallBack<T> {
    public abstract void onError(Call call, @NonNull Exception e);

    public abstract void onSuccess(T value);

//    @Override
//    public void onFailure(@NonNull Call call, @NonNull IOException e) {
//        onError(call, e);
//    }
//
//    @Override
//    public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
//        if (!response.isSuccessful()) {
//            onError(call, new IOException("Unexpected code " + response));
//            return;
//        }
//        try {
//            ResponseParams responseParams = new Gson().fromJson(response.body().string(), ResponseParams.class);
//            if ("200".equals(responseParams.getCode())) {
//                for (ResponseParams.FieldData item : responseParams.getData().getDataList()) {
//                    for (ResponseParams.FieldValues i : item.getFieldValues()) {
////                        new Gson().fromJson()
////                        onSuccess(i.getValue());
//                    }
//                }
//            } else {
//                onError(call, new IOException(responseParams.getMessage()));
//            }
//        } catch (Exception e) {
//            onError(call, new IOException("Unexpected code " + response));
//        }
//    }

}
