package com.ym.game.presenter


import com.ym.game.contract.WareHouseContract
import com.ym.library.module.FlyBoxEntity
import com.ym.library.module.WateringTaskEntity
import com.ym.library.net.BaseObserver
import com.ym.library.net.GameApiClient
import com.ym.library.net.RxSchedulers

class WareHousePresenter: WareHouseContract.Presenter {
    var mView: WareHouseContract.View

    constructor(mView: WareHouseContract.View) {
        this.mView = mView
    }

    override fun getwarehouseData() {
        GameApiClient.gameApi.getWarehouseData().compose(
            RxSchedulers.observableIO2Main()
        ).subscribe(object : BaseObserver<List<FlyBoxEntity>>() {
            override fun onSuccess(result: List<FlyBoxEntity>?) {
                if (result != null) {
                    mView?.warehouseDataResult(result)
                }
            }

            override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
        })
    }
}