package com.casic.dcms.mvp.presenter.impl;

import com.casic.dcms.bean.CaseCheckBean;
import com.casic.dcms.listener.OnGetCaseCheckListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.CaseCheckModelImpl;
import com.casic.dcms.mvp.presenter.ICaseCheckPresenter;
import com.casic.dcms.mvp.view.ICaseCheckView;

public class CaseCheckPresenterImpl extends BasePresenter implements ICaseCheckPresenter, OnGetCaseCheckListener {

    private final ICaseCheckView view;
    private final CaseCheckModelImpl actionModel;

    public CaseCheckPresenterImpl(ICaseCheckView caseCheckView) {
        this.view = caseCheckView;
        actionModel = new CaseCheckModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(int limit, int offset) {
        addSubscription(actionModel.sendCaseCheckRequest(limit, offset, false));
    }

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

    @Override
    public void onSuccess(CaseCheckBean resultBean) {
        view.obtainCheckListResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
