package com.adealink.weparty.module.profile

import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModelStoreOwner
import com.adealink.frame.base.Rlt
import com.adealink.weparty.aab.IService
import com.adealink.weparty.module.profile.data.UserConfigType
import com.adealink.weparty.module.profile.data.UserConfigType.Companion.NECESSARY_USER_ATTR_SET
import com.adealink.weparty.module.profile.data.UserInfo
import com.adealink.weparty.module.profile.data.UserNote
import com.adealink.weparty.module.profile.viewmodel.IBlackViewModel
import com.adealink.weparty.module.profile.viewmodel.IFollowViewModel
import com.adealink.weparty.module.profile.viewmodel.IProfileViewModel

interface IProfileService : IService<IProfileService> {

    fun getMyUid(): String

    fun getMyUserInfo(): UserInfo?

    fun setMyUserInfo(userInfo: UserInfo)

    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>? = NECESSARY_USER_ATTR_SET,
    ): Rlt<UserInfo>

    suspend fun getUsersInfoByUid(
        uidSet: Set<String>,
        cache: Boolean = true,
        attrSet: Set<UserConfigType>? = NECESSARY_USER_ATTR_SET,
    ): 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 getUserNoteBy(
        uidSet: Set<String>,
        cache: Boolean = true
    ): Rlt<Map<String, UserNote>>

    fun getProfileViewModel(owner: ViewModelStoreOwner): IProfileViewModel?


    fun getFollowViewModel(owner: ViewModelStoreOwner): IFollowViewModel?

    fun getBlackViewModel(owner: ViewModelStoreOwner): IBlackViewModel?
}