package com.adpro.pixelshow.data

import androidx.lifecycle.LiveData

class MovieRepository(private val movieDao: MovieDao) {
    suspend fun allMovie():List<Movie>{
        return movieDao.getAllMovies()
    }
//    suspend fun insertMovie(paper: Movie){
//        paperDao.insert(paper)
//    }
    suspend fun updateMovie(movie: Movie){
    movieDao.update(movie)
    }
    suspend fun getMovieById(id:String):Movie?{
        return movieDao.getById(id)
    }
    suspend fun getClassificationCover(name:String):List<Movie>{
        return movieDao.queryCover(name)
    }
    suspend fun getMovieByClassification(name: String):List<Movie>{
        return movieDao.queryEachGenera(name)
    }
    fun getLikes():LiveData<List<Movie>>{
        return movieDao.queryLikeMovie()
    }
    suspend fun searchByKey(key:String):List<Movie>{
        return movieDao.search(key)
    }
    suspend fun isLike(id: String): Boolean = movieDao.queryIsLike(id) != null
}