package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.CaseNextNodeBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.CaseNextNodeModelImpl;
import com.casic.dcms.mvp.view.ICaseNextNodeView;

public class CaseNextNodePresenterImpl extends BasePresenter implements ICaseNextNodePresenter,
        CaseNextNodeModelImpl.OnGetCaseNextNodeListener {

    private ICaseNextNodeView view;
    private CaseNextNodeModelImpl actionModel;

    public CaseNextNodePresenterImpl(ICaseNextNodeView caseNextNodeView) {
        this.view = caseNextNodeView;
        actionModel = new CaseNextNodeModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(String caseState) {
        addSubscription(actionModel.sendRetrofitRequest(caseState));
    }

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

    @Override
    public void onSuccess(CaseNextNodeBean resultBean) {
        view.obtainNextNodeData(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
