package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.CaseHandledBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.CaseHandledListModelImpl;
import com.casic.dcms.mvp.view.ICaseHandledListView;

public class CaseHandledListPresenterImpl extends BasePresenter implements ICaseHandledListPresenter,
        CaseHandledListModelImpl.OnGetCaseHandledListListener {

    private ICaseHandledListView view;
    private CaseHandledListModelImpl actionModel;

    public CaseHandledListPresenterImpl(ICaseHandledListView caseHandledListView) {
        this.view = caseHandledListView;
        actionModel = new CaseHandledListModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(int offset) {
        addSubscription(actionModel.sendRetrofitRequest(offset));
    }

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

    @Override
    public void onSuccess(CaseHandledBean resultBean) {
        view.obtainCaseHandledList(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
