package com.gh.gamecenter.message.entity

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

@Parcelize
data class SortedMessageEntity(
    @SerializedName("_id")
    var id: String = "",
    var type: String = "", // system/user/announcement/service/game/bbs
    var icon: String = "",
    var title: String = "",
    var game: SimpleGame? = null,
    @SerializedName("latest_content")
    var latestContent: LatestContent? = null,
    @SerializedName("unread_count")
    var unreadCount: Int = 0,
    var setting: Setting = Setting(),
    var link: String = ""
) : Parcelable {

    @IgnoredOnParcel
    val typeChinese: String
        get() = when (type) {
            "system" -> "系统消息"
            "user" -> "互动消息"
            "announcement" -> "运营消息"
            "service" -> "客服消息"
            "game" -> "游戏消息"
            "bbs" -> "论坛消息"
            else -> ""
        }

    @Parcelize
    data class LatestContent(
        var text: String = "",
        var time: Long = 0L
    ) : Parcelable

    @Parcelize
    data class Setting(
        var top: Boolean = false,
        @SerializedName("do_not_disturb")
        var doNotDisturb: Boolean = false
    ) : Parcelable
}
