package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.UrgentCaseBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.UrgentCaseListModelImpl;
import com.casic.dcms.mvp.view.IUrgentCaseListView;

public class UrgentCaseListPresenterImpl extends BasePresenter implements IUrgentCaseListPresenter,
        UrgentCaseListModelImpl.OnGetUrgentCaseListListener {

    private IUrgentCaseListView view;
    private UrgentCaseListModelImpl actionModel;

    public UrgentCaseListPresenterImpl(IUrgentCaseListView urgentCaseListView) {
        this.view = urgentCaseListView;
        actionModel = new UrgentCaseListModelImpl(this);
    }

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

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

    @Override
    public void onSuccess(UrgentCaseBean resultBean) {
        view.obtainUrgentCaseList(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
