package com.zxbw.modulemain.presenter

import com.zxbw.modulemain.contract.CardVoucherContract
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.qy.RightsDetailEntity

class CardVoucherPresenter : CardVoucherContract.Presenter {
    private val mView: CardVoucherContract.View

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

    override fun getCardList(brandName: String) {
        ApiClient.homeApi.getQyJgqCardDetail(brandName,"2").compose(RxSchedulers.observableIO2Main())
            .subscribe(object : BaseObserver<List<RightsDetailEntity>>() {
                override fun onSuccess(result: List<RightsDetailEntity>?) {
                    if (!result.isNullOrEmpty()){
                        mView.setData(result)
                    }
                }

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

                }
            })
    }
}