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

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy.REPLACE
import androidx.room.Query
import com.tencent.liteav.demo.superplayer.database.entity.CountDown
import kotlinx.coroutines.flow.Flow

/**
 * 倒计时相关的数据库操作
 */
@Dao
interface CountDownDao {

    @Query("SELECT * FROM countdown WHERE id = :courseId LIMIT 1")
    fun queryCountDown(courseId: String): CountDown?

    @Insert(onConflict = REPLACE)
    fun insertCountDown(countDown: CountDown)

    @Query("DELETE FROM countdown WHERE id = :courseId")
    fun deleteCountDown(courseId: String): Int
}