package com.design.wallpapergallery.data

import androidx.lifecycle.LiveData

class PhotoRepository(private val photoDao: PhotoDao) {
    suspend fun allPhoto():List<Photo>{
        return photoDao.getAllPhotos()
    }
//    suspend fun insertPhoto(paper: Photo){
//        paperDao.insert(paper)
//    }
    suspend fun updatePhoto(photo: Photo){
    photoDao.update(photo)
    }
    suspend fun getPhotoById(id:String):Photo?{
        return photoDao.getById(id)
    }
    suspend fun getClassificationCover(name:String):List<Photo>{
        return photoDao.queryCover(name)
    }
    suspend fun getPhotoByClassification(name: String):List<Photo>{
        return photoDao.queryEachGenera(name)
    }
    fun getLikes():LiveData<List<Photo>>{
        return photoDao.queryLikePhoto()
    }
    suspend fun searchByKey(key:String):List<Photo>{
        return photoDao.search(key)
    }
    suspend fun isLike(id: String): Boolean = photoDao.queryIsLike(id) != null
}