package com.gh.gamecenter.entity

import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.google.gson.annotations.SerializedName

data class HomeSubSlide(
    @SerializedName("link_type")
    val linkType: String = "",
    @SerializedName("link_id")
    val linkId: String = "",
    @SerializedName("link_text")
    val linkText: String = "",
    @SerializedName("link_community", alternate = ["community"])
    val community: CommunityEntity? = CommunityEntity(),
    @SerializedName("card_type")
    val cardType: String = "",
    @SerializedName("card_id")
    val cardId: String = "",
    @SerializedName("card_text")
    val cardText: String = "",
    @SerializedName("card_desc")
    val cardDesc: String = "",
    @SerializedName("card_data")
    val cardData: CardData = CardData(),
    val image: String = "",
    val title: String = ""
) {
    fun toLinkEntity(): LinkEntity {
        return if (linkType.isNotEmpty()) {
            LinkEntity(link = linkId, type = linkType, text = linkText, community = community)
        } else {
            LinkEntity(link = cardId, type = cardType, linkText = cardText)
        }
    }
}

data class CardData(
    var games: List<GameEntity> = arrayListOf(),
    @SerializedName("game_total")
    val gameTotal: GameTotal = GameTotal(),
    val stamp: String = ""
)

data class GameTotal(
    val vote: Int = 0,
    val hot: Int = 0,
    val favorite: Int = 0,
    val share: Int = 0,
    val comment: Int = 0,
    val game: Int = 0,
    @SerializedName("game_played")
    val gamePlayed: Int = 0
)
