package com.zxhl.main.page.view

import android.util.Log
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.box.GoodList
import com.zxhl.cms.net.model.box.GoodsPoolEntity


class ProtectionPoolPresenter:ProtectionPoolContract.Presenter {
    private val mView: ProtectionPoolContract.View


    constructor(mView: ProtectionPoolContract.View) {
        this.mView = mView
    }
    override fun getgoods(boxId: String?) {
        ApiClient.homeApi.getBoxGoods(boxId?:"")
            .compose(RxSchedulers.observableIO2Main())
            .subscribe(object : BaseObserver<GoodsPoolEntity>() {
                override fun onSuccess(result: GoodsPoolEntity?) {
                    if (result != null) {
                        mView.setData(result)
                    }
                }

                override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
                    Log.e("MXL","error"+errorMsg+"code"+code+e)
                }
            })
    }
}