package com.gh.gamecenter.common.entity

import android.os.Parcelable
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize

@Keep
@Parcelize
data class ExposureEntity(
    @SerializedName("game_id")
    val gameId: String? = "",
    @SerializedName("subject_id")
    val subjectId: String? = null, // 专题 id
    @SerializedName("carousel_id")
    val carouselId: String? = "", // 轮播图 id
    val gameName: String? = "",
    val gameVersion: String? = "",
    val sequence: Int? = 0,
    val outerSequence: Int? = 0,
    val platform: String? = null,
    var isMirrorData: Boolean = false,
    @SerializedName("is_web_download")
    var isWebDownload: Boolean = false,
    val downloadType: String? = null,
    val downloadCompleteType: String? = null,
    @SerializedName("display_type")
    val displayType: String? = "",
    @SerializedName("is_platform_recommend")
    val isPlatformRecommend: Boolean? = false,

    // 外层内容 id (包括)
    // 1.  "test_server_id" : "", // 开测表 ID
    // 2.  "block_id" : "", // 板块 ID
    // 3.  "category_id" : "", // 新分类1.0 ID
    // 4.  "category_v2_id" : "", // 新分类2.0 ID
    var containerId: String? = null,
    var containerType: String? = null,

    @SerializedName("test_server_id")
    var testServerId: String? = null,
    @SerializedName("block_id")
    var blockId: String? = null,
    @SerializedName("category_id")
    var categoryId: String? = null,
    @SerializedName("category_v2_id")
    var categoryV2Id: String? = null,
    @SerializedName("navigation_id")
    var navigationId: String? = null,

    // 专题详情的来源页面和来源 id
    @SerializedName("source_page")
    var sourcePage: String? = null,
    @SerializedName("source_page_id")
    var sourcePageId: String? = null,
    @SerializedName("source_page_name")
    var sourcePageName: String? = null,

    // 下载地址的 host 和 path
    var host: String? = null,
    var path: String? = null,

    // 统计启动弹窗相关数据用的 (ugly)
    @SerializedName("dialog_id")
    var welcomeDialogId: String? = null,
    @SerializedName("link_title")
    var welcomeDialogLinkTitle: String? = null,

    //v5.10 补充
    @SerializedName("control_type")
    var controlType: String? = null,
    @SerializedName("control_name")
    var controlName: String? = null,
    //跳转链接类型 如：游戏专题
    @SerializedName("control_link_type")
    var controlLinkType: String? = null,
    //跳转链接标题 如：热门好游
    @SerializedName("control_link_name")
    var controlLinkName: String? = null,
    @SerializedName("is_ad_data")
    var isAdData: Boolean = false,
) : Parcelable {

    fun setContainerInfo(id: String?, type: String?) {
        when (type) {
            TEST_SERVER_ID -> testServerId = id
            BLOCK_ID -> blockId = id
            CATEGORY_ID -> categoryId = id
            CATEGORY_V2_ID -> categoryV2Id = id
            NAVIGATION_ID -> navigationId = id
        }

        containerId = null
        containerType = null
    }

    companion object {
        const val TEST_SERVER_ID = "test_server_id"
        const val BLOCK_ID = "block_id"
        const val CATEGORY_ID = "category_id"
        const val CATEGORY_V2_ID = "category_v2_id"
        const val NAVIGATION_ID = "navigation_id"
    }
}