package com.gh.gamecenter.entity

import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.feature.entity.MeEntity
import com.gh.gamecenter.feature.entity.SimpleGame
import com.google.gson.annotations.SerializedName

@Entity
data class ForumEntity(
    @PrimaryKey
    @SerializedName("_id")
    var id: String = "",
    var game: SimpleGame = SimpleGame(),
    var name: String = "",
    var icon: String = "",
    @SerializedName("is_follow")
    var isFollow: Boolean = false,
    //本地字段，判断是否是推荐论坛
    var isRecommend: Boolean = false,
    var orderTag: Long = 0,
    var unread: Boolean = false,
    var type: String = "", //game_bbs/official_bbs
    var me: MeEntity = MeEntity(),
    @Ignore
    var hot: Int = 0 // 热度值
) {

    val typeChinese: String get() = when (type) {
        "game_bbs" -> "游戏论坛"
        else -> "综合论坛"
    }
    
    fun transformUnreadEntity(): ForumUnreadEntity {
        val forumUnreadEntity = ForumUnreadEntity()
        forumUnreadEntity.id = id
        forumUnreadEntity.name = name
        forumUnreadEntity.unread = unread
        return forumUnreadEntity
    }
}

data class ForumBannerEntity(
    @SerializedName("placeholder_color")
    var placeholderColor: String = ""
) : LinkEntity()