package com.ym.game.presenter

import com.ym.game.contract.DailyCashContract
import com.ym.library.module.DialyCashDataEntity
import com.ym.library.net.BaseObserver
import com.ym.library.net.GameApiClient
import com.ym.library.net.RxSchedulers

class DailyCashPresenter : DailyCashContract.Presenter {

    var mView: DailyCashContract.View

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

    override fun getDailyCashList() {
        GameApiClient.gameApi.getDailyCash().compose(
            RxSchedulers.observableIO2Main()
        ).subscribe(object : BaseObserver<List<DialyCashDataEntity>>() {
            override fun onSuccess(result: List<DialyCashDataEntity>?) {
                //  mView?.taskListResult(result)
                if (result != null) {
                    mView?.DailyCashResult(result)
                }
            }

            override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
                // mView?.taskListResult(null)
            }
        })
    }
}