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

import com.casic.dcms.bean.AuthorizeOrAdjustBean;
import com.casic.dcms.listener.OnGetAuthorizeListener;
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.IDeptAuthorizeOrAdjustView;

public class DeptAdjustPresenterImpl extends BasePresenter implements IDeptCasePresenter, OnGetAuthorizeListener {

    private final IDeptAuthorizeOrAdjustView view;
    private final DeptCaseModelImpl actionModel;

    public DeptAdjustPresenterImpl(IDeptAuthorizeOrAdjustView authorizeView) {
        this.view = authorizeView;
        actionModel = new DeptCaseModelImpl(this);
    }

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

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

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

    @Override
    public void onFailure(Throwable throwable) {

    }
}