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

import com.casic.dcms.bean.OnlinePersonBean;
import com.casic.dcms.listener.OnGetOnlinePersonListener;
import com.casic.dcms.mvp.BasePresenter;
import com.casic.dcms.mvp.model.impl.PersonOnlineModelImpl;
import com.casic.dcms.mvp.presenter.IPersonOnlinePresenter;
import com.casic.dcms.mvp.view.IPersonOnlineView;

public class PersonOnlinePresenterImpl extends BasePresenter implements IPersonOnlinePresenter, OnGetOnlinePersonListener {

    private final IPersonOnlineView view;
    private final PersonOnlineModelImpl model;

    public PersonOnlinePresenterImpl(IPersonOnlineView onlineView) {
        this.view = onlineView;
        model = new PersonOnlineModelImpl(this);
    }

    @Override
    public void onReadyRetrofitRequest(String deptid, String roleTips, String isOnLine) {
        addSubscription(model.sendPersonOnlineRequest(deptid, roleTips, isOnLine));
    }

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

    @Override
    public void onSuccess(OnlinePersonBean resultBean) {
        view.onlineResult(resultBean);
    }

    @Override
    public void onFailure(Throwable throwable) {

    }
}
