package com.zxbw.modulemain.presenter

import android.content.Context
import android.text.TextUtils
import android.util.Log
import com.zxbw.modulemain.contract.HomeRecommendContract
import com.zxbw.modulemain.contract.LoginContract
import com.zxbw.modulemain.contract.RightsDetailContract
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.qy.JgqQyEntity
import com.zxhl.cms.net.model.qy.RightsDetailEntity
import com.zxhl.cms.net.model.uc.UserInfo
import com.zxhl.cms.utils.EventUtils
import com.zxhl.cms.utils.UserDataUtils

/**
 */
class RightsDetailPresenter:RightsDetailContract.Presenter {

    private val mView: RightsDetailContract.View

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

    override fun geRightsDetail(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.setRightsDetail(result)
                    }
                }

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

                }
            })
    }
}