package com.gh.gamecenter.category

import android.app.Application
import com.gh.gamecenter.common.baselist.ListViewModel
import com.gh.gamecenter.entity.CategoryEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import io.reactivex.Observable

class CategoryDirectoryListViewModel(application: Application) :
    ListViewModel<CategoryEntity, CategoryEntity>(application) {

    var categoryId = ""

    override fun mergeResultLiveData() {
        mResultLiveData.addSource(mListLiveData, mResultLiveData::postValue)
    }

    override fun provideDataObservable(page: Int): Observable<MutableList<CategoryEntity>> {
        return RetrofitManager.getInstance().api.getCategories(categoryId, page)
    }
}