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

import com.casic.dcms.bean.WellDetailBean;
import com.casic.dcms.listener.OnGetWellDetailListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.WellDetailModelImpl;
import com.casic.dcms.mvp.presenter.IWellDetailPresenter;
import com.casic.dcms.mvp.view.IWellDetailView;

public class WellDetailPresenterImpl extends BasePresenter implements IWellDetailPresenter, OnGetWellDetailListener {

    private final IWellDetailView view;
    private final WellDetailModelImpl actionModel;

    public WellDetailPresenterImpl(IWellDetailView detailView) {
        this.view = detailView;
        actionModel = new WellDetailModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(String where) {
        addSubscription(actionModel.sendWellDetailRequest(where));
    }

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

    @Override
    public void onSuccess(WellDetailBean resultBean) {
        view.obtainWellDetailResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
