package com.casic.dcms.mvp.presenter;

import com.casic.dcms.bean.ActionResultBean;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.PushRegisterModelImpl;
import com.casic.dcms.mvp.view.IPushRegisterView;

public class PushRegisterPresenterImpl extends BasePresenter implements IPushRegisterPresenter,
        PushRegisterModelImpl.OnRegisterListener {

    private IPushRegisterView view;
    private PushRegisterModelImpl model;

    public PushRegisterPresenterImpl(IPushRegisterView pushRegisterView) {
        this.view = pushRegisterView;
        model = new PushRegisterModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(String clientid) {
        addSubscription(model.sendRetrofitRequest(clientid));
    }

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

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

    @Override
    public void onFailure(Throwable throwable) {

    }
}
