package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.ActionResultBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.CleanToiletModelImpl;
import com.casic.dcms.mvp.view.IPublicToiletView;

public class CleanToiletPresenterImpl extends BasePresenter implements ICleanToiletPresenter, CleanToiletModelImpl.OnGetCleanResultListener {

    private IPublicToiletView view;
    private CleanToiletModelImpl actionModel;

    public CleanToiletPresenterImpl(IPublicToiletView toiletView) {
        this.view = toiletView;
        actionModel = new CleanToiletModelImpl(this);
    }

    @Override
    public void onSuccess(ActionResultBean resultBean) {
        view.obtainCleanResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }

    @Override
    public void onReadyRetrofitRequest(String toiletId, String userId, String lng, String lat, String cleanTime, String photo, String workContent) {
        addSubscription(actionModel.sendRetrofitRequest(toiletId, userId, lng, lat, cleanTime, photo, workContent));
    }

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