package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.CaseHandleBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.CaseHandleListModelImpl;
import com.casic.dcms.mvp.view.ICaseHandleListView;

public class CaseHandleListPresenterImpl extends BasePresenter implements ICaseHandleListPresenter,
        CaseHandleListModelImpl.OnGetCaseHandleListListener {

    private ICaseHandleListView view;
    private CaseHandleListModelImpl actionModel;

    public CaseHandleListPresenterImpl(ICaseHandleListView caseHandleListView) {
        this.view = caseHandleListView;
        actionModel = new CaseHandleListModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(String isOvertime, String isEmergent, int limit, int offset) {
        addSubscription(actionModel.sendRetrofitRequest(isOvertime, isEmergent, limit, offset));
    }

    @Override
    public void disposeRetrofitRequest() {
        unSubscription();
    }

    @Override
    public void onSuccess(CaseHandleBean resultBean) {
        view.obtainCaseHandleList(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
