package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.CaseSmallClassBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.CaseSmallClassModelImpl;
import com.casic.dcms.mvp.view.ICaseSmallClassView;

public class CaseSmallClassPresenterImpl extends BasePresenter implements ICaseSmallClassPresenter, CaseSmallClassModelImpl.OnGetSmallClassListener {

    private ICaseSmallClassView view;
    private CaseSmallClassModelImpl actionModel;

    public CaseSmallClassPresenterImpl(ICaseSmallClassView smallClassView) {
        this.view = smallClassView;
        actionModel = new CaseSmallClassModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(String eorc, String typeId) {
        addSubscription(actionModel.sendRetrofitRequest(eorc, typeId));
    }

    @Override
    public void onSuccess(CaseSmallClassBean resultBean) {
        view.obtainSmallClassData(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }

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