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

import com.casic.dcms.bean.CaseSmallClassBean;
import com.casic.dcms.listener.OnGetSmallClassListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.CaseSmallClassModelImpl;
import com.casic.dcms.mvp.presenter.ICaseSmallClassPresenter;
import com.casic.dcms.mvp.view.ICaseSmallClassView;

public class CaseSmallClassPresenterImpl extends BasePresenter implements ICaseSmallClassPresenter, OnGetSmallClassListener {

    private final ICaseSmallClassView view;
    private final CaseSmallClassModelImpl actionModel;

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

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

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

    @Override
    public void onFailure(Throwable throwable) {

    }

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