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

import com.casic.dcms.bean.DelayedOrPostBean;
import com.casic.dcms.listener.OnGetDelayedListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.DeptCaseModelImpl;
import com.casic.dcms.mvp.presenter.IDeptCasePresenter;
import com.casic.dcms.mvp.view.IDeptPostOrDelayedView;

public class DeptDelayedPresenterImpl extends BasePresenter implements IDeptCasePresenter, OnGetDelayedListener {

    private final IDeptPostOrDelayedView view;
    private final DeptCaseModelImpl actionModel;

    public DeptDelayedPresenterImpl(IDeptPostOrDelayedView deptCaseListView) {
        this.view = deptCaseListView;
        actionModel = new DeptCaseModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(int offset) {
        addSubscription(actionModel.sendDelayedOrPostRequest(offset, true));
    }

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

    @Override
    public void onSuccess(DelayedOrPostBean resultBean) {
        view.obtainResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
