package com.gh.gamecenter.gamedetail.fuli

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.ZoneContentEntity
import com.gh.gamecenter.feature.entity.ZoneEntity
import com.gh.gamecenter.common.mvvm.Resource

class FuLiViewModel : ViewModel() {

    val fuFiDataLD = MutableLiveData<Resource<MutableList<ZoneContentEntity>>>()
    var gameCommunity: CommunityEntity? = null

    var game: GameEntity? = null

    fun updateGameEntity(gameEntity: GameEntity) {
        game = gameEntity
    }

    fun updateUnifiedGameDetailEntity(zoneEntity: ZoneEntity) {
        if (zoneEntity.style == "default") {
            if (!zoneEntity.content.isNullOrEmpty()) {
                fuFiDataLD.postValue(Resource.success(zoneEntity.content))
            } else {//无内容
                fuFiDataLD.postValue(Resource.error(null))
            }
        }
    }
}
