package com.gh.gamecenter.entity

import android.os.Parcelable
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.gh.gamecenter.room.converter.ActivityLabelListConverter
import com.gh.gamecenter.room.converter.SimpleGameListConverter
import com.gh.gamecenter.room.converter.TagInfoListConverter
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize

@Entity
@Parcelize
class GameCollectionDraft(
    @Ignore
    @SerializedName("_id")
    var id: String = "",
    @PrimaryKey
    var primaryKey: String = "", // db key
    @TypeConverters(TagInfoListConverter::class)
    var tags: ArrayList<TagInfoEntity>? = null,
    @TypeConverters(SimpleGameListConverter::class)
    var games: ArrayList<SimpleGame>? = null,
    @TypeConverters(ActivityLabelListConverter::class)
    @SerializedName("activity_tags")
    var activityTags: ArrayList<ActivityLabelEntity>? = null,
    var title: String = "",
    var intro: String = "",
    var cover: String = "",
    var display: String = "",//self_only: 仅自己可见
) : Parcelable {

    fun convertGameCollectionEntity(): GamesCollectionEntity {
        val entity = GamesCollectionEntity()
        entity.id = id
        entity.tags = tags
        entity.activityTags = activityTags
        entity.games = games
        entity.title = title
        entity.intro = intro
        entity.cover = cover
        entity.display = display
        return entity
    }
}
