package com.gh.gamecenter.feature.entity

import android.os.Parcelable
import com.gh.gamecenter.common.annotation.SyncPage
import com.gh.gamecenter.common.syncpage.SyncFieldConstants
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize

/**
 * Created by khy on 11/12/17.
 */
@Parcelize
data class MeEntity(
    @SerializedName("is_community_voted")
    var isCommunityVoted: Boolean = false,

    @SerializedName("is_user_invite")
    var isUserInvite: Boolean = false,

    @SyncPage(syncNames = [SyncFieldConstants.ANSWER_VOTE])
    @SerializedName("is_answer_voted")
    var isAnswerVoted: Boolean = false,

    @SerializedName("is_answer_opposed")
    var isAnswerOpposed: Boolean = false,  // 是否已经踩过回答

    @SerializedName(
        value = "is_answer_own",
        alternate = ["is_community_article_own", "is_question_own", "is_video_own", "is_game_list_own"]
    )
    var isContentOwner: Boolean = false, // 是否是当前内容(回答/社区文章/问题/视频/游戏单)的拥有者

    @SerializedName(
        value = "is_community_article_top",
        alternate = ["is_question_top", "is_video_top"]
    )
    var isCommunityTop: Boolean = false, // 此帖子是否是置顶帖子

    @SerializedName("is_answer_favorite")
    var isAnswerFavorite: Boolean = false,

    @SerializedName("has_draft")
    var hasDraft: Boolean = false,

    @SerializedName("is_question_followed")
    var isQuestionFollowed: Boolean = false,

    @SerializedName("answer_id")
    var myAnswerId: String? = null, // 有自身发的评论Id

    @SerializedName("is_part_time")
    var isPartTime: Boolean = false,

    @SerializedName("is_game_concerned")
    var isGameConcerned: Boolean = false,

    @SerializedName("is_game_related_concerned")
    var isGameRelatedConcerned: Boolean = false, // 关联关注

    @SerializedName("is_article_favorite")
    var isArticleFavorite: Boolean = false,

    @SerializedName("is_question_favorite")
    var isQuestionFavorite: Boolean = false,

    @SerializedName("is_toolkit_favorite")
    var isToolkitFavorite: Boolean = false,

    @SerializedName(
        "is_comment_own",
        alternate = ["is_answer_commented", "is_community_article_commented", "is_video_commented", "is_question_commented"]
    )
    var isCommentOwner: Boolean = false, // 是否是当前评论的拥有者

    @SyncPage(syncNames = [SyncFieldConstants.ARTICLE_COMMENT_VOTE])
    @SerializedName(
        "is_comment_voted",
        alternate = ["is_answer_comment_voted", "is_video_comment_voted", "is_community_article_comment_voted", "is_question_comment_voted", "is_game_list_voted"]
    )
    var isCommentVoted: Boolean = false, // 是否已经点赞过当前评论

    @SerializedName("is_version_requested")
    var isVersionRequested: Boolean = false,

    @SyncPage(syncNames = [SyncFieldConstants.IS_FOLLOWER])
    @SerializedName("is_follower", alternate = ["is_follow"])
    var isFollower: Boolean = false, // 是否已经关注该用户

    @SerializedName("is_favorite", alternate = ["favorite"])
    var isFavorite: Boolean = false,

    @SyncPage(syncNames = [SyncFieldConstants.ARTICLE_VOTE])
    @SerializedName("is_vote")
    var isCommunityArticleVote: Boolean = false,

    @SerializedName("is_oppose")
    var isCommunityArticleOppose: Boolean = false,

    @SyncPage(syncNames = [SyncFieldConstants.GAME_COLLECTION_VOTE])
    @SerializedName("is_voted", alternate = ["vote"])
    var isVoted: Boolean = false,

    @SerializedName("is_commented")
    var isCommented: Boolean = false,

    @SerializedName("libao")
    var userDataLibaoList: List<UserDataLibaoEntity>? = null,

    @SerializedName("is_video_favorite")
    var isVideoFavorite: Boolean = false,

    @SerializedName("is_moderator")
    val isModerator: Boolean = false,

    @SerializedName("is_appointment")
    var isGameReserved: Boolean = false, // 是否已预约了游戏

    @SerializedName("is_smart_invite")
    var isSmartInvited: Boolean = false, // 是否在具体问题详情页面点了智能邀请按钮

    @SerializedName("permissions")
    val moderatorPermissions: Permissions = Permissions(),

    @SerializedName(
        "is_answer_author",
        alternate = ["is_community_article_author", "is_question_author", "is_video_author"]
    )
    val isContentAuthor: Boolean = false, //用于判断当前登录用户是否是此评论关联的回答/文章/问题/视频的作者

    @SerializedName("article_draft")
    var articleDraft: ArticleDraftEntity? = null,//帖子详情可能返回草稿

    @SerializedName("question_draft")
    var questionDraft: QuestionDraftEntity? = null,//问题详情可能返回草稿

    @SerializedName("is_follow_bbs")
    var isFollowForum: Boolean = false,

    @SerializedName("request_version_apk_uploaded")
    var requestsVersionApkUploaded: Boolean = false,
) : Parcelable

@Parcelize
class Permissions(
    // -1 为无权限，0 为初级权限，1 为高级权限

    // 回答相关
    @SerializedName("choiceness-answer")
    var highlightAnswer: Int = GUEST, // 将回答加入精选列表

    @SerializedName("fold-answer")
    var foldAnswer: Int = GUEST, // 折叠回答

    @SerializedName("hide-answer")
    var hideAnswer: Int = GUEST, // 隐藏回答

    @SerializedName("top-answer-comment")
    var topAnswerComment: Int = GUEST, // 置顶回答的评论

    @SerializedName("hide-answer-comment")
    var hideAnswerComment: Int = GUEST, // 隐藏回答的评论

    @SerializedName("cancel-choiceness-answer")
    var cancelChoicenessAnswer: Int = GUEST,  //取消回答精选权限

    // 问题相关
    @SerializedName("update-question-tag")
    var updateQuestionTag: Int = GUEST,  // 修改问题标签：只修改标签

    @SerializedName("update-question")
    var updateQuestion: Int = GUEST, // 修改问题：除标签以外的字段

    @SerializedName("hide-question")
    var hideQuestion: Int = GUEST, // 隐藏问题

    @SerializedName("get-modified-versions")
    var getModifiedVersions: Int = GUEST,  // 查看问题的修改历史

    @SerializedName("update-question-activity-tag")
    var updateQuestionActivityTag: Int = GUEST,  // 修改问题活动标签

    // 文章相关
    @SerializedName("update-community-article")
    var updateCommunityArticle: Int = GUEST,  // 修改文章

    @SerializedName("choiceness-community-article")
    var highlightCommunityArticle: Int = GUEST,  // 加精文章

    @SerializedName("hide-community-article")
    var hideCommunityArticle: Int = GUEST, // 隐藏文章

    @SerializedName("top-community-article-comment")
    var topCommunityArticleComment: Int = GUEST, // 置顶文章评论

    @SerializedName("hide-community-article-comment")
    var hideCommunityArticleComment: Int = GUEST, // 隐藏文章评论

    @SerializedName("cancel-choiceness-community-article")
    var cancelHighlightCommunityArticle: Int = GUEST, // 取消精选

    @SerializedName("update-community-article-activity-tag")
    var updateArticleActivityTag: Int = GUEST,  // 修改文章活动标签

    @SerializedName("cancel-top-community-article")
    var cancelTopCommunityArticle: Int = GUEST,  // 普通帖-取消置顶权限

    @SerializedName("top-community-article")
    var topCommunityArticle: Int = GUEST,  // 普通帖-置顶权限

    @SerializedName("cancel-top-question")
    var cancelTopQuestion: Int = GUEST,  // 提问帖-取消置顶权限

    @SerializedName("top-question")
    var topQuestion: Int = GUEST,  // 提问帖-置顶权限

    @SerializedName("cancel-top-video")
    var cancelTopVideo: Int = GUEST,  // 视频帖-取消置顶权限

    @SerializedName("top-video")
    var topVideo: Int = GUEST,  // 视频帖-置顶权限

    //视频相关
    @SerializedName("choiceness-video")
    var highlightVideo: Int = GUEST,  // 加精视频帖

    @SerializedName("cancel-choiceness-video")
    var cancelHighlightVideo: Int = GUEST,  // 取消加精视频帖

    @SerializedName("hide-video")
    var hideVideo: Int = GUEST,  //隐藏视频帖

    @SerializedName("update-video-activity-tag")
    var updateVideoActivityTag: Int = GUEST  // 修改视频活动标签
) : Parcelable {
    companion object {
        // -1 为无权限，0 为初级权限，1 为高级权限
        const val ADMIN = 1
        const val REPORTER = 0
        const val GUEST = -1
    }
}