package com.zxhl.cms.pay.presenter

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.video.MemberEntity
import com.zxhl.cms.pay.contract.CoinStoreContract
import com.zxhl.cms.pay.contract.VipPayContract

/**
 * @author (wangXuewei)
 * @datetime 2022-04-13 10:29 GMT+8
 * @detail :
 */
class VipPayPresenter:VipPayContract.Presenter {

    private val mView: VipPayContract.View

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

    override fun getVipPayList() {
        ApiClient.videoInfoApi.getPayConfig("vip").compose(RxSchedulers.observableIO2Main())
            .subscribe(object : BaseObserver<MemberEntity>() {
                override fun onSuccess(result: MemberEntity?) {
                    if (!result?.goodsList.isNullOrEmpty()){
                        mView?.setVipPayList(result?.goodsList)
                    }
                }

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