package com.gh.gamecenter.room.dao

import androidx.room.*
import com.gh.gamecenter.entity.MyVideoEntity
import io.reactivex.Single

@Dao
interface VideoHistoryDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun addVideo(video: MyVideoEntity)

    @Query("select * from MyVideoEntity where user!='' order by time desc limit :pageSize offset :offset")
    fun getVideoWithOffset(pageSize: Int, offset: Int): Single<MutableList<MyVideoEntity>>

    @Query("select id from MyVideoEntity where videoStreamRecord=2 order by time desc")
    fun getAttentionVideoRecord(): Single<MutableList<String>>

    @Query("select id from MyVideoEntity where videoStreamRecord=1 order by time desc limit :pageSize offset :offset")
    fun getVideoStreamRecord(pageSize: Int, offset: Int): Single<MutableList<String>>

    @Delete
    fun deleteVideo(video: MyVideoEntity)

    @Query("delete from MyVideoEntity where videoStreamRecord=2")
    fun deleteAttentionVideoRecord()
}