package com.convenient.android.lib.ui.sample.media

import com.convenient.android.common.extension.withIO
import com.convenient.android.common.media.MediaBean
import com.convenient.android.common.media.config.MediaQueryConfig
import com.convenient.android.common.media.scan.FileStore
import com.convenient.android.common.media.scan.MediaStore

/**
 * @classname:
 * @author: LiuXiaoLong
 * @date: 2022/8/4
 * description:
 * */

enum class MediaQueryType{
    FILES,MEDIA_STORE
}

class MediaFilesRepository {

    companion object{

        val instance by lazy {
            MediaFilesRepository()
        }

    }


    suspend fun queryMediaFiles(queryType: MediaQueryType,dir : String, config: MediaQueryConfig) : List<MediaBean>{
        return when(queryType){
            MediaQueryType.MEDIA_STORE-> MediaStore.query(dir = dir, config)
            MediaQueryType.FILES -> FileStore.query(dir, config)
        }
    }



}