package com.adealink.weparty.profile.manager

import androidx.lifecycle.LiveData
import com.adealink.frame.base.Rlt
import com.adealink.frame.frame.IBaseFrame
import com.adealink.weparty.module.profile.data.MyUserInfoData
import com.adealink.weparty.module.profile.data.UserConfigType
import com.adealink.weparty.module.profile.data.UserInfo
import com.adealink.weparty.module.profile.data.UserNote
import com.adealink.weparty.module.profile.listener.IProfileListener

interface IProfileManager : IBaseFrame<IProfileListener> {
    fun getMyUid(): String

    fun getMyUserInfo(): UserInfo?

    suspend fun pullMyUserInfo(): Rlt<MyUserInfoData?>

    fun setMyUserInfo(userInfo: UserInfo, attrSet: Set<UserConfigType>?)

    fun updateMyUserCountryInfo(country: String, region: String, countryFlag: String)

    fun getCacheUserInfo(uid: String): UserInfo?

    fun updateCacheUserInfo(userInfo: UserInfo)

    suspend fun getUserInfoByUid(
        uid: String,
        cache: Boolean = true,
        attrSet: Set<UserConfigType>? = setOf(UserConfigType.USER_ATTR_BASIC),
    ): Rlt<UserInfo>

    suspend fun getUsersInfoByUid(
        uidSet: Set<String>,
        cache: Boolean = true,
        attrSet: Set<UserConfigType>? = setOf(UserConfigType.USER_ATTR_BASIC),
    ): Rlt<Map<String, UserInfo>>


    fun isUserOnline(uid: String): Boolean
    fun observeUserOnline(uid: String): LiveData<Boolean>

    suspend fun isUserOnline(
        uid: String,
        cache: Boolean = true,
    ): Rlt<Boolean>

    suspend fun isUserOnline(
        uidSet: Set<String>,
        cache: Boolean = true,
    ): Rlt<Map<String, Boolean>>


    fun updateUserOnline(uid: String, online: Boolean)

    fun updateUserOnline(onlineStatus: Map<String, Boolean>)


    /**
     * 获取用户备注
     */
    suspend fun getUserNoteByUid(
        uid: String,
        cache: Boolean = true,
    ): Rlt<UserNote>

    /**
     * 获取用户备注
     */
    suspend fun getUserNoteByUids(
        uids: List<String>,
        cache: Boolean = true,
    ): Rlt<Map<String, UserNote>>

    fun getCacheUserNote(uid: String): UserNote?

    /**
     * 获取用户备注
     */
    suspend fun setUserNote(
        uid: String,
        note: String?,
    ): Rlt<Any>

}