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

import com.casic.dcms.bean.ToiletListBean;
import com.casic.dcms.listener.OnGetToiletListListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.ToiletListModelImpl;
import com.casic.dcms.mvp.presenter.IToiletListPresenter;
import com.casic.dcms.mvp.view.IToiletListView;

public class ToiletListPresenterImpl extends BasePresenter implements IToiletListPresenter, OnGetToiletListListener {

    private final IToiletListView view;
    private final ToiletListModelImpl actionModel;

    public ToiletListPresenterImpl(IToiletListView toiletListView) {
        this.view = toiletListView;
        actionModel = new ToiletListModelImpl(this);
    }

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

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

    @Override
    public void onSuccess(ToiletListBean resultBean) {
        view.obtainToiletListData(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
