package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.HighEventBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.HighEventModelImpl;
import com.casic.dcms.mvp.view.IHighEventView;

/**
 * @author : Pengxh
 * @time : 2021/4/16 9:10
 * @email : 290677893@qq.com
 **/
public class HighEventPresenterImpl extends BasePresenter implements IHighEventPresenter, HighEventModelImpl.OnGetHighEventListener {

    private IHighEventView view;
    private HighEventModelImpl actionModel;

    public HighEventPresenterImpl(IHighEventView highEventView) {
        this.view = highEventView;
        actionModel = new HighEventModelImpl(this);
    }

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

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

    @Override
    public void onSuccess(HighEventBean resultBean) {
        view.obtainHighEventResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
