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

import com.casic.dcms.bean.ActionResultBean;
import com.casic.dcms.listener.OnActionResultListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.PushRegisterModelImpl;
import com.casic.dcms.mvp.presenter.IPushRegisterPresenter;
import com.casic.dcms.mvp.view.IPushRegisterView;

public class PushRegisterPresenterImpl extends BasePresenter implements IPushRegisterPresenter, OnActionResultListener {

    private final IPushRegisterView view;
    private final PushRegisterModelImpl model;

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

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

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

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

    @Override
    public void onFailure(Throwable throwable) {

    }
}
