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

import com.casic.dcms.bean.MapConfigBean;
import com.casic.dcms.listener.OnGetMapConfigListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.MapConfigModelImpl;
import com.casic.dcms.mvp.presenter.IMapConfigPresenter;
import com.casic.dcms.mvp.view.IMapConfigView;

public class MapConfigPresenterImpl extends BasePresenter implements IMapConfigPresenter, OnGetMapConfigListener {

    private final IMapConfigView view;
    private final MapConfigModelImpl actionModel;

    public MapConfigPresenterImpl(IMapConfigView mapConfigView) {
        this.view = mapConfigView;
        actionModel = new MapConfigModelImpl(this);
    }

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

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

    @Override
    public void onSuccess(MapConfigBean resultBean) {
        view.obtainMapConfig(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
