package com.zaojiao.app.data.remote

import com.zaojiao.app.core.common.remote.AppDispatchers
import com.zaojiao.app.core.common.remote.Dispatcher
import com.zaojiao.app.core.common.state.DataState
import com.zaojiao.app.core.http.common.toDataState
import com.zaojiao.app.core.http.common.tryRequest
import com.zaojiao.app.data.model.UserGetV2Model
import com.zaojiao.app.data.model.UserModel
import com.zaojiao.app.data.remote.api.UserApi
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.withContext
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class RemoteUserData @Inject constructor(
    private val userApi: UserApi,
) {
    suspend fun getUser(): DataState<UserGetV2Model> {
        return tryRequest { userApi.getUser().toDataState() }
    }
}