package com.gh.gamecenter.entity

import android.os.Parcelable
import com.gh.gamecenter.qa.entity.SourceEntity
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize

@Parcelize
open class VideoEntity(
    @SerializedName("_id")
    val id: String = "",
    @SerializedName("_seq")
    var shortId: String = "",
    var title: String = "",
    var poster: String = "",
    val url: String = "",
    @SerializedName("game_id")
    val gameId: String = "",
    @SerializedName("game_name")
    private var mGameName: String = "",
    @SerializedName("name_suffix")
    var nameSuffix: String? = null,
    @SerializedName("game_icon")
    val gameIcon: String = "",
    @SerializedName("category_id")
    var categoryId: String = "",
    var vote: Int = 0,
    @SerializedName("vote_recently")
    val voteRecently: Int = 0,
    @SerializedName("comment_count")
    var commentCount: Int = 0,
    val user: UserEntity = UserEntity(),
    val me: MeEntity = MeEntity(),
    val size: Long = 0,
    val length: Long = 0,
    // 有三种状态 pass通过，fail未通过，pending审核中
    var status: String = "",
    val format: String = "Mp4",
    @SerializedName("tag_id")
    var tagsId: List<String> = ArrayList(),
    @SerializedName("game_active")
    val gameActive: Boolean = false,//游戏是否被隐藏 false隐藏
    var game: GameEntity? = null,
    @SerializedName("share")
    var shareCount: Int = 0,//分享数量 v3.7.5新增
    val time: Time = Time(),
    var watched: Boolean = false,

    val watermark: Boolean = false,
    val audit: Boolean = false,
    val original: String = "",//是否原创 yes/no 默认为空字符串
    val source: String = "",//转载来源, 当 original=yes
    @SerializedName("tag_activity_name")
    val tagActivityName: String = "",
    @SerializedName("tag_activity_id")
    var tagActivityId: String = "",//活动标签的id, 当 original=true
    @SerializedName("_source")
    val ipSource: SourceEntity? = null,

    //本地数据
    @IgnoredOnParcel
    var videoIsMuted: Boolean = false,//是否静音标记
    @IgnoredOnParcel
    var isFirstBind: Boolean = false
) : Parcelable {

    @IgnoredOnParcel
    val gameName: String
        get() = mGameName.removeSuffix(".") + (nameSuffix ?: "")

    fun getThumb() = "$url?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,ar_auto"

    @Parcelize
    data class Time(val upload: Long = 0) : Parcelable
}