package com.police.policedatasystem.mine.viewmodel;

import androidx.annotation.NonNull;

import com.police.policedatasystem.http.CustomCallBack;
import com.police.policedatasystem.http.RequestClient;
import com.police.policedatasystem.mine.activity.ApplyDetailActivity;
import com.police.policedatasystem.mine.model.ApplyDetail;
import com.police.policedatasystem.util.UiUtils;

import okhttp3.Call;

public class DetailViewModel {
    public ApplyDetailActivity activity;
    public RequestClient requestClient = RequestClient.instance();

    public DetailViewModel(ApplyDetailActivity activity) {
        this.activity = activity;
    }

    public void getApplyDetail(String fnbh) {
        activity.loadingShow();
        requestClient.getApplyDetail(fnbh, new CustomCallBack<ApplyDetail>() {
            @Override
            public void onError(@NonNull Call call, @NonNull Exception e) {
                UiUtils.toast(e.getMessage());
                activity.loadingNone();
            }

            @Override
            public void onSuccess(ApplyDetail value) {
                activity.applyDetail(value);
                activity.loadingNone();
            }
        });
    }
//    public void jumpApplyDetail(String fnbh) {
//        activity.loadingShow();
//        requestClient.jumpApplyDetail(fnbh, new CustomCallBack<ApplyDetail>() {
//            @Override
//            public void onError(@NonNull Call call, @NonNull Exception e) {
//                UiUtils.toast(e.getMessage());
//                activity.loadingNone();
//            }
//
//            @Override
//            public void onSuccess(ApplyDetail value) {
//                activity.applyDetail(value);
//                activity.loadingNone();
//            }
//        });
//    }
}
