package com.wdkl.ncs.android.middleware.logic.presenter.callingbed

import com.enation.javashop.net.engine.plugin.connection.ConnectionQuality
import com.enation.javashop.net.engine.plugin.exception.ExceptionHandle
import com.wdkl.ncs.android.lib.base.RxPresenter
import com.wdkl.ncs.android.lib.utils.ConnectionObserver
import com.wdkl.ncs.android.middleware.di.MiddlewareDaggerComponent
import com.wdkl.ncs.android.middleware.logic.contract.callingbed.DoctorOrderFragmentContract
import io.reactivex.disposables.Disposable
import javax.inject.Inject

class DoctorOrderFragmentPresenter @Inject constructor() : RxPresenter<DoctorOrderFragmentContract.View>(), DoctorOrderFragmentContract.Presenter  {

    /**
     * @Name  observer
     * @Type  ConnectionObserver
     * @Note  数据监听者
     */
    private val observer = object : ConnectionObserver<ArrayList<Any>>() {
        override fun onStartWithConnection() {
            providerView()
        }

        override fun onNextWithConnection(result: ArrayList<Any>, connectionQuality: ConnectionQuality) {
            providerView().complete()
            providerView().showData(result)
        }

        override fun onErrorWithConnection(error: ExceptionHandle.ResponeThrowable, connectionQuality: ConnectionQuality) {
            providerView().onError(error.customMessage)
        }

        override fun attachSubscribe(var1: Disposable) {
            addDisposable(var1)
        }
    }


    override fun bindDagger() {
        MiddlewareDaggerComponent.component.inject(this)
    }

    override fun loadData() {
        //
    }

}