package com.adealink.weparty.profile.search.data

import com.adealink.frame.network.data.PageReq
import com.adealink.weparty.commonui.recycleview.diffutil.BaseListItemData
import com.google.gson.annotations.GsonNullable
import com.google.gson.annotations.SerializedName


data class SearchReq(
    @SerializedName("keyword") val keyword: String,
    @SerializedName("page") val page: PageReq
)

data class SearchRes(
    @SerializedName("list") val list: List<SearchData>,
    @GsonNullable
    @SerializedName("next") val next: String?
)

data class SearchData(
    @SerializedName("userNo") val uid: String,
    @GsonNullable
    @SerializedName("nickname") val nickName: String? = null,
    @GsonNullable
    @SerializedName("avatar") val avatar: String? = null,
    @GsonNullable
    @SerializedName("age") val age: Int? = null,
    @GsonNullable
    @SerializedName("birthdayAt") val birthdayAt: Long? = null,
    @GsonNullable
    @SerializedName("gender") val gender: Int? = null,

    @GsonNullable
    @SerializedName("follow") var follow: Boolean? = null, //是否关注
    @GsonNullable
    @SerializedName("followCount") val followCount: Int? = null, //粉丝人数
    @GsonNullable
    @SerializedName("online") val online: Boolean? = null //在线状态
)

data class SearchResultItemData(
    val data: SearchData
) : BaseListItemData {
    override fun areContentsTheSame(newItem: Any): Boolean {
        val new = newItem as? SearchResultItemData ?: return false
        return data.uid == new.data.uid
                && data.follow == new.data.follow
    }
}

data class SearchHistoryItemData(
    val keyword: String
) : BaseListItemData {
    override fun areContentsTheSame(newItem: Any): Boolean {
        val new = newItem as? SearchHistoryItemData ?: return false
        return keyword == new.keyword
    }
}