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

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.tencent.liteav.demo.superplayer.database.entity.Record

@Dao
interface RecordDao {

    @Query("SELECT * FROM record WHERE courseId = :courseId")
    fun queryRecord(courseId: String): List<Record>

    @Query("SELECT * FROM record WHERE courseId = :courseId AND aiCourseItemId = :sectionId")
    fun queryRecord(courseId: String, sectionId: String): Record?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertRecord(record: Record)

    @Query("DELETE FROM record WHERE courseId = :courseId")
    fun deleteRecord(courseId: String)
}