package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.CaseCheckedBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.CaseCheckedModelImpl;
import com.casic.dcms.mvp.view.ICaseCheckedView;

public class CaseCheckedPresenterImpl extends BasePresenter implements ICaseCheckedPresenter, CaseCheckedModelImpl.OnGetCaseCheckedListener {

    private ICaseCheckedView view;
    private CaseCheckedModelImpl actionModel;

    public CaseCheckedPresenterImpl(ICaseCheckedView caseCheckedView) {
        this.view = caseCheckedView;
        actionModel = new CaseCheckedModelImpl(this);
    }

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

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

    @Override
    public void onSuccess(CaseCheckedBean resultBean) {
        view.obtainCheckedListResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
