package com.design.zenspace.entity

import androidx.lifecycle.LiveData

class FeatureRepository(private val featureDao: FeatureDao) {
    suspend fun allFeature():List<Feature>{
        return featureDao.getAllFeatures()
    }
    suspend fun updateFeature(feature: Feature){
    featureDao.update(feature)
    }
    suspend fun getFeatureById(id:String):Feature?{
        return featureDao.getById(id)
    }
    suspend fun getClassificationCover(name:String):List<Feature>{
        return featureDao.queryCover(name)
    }
    suspend fun getFeatureByClassification(name: String):List<Feature>{
        return featureDao.queryEachGenera(name)
    }
    fun getLikes():LiveData<List<Feature>>{
        return featureDao.queryLikeFeature()
    }
    suspend fun searchByKey(key:String):List<Feature>{
        return featureDao.search(key)
    }
    suspend fun isLike(id: String): Boolean = featureDao.queryIsLike(id) != null
}