package com.ys.bdtp.adm.mvvm.vm.flash

import com.ys.bdtp.adm.mvvm.model.Data
import com.ys.bdtp.adm.mvvm.model.db.AdmDatabase
import com.ys.bdtp.adm.mvvm.model.db.entity.UserEntity
import com.ys.bdtp.adm.mvvm.model.nt.Api
import com.ys.bdtp.adm.mvvm.model.toStateFlow
import kotlinx.coroutines.flow.Flow

/**
 * 闪屏页数据仓库
 *
 * @author bai
 * @param api [Api]
 * @param db [AdmDatabase]
 */
class FlashRepository(private val api: Api, private val db: AdmDatabase) {

    /**
     * 获取当前登录用户
     */
    fun getUser(): Flow<Data<UserEntity?>> {
        return db.userDao().getUser().toStateFlow()
    }
}