package com.ym.game.presenter

import com.ym.game.contract.RecordContract
import com.ym.library.module.WdHistoryEntity
import com.ym.library.net.BaseObserver
import com.ym.library.net.GameApiClient
import com.ym.library.net.RxSchedulers

class RecordPresenter : RecordContract.Presenter {
    var mView: RecordContract.View

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

    override fun getWdHistoryList() {
        GameApiClient.gameApi.getWdHistory().compose(
            RxSchedulers.observableIO2Main()
        ).subscribe(object : BaseObserver<List<WdHistoryEntity>>() {
            override fun onSuccess(result: List<WdHistoryEntity>?) {
                if (result != null) {
                    mView?.WdHistoryResult(result)
                }
            }

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

}