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

import com.casic.dcms.bean.CaseNextNodeBean;
import com.casic.dcms.listener.OnGetCaseNextNodeListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.CaseNextNodeModelImpl;
import com.casic.dcms.mvp.presenter.ICaseNextNodePresenter;
import com.casic.dcms.mvp.view.ICaseNextNodeView;

public class CaseNextNodePresenterImpl extends BasePresenter implements ICaseNextNodePresenter, OnGetCaseNextNodeListener {

    private final ICaseNextNodeView view;
    private final CaseNextNodeModelImpl actionModel;

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

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

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

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

    @Override
    public void onFailure(Throwable throwable) {

    }
}
