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

import com.casic.dcms.bean.LightMapBean;
import com.casic.dcms.listener.OnGetLightMapListListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.LightMapModelImpl;
import com.casic.dcms.mvp.presenter.ILightMapPresenter;
import com.casic.dcms.mvp.view.ILightMapView;

public class LightMapPresenterImpl extends BasePresenter implements ILightMapPresenter, OnGetLightMapListListener {

    private final ILightMapView view;
    private final LightMapModelImpl actionModel;

    public LightMapPresenterImpl(ILightMapView lightMapView) {
        this.view = lightMapView;
        actionModel = new LightMapModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest() {
        addSubscription(actionModel.sendLightOnMapRequest());
    }

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

    @Override
    public void onSuccess(LightMapBean resultBean) {
        view.obtainLightResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
