package com.gh.gamecenter.entity

import androidx.room.Entity
import androidx.room.PrimaryKey
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.TagStyleEntity
import com.google.gson.annotations.SerializedName

@Entity
data class HistoryGameEntity(
    @PrimaryKey
    var id: String = "",
    var icon: String? = null,
    var iconSubscript: String? = null,
    var iconFloat: IconFloat? = null,
    var name: String? = null,
    var brief: String? = null,

    var tag: ArrayList<String>? = null,
    var isLibaoExist: Boolean = false,

    var subtitle: String = "",
    var subtitleStyle: TagStyleEntity? = null,

    @SerializedName("tag_style")
    var tagStyle: ArrayList<TagStyleEntity> = ArrayList(),

    var orderTag: Long = 0,
    var des: String? = null
) {

    fun convertHistoryGameEntityToGameEntity(): GameEntity {
        val gameEntity = GameEntity()

        gameEntity.id = id
        gameEntity.brief = brief
        gameEntity.des = des
        gameEntity.rawIcon = icon
        gameEntity.iconSubscript = iconSubscript
        gameEntity.iconFloat = iconFloat
        gameEntity.subtitle = subtitle
        gameEntity.subtitleStyle = subtitleStyle
        gameEntity.name = name
        gameEntity.tagStyle = tagStyle
        gameEntity.isLibaoExists = isLibaoExist
        gameEntity.setTag(tag)
        return gameEntity
    }
}