package com.tencent.liteav.demo.superplayer.database.repo

import com.tencent.liteav.demo.superplayer.database.dao.CountDownDao
import com.tencent.liteav.demo.superplayer.database.dao.HistoryDao
import com.tencent.liteav.demo.superplayer.database.entity.CountDown
import com.tencent.liteav.demo.superplayer.database.entity.History
import kotlinx.coroutines.flow.Flow

public class PlayerRepository(
    private val historyDao: HistoryDao,
    private val countDownDao: CountDownDao,
) {

    suspend fun insertHistory(history: History) {
        historyDao.insertHistory(history)
    }

    suspend fun insertCountDown(countDown: CountDown) {
        countDownDao.insertCountDown(countDown)
    }

    suspend fun findHasCountDown(courseId: String): Flow<CountDown?> {
        return countDownDao.getCountDownByCourseId(courseId)
    }
}