package com.gh.gamecenter.gamedetail.entity

import android.os.Parcelable
import androidx.annotation.Keep
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.entity.*
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize

@Keep
data class DetailEntity(
    var type: String = "",
    @SerializedName("notice")
    var noticeList: ArrayList<NoticeEntity>? = null,
    var des: String? = null,// 介绍文案
    var gallery: ArrayList<String>? = null,
    @SerializedName("count")
    var videoCount: Int = 0,//视频数量
    var video: ArrayList<GameDetailEntity.Video>? = null,
    var comment: ArrayList<RatingComment>? = null,
    var info: GameInfo? = null,
    var update: UpdateContent? = null,
    var libao: ArrayList<LibaoEntity>? = null,
    @SerializedName("related_version")
    var relatedVersion: ArrayList<GameDetailEntity.RelatedVersion>? = null,
    var server: GameDetailServer? = null,
    @SerializedName("image_recommend")
    var imageRecommend: LinkEntity? = null,
    @SerializedName("custom_column")
    var customColumn: CustomColumn? = null,
    @SerializedName("related_game")
    var relatedGames: ArrayList<GameDetailRelatedGame>? = null,//原推荐游戏
    @SerializedName("download_game")
    var downloadGames: ArrayList<String>? = null,// 下载推荐
    @SerializedName("install_game")
    var installGames: ArrayList<String>? = null,// 安装推荐
    var recommendedGames: SubjectEntity? = null,
    var article: ArrayList<NewsEntity>? = null,
    @SerializedName("article_top")
    var articleTop: ArrayList<NewsEntity>? = null,
    @SerializedName("recommend_game_list")
    var recommendGameList: ArrayList<GameDetailRecommendGameEntity>? = null,
    //专题游戏单推荐
    @SerializedName("column_id")
    var columnId: String = "",
    @SerializedName("title")
    var columnTitle: String = "",
    @SerializedName("display.home")
    var displayHome: String = "",//右上角文案
    @SerializedName("size.index")
    var gameCount: Int = 0,//显示多少条数
    @SerializedName("display.more_link")
    var moreLink: LinkEntity? = null,
    @SerializedName("column_game")
    var columnGames: ArrayList<GameEntity>? = null,

    // 仅用于镜像
    @SerializedName(value = "new_tag_style")
    var tagStyle: ArrayList<TagStyleEntity> = ArrayList(),
    // 仅用于镜像
    var apk: ArrayList<ApkEntity>? = ArrayList(),
    // 仅用于镜像
    @SerializedName("custom_columns")
    var customColumnList: ArrayList<CustomColumn>? = null,
    // 仅用于镜像
    var manufacturer: String? = null,
    // 仅用于镜像
    @SerializedName("privacy_policy_url")
    var privacyPolicyUrl: String? = null,

    @SerializedName("detail_dialogs")
    var detailDialogs: ArrayList<GameEntity.Dialog> = arrayListOf(),

    // 是否与前一个 item 连成整体，是否与后一个 item 连成整体
    var shouldBoundWithPreviousItem: Boolean = false,
    var shouldBoundWithNextItem: Boolean = false,
    // 上下 padding
    var paddingTop: Int = 0,
    var paddingBottom: Int = 0
) {

    enum class Type(val value: String) {
        IMAGE_GALLERY("gallery"),
        VIDEOS("video"),
        COMMENTS("comment"),
        GAME_INFO("info"),
        UPDATE_CONTENT("update"),
        LATEST_SERVER("server"),
        RELATED_VERSION("related_version"),
        IMAGE("image_recommend"),
        LIBAO("libao"),
        INFO_GUIDE("article"),
        RECOMMENDED_GAMES("related_game"),
        CUSTOM_COLUMN("custom_column"),
        DES("des"),
        NOTICE("notice"),
        RECOMMEND_GAME_LIST("recommend_game_list"),
        COLUMN_RECOMMEND("column_recommend"),
    }
}

//公告文章
@Keep
data class NoticeEntity(
    @SerializedName("_id")
    var id: String = "",
    var title: String = "",
    var type: String = "",
    var time: String = "",
    var overtime: String = ""
)

@Keep
data class CustomColumn(
    @SerializedName("_id")
    var id: String = "",
    var name: String = "",
    @SerializedName("show_name")
    var showName: Boolean? = true,
    @SerializedName("name_icon")
    var nameIcon: String? = "",
    @SerializedName("name_link")
    var nameLink: LinkEntity? = null,
    var link: LinkEntity? = null,
    var order: Long? = 0, // 权重
    var title: Title? = null,
    var des: String? = "",
    @SerializedName("tag_des")
    var desFull: String? = null,
    @SerializedName("tag_des_brief")
    var desBrief: String? = "",
    @SerializedName("show_des_type")
    var showDesType: String? = "",
    @SerializedName("show_des_row_num")
    var showDesRowNum: Int? = 3,
    @SerializedName("show_info_tag")
    var showInfoTag: Boolean? = false,
    @SerializedName("show_info_tag_des")
    var showInfoTagDes: Boolean? = false,
    @SerializedName("show_info_tag_des_type")
    var showInfoTagDesType: String? = "", // first_expand (用于默认展开), collapse, expand
    @SerializedName("info_tag")
    var infoTag: List<TagEntity>? = listOf(),
    var time: Long? = 0,

    var isHtmlDes: Boolean? = true,
    // 是否显示自定义栏目的提示浮窗 (本地字段)
    var showExpandTagsHint: Boolean? = false
)

@Keep
data class Title(var icon: String, var value: String, var color: String)

@Keep
@Parcelize
data class GameInfo(
    @SerializedName("download_status")
    var downloadStatus: String = "",// 下载状态，on/off/appointment/link
    @SerializedName("top_tag")
    var topTags: ArrayList<TagStyleEntity> = ArrayList(),
    var version: String = "",
    @SerializedName("request_update_status")
    var requestUpdateStatus: String = "",// 游戏求更新开关，on/off
    @SerializedName("update_time")
    var updateTime: Long = 0,
    var size: String = "",
    var contact: Contact? = null,
    var manufacturer: String = "",// 对应manufacturer_type 的值
    var permissions: List<Permission>? = null,
    @SerializedName("privacy_policy_url")
    var privacyPolicyUrl: String? = null,
    @SerializedName("recommend_age")
    var recommendAge: String = "",//适龄等级
    @SerializedName("manufacturer_type")
    var manufacturerType: String = "",// manufacturer(厂商)/publisher(发行商)/developer(开发商)
    var publisher: String = "",//manufacturer_type 值为 manufacturer / publisher，或该字段值为空时，不返回该字段
    var developer: String = "",//manufacturer_type 值为 manufacturer / developer，或该字段值为空时，不返回该字段
    var supplier: String = "",//供应商
    @SerializedName("credit_code")
    var creditCode: String = ""//统一社会信用代码
) : Parcelable

@Keep
@Parcelize
data class Contact(
    var hint: String = "",// 提示文案
    var key: String = "",// QQ群的key，类型为qqqun时，字段存在
    var qq: String = "",// QQ号码 或 QQ群号码
    var type: String = ""// qq/qqqun
) : Parcelable

@Keep
data class UpdateContent(
    @SerializedName("history_apk_count")
    val historyApkCount: Int = 0,
    @SerializedName("history_apk_status")
    var historyApkStatus: String = "",
    @SerializedName("update_des")
    val updateDes: String = ""
)

@Keep
@Parcelize
data class Permission(
    var name: String = "",
    var details: List<String> = arrayListOf(),
    var detail: List<PermissionDetail>? = arrayListOf()
) : Parcelable {
    @Keep
    @Parcelize
    data class PermissionDetail(val title: String?, var intro: String?) : Parcelable
}