package com.ym.chat.presenter

import android.util.Log
import com.ym.chat.contract.ChatContract
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver

class ChatPresenter : ChatContract.Presenter {
    private val mView: ChatContract.View

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

    override fun getMessageList(
        assistFlags: String,
        startIndex: String,
        timeStamp: String,
        topStartIndex: String,
        topTimeStamp: String
    ) {
        ApiClient.homeApi.getMessageList(assistFlags, startIndex, timeStamp, topStartIndex, topTimeStamp)
            .compose(RxSchedulers.observableIO2Main())
            .subscribe(object : BaseObserver<Any>() {
                override fun onSuccess(result: Any?) {

                }

                override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
                    Log.e("MXL", "ERROR" + code + errorMsg)
                }
            })
    }
}