package com.gh.gamecenter.feature.entity

import com.gh.gamecenter.common.entity.CommunityEntity

interface CommunityItemData {
    var id: String
    var title: String
    var brief: String
    var images: List<String>
    var type: String
    var active: Boolean
    var commentable: Boolean
    var me: MeEntity
    var count: Count
    var communityId: String? // communityId + userId  社区推荐数据库存储专用,社区推荐接口不能给该字段
    var communityName: String?
    var community: CommunityEntity
    var user: UserEntity
    var status: String
    var questions: Questions
    var tagActivityName: String
    var sections: List<SectionEntity>

    val typeChinese: String
        get() = when (type) {
            "question" -> "提问帖"
            "community_article" -> "帖子"
            "video" -> "视频贴"
            else -> type
        }

    open fun vote(isVote: Boolean) {
        count.vote = if (isVote) {
            count.vote + 1
        } else {
            count.vote - 1
        }
        me.isVoted = isVote
    }
}