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

import com.casic.dcms.bean.HighEventBean;
import com.casic.dcms.listener.OnGetHighEventListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.HighEventModelImpl;
import com.casic.dcms.mvp.presenter.IHighEventPresenter;
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, OnGetHighEventListener {

    private final IHighEventView view;
    private final HighEventModelImpl actionModel;

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

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

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

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

    @Override
    public void onFailure(Throwable throwable) {

    }
}
