package com.gh.gamecenter.forum.search

import androidx.core.text.HtmlCompat

interface CommunitySearchEventListener {

    fun onItemClick(contentId: String?, itemType: String?, title: String?, sequence: Int)

    fun onItemChildClick(contentId: String?, itemType: String?, title: String?, sequence: Int, button: String)

    fun onItemExposed(contentId: String?, itemType: String?, title: String?, sequence: Int)

    companion object {

        const val SEARCH_BUTTON_FOLLOW = "关注用户"
        const val SEARCH_BUTTON_INVITE = "邀请回答"
        const val SEARCH_BUTTON_COMMENT = "评论"
        const val SEARCH_BUTTON_VIEW_CONTENT_DETAIL = "查看内容详情"
        const val SEARCH_BUTTON_VIEW_FORUM_DETAIL = "查看论坛详情"
        const val SEARCH_BUTTON_VIEW_USER_DETAIL = "查看用户详情"
        const val SEARCH_BUTTON_LIKE = "点赞"
        const val SEARCH_BUTTON_DISLIKE = "取消点赞"
        const val SEARCH_BUTTON_VIEW_IMAGE = "查看图片"

        fun htmlToString(text: String?) =
            if (text == null) {
                ""
            } else {
                HtmlCompat.fromHtml(text, HtmlCompat.FROM_HTML_MODE_LEGACY).toString()
            }
    }
}