package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.OvertimeCaseBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.OvertimeCaseListModelImpl;
import com.casic.dcms.mvp.view.IOvertimeCaseListView;

public class OvertimeCaseListPresenterImpl extends BasePresenter implements IOvertimeCaseListPresenter,
        OvertimeCaseListModelImpl.OnGetOvertimeCaseListListener {

    private IOvertimeCaseListView view;
    private OvertimeCaseListModelImpl actionModel;

    public OvertimeCaseListPresenterImpl(IOvertimeCaseListView overtimeCaseListView) {
        this.view = overtimeCaseListView;
        actionModel = new OvertimeCaseListModelImpl(this);
    }

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

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

    @Override
    public void onSuccess(OvertimeCaseBean resultBean) {
        view.obtainOvertimeCaseList(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
