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

import com.casic.dcms.bean.CaseStatusBean;
import com.casic.dcms.listener.OnGetCaseStatusListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.CaseStatusModelImpl;
import com.casic.dcms.mvp.presenter.ICaseStatusPresenter;
import com.casic.dcms.mvp.view.ICaseStatusView;

public class CaseStatusPresenterImpl extends BasePresenter implements ICaseStatusPresenter, OnGetCaseStatusListener {

    private final ICaseStatusView view;
    private final CaseStatusModelImpl actionModel;

    public CaseStatusPresenterImpl(ICaseStatusView caseStatusView) {
        this.view = caseStatusView;
        actionModel = new CaseStatusModelImpl(this);
    }

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

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

    @Override
    public void onSuccess(CaseStatusBean resultBean) {
        view.obtainCaseStatusData(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
