package com.gh.gamecenter.feature.entity

import android.os.Parcelable
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.entity.LinkEntity
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize

@Parcelize
open class ForumVideoEntity(
    @SerializedName("_id")
    var id: String = "",
    @SerializedName("_seq")
    var shortId: String = "",
    var title: String = "",
    var des: String = "",
    var poster: String = "",
    var url: String = "",
    val user: PersonalEntity = PersonalEntity(),
    val me: MeEntity = MeEntity(),
    val size: Long = 0,
    var length: Long = 0,
    // 有三种状态 pass通过，fail未通过，pending审核中
    var status: String = "",
    val format: String = "Mp4",
    var game: GameEntity? = null,
    @SerializedName("tag_activity_id")
    var tagActivityId: String = "",//活动标签的id
    @SerializedName("tag_activity_name")
    var tagActivityName: String = "",
    @SerializedName("bbs_id")
    var bbsId: String = "",
    @SerializedName("game_id")
    var gameId: String = "",
    var type: String = "",
    var share: Int = 0,
    var time: Time = Time(),
    @SerializedName("video_info")
    var videoInfo: VideoInfo = VideoInfo(),
    @SerializedName("is_jx")
    var isHighlighted: Boolean = true,
    var bbs: CommunityEntity? = null,
    var count: Count = Count(),
    val original: String = "",//是否原创 //是否原创 yes/no 默认为空字符串
    val source: String = "",//转载来源, 当 original=yes
    @SerializedName("choiceness_status")
    var choicenessStatus: String = "",// apply（申请）, pass  already（已精选） cancel  not_yet（未精选）
    @IgnoredOnParcel
    var videoIsMuted: Boolean = false, //是否静音标记
    var duration: String = "",
    @SerializedName("_source")
    val ipSource: SourceEntity? = null,
    @SerializedName("activity_tag")
    val activityTag: ActivityTagEntity? = null,
    var sections: List<SectionEntity> = ArrayList()
) : Parcelable {

    fun getSimplifyChoicenessStatus(): String {
        return when (choicenessStatus) {
            "already" -> "pass"
            "not_yet" -> "cancel"
            else -> choicenessStatus
        }
    }
    @Parcelize
    class Time(val upload: Long = 0, val audit: Long = 0, val update: Long = 0) : Parcelable

    @Parcelize
    class SectionEntity(
        @SerializedName("_id")
        val id: String = "",
        val name: String = ""
    ) : Parcelable

    @Parcelize
    class ActivityTagEntity(
        @SerializedName("_id")
        val id: String = "",
        val name: String = "",
        val link: LinkEntity? = null
    ) : Parcelable
}