package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.CommonSentenceBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.CaseCommonSentenceModelImpl;
import com.casic.dcms.mvp.view.ICaseCommonSentenceView;

public class CaseCommonSentencePresenterImpl extends BasePresenter implements ICaseCommonSentencePresenter,
        CaseCommonSentenceModelImpl.OnGetCommonSentenceListener {

    private ICaseCommonSentenceView view;
    private CaseCommonSentenceModelImpl actionModel;

    public CaseCommonSentencePresenterImpl(ICaseCommonSentenceView commonSentenceView) {
        this.view = commonSentenceView;
        actionModel = new CaseCommonSentenceModelImpl(this);
    }

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

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

    @Override
    public void onSuccess(CommonSentenceBean resultBean) {
        view.obtainCommonSentenceData(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
