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

import com.casic.dcms.bean.WellListBean;
import com.casic.dcms.listener.OnGetWellListListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.WellListModelImpl;
import com.casic.dcms.mvp.presenter.IWellListPresenter;
import com.casic.dcms.mvp.view.IWellListView;

public class WellListPresenterImpl extends BasePresenter implements IWellListPresenter, OnGetWellListListener {

    private final IWellListView view;
    private final WellListModelImpl model;

    public WellListPresenterImpl(IWellListView wellListView) {
        this.view = wellListView;
        model = new WellListModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(int offset) {
        addSubscription(model.sendWellListRequest(offset));
    }

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

    @Override
    public void onSuccess(WellListBean resultBean) {
        view.obtainDeviceResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
