package com.zxhy.simplefilesmanager.simplelist

import java.io.File
import com.zxhy.simplefilesmanager.simpleCommon.SimpleCommonViewModel
import com.zxhy.simplefilesmanager.simpledata.JoFileJo.Companion.isAudio
import com.zxhy.simplefilesmanager.simpledata.JoFileJo.Companion.isDocument
import com.zxhy.simplefilesmanager.simpledata.JoFileJo.Companion.isEmptyFile
import com.zxhy.simplefilesmanager.simpledata.JoFileJo.Companion.isLargeFile
import com.zxhy.simplefilesmanager.simpledata.JoFileJo.Companion.isZip
import com.zxhy.simplefilesmanager.simpledata.JoFileJo.Companion.isApk
import com.zxhy.simplefilesmanager.simpledata.JoListFileJo.Companion.joListFileJo
import com.zxhy.simplefilesmanager.simpledata.JoListFileJo

class SimpleListViewModel : SimpleCommonViewModel() {

    fun loadAudio(
        onFinish: (list: List<JoListFileJo>) -> Unit
    ) = loadFile(::isAudio, ::joListFileJo, onFinish)

    fun loadLargeFile(onFinish: (list: List<JoListFileJo>) -> Unit) =
        loadFile(::isLargeFile, ::joListFileJo, onFinish)

    fun loadEmptyFile(onFinish: (list: List<JoListFileJo>) -> Unit) =
        loadFile(::isEmptyFile, ::joListFileJo, onFinish)


    fun loadZip(onFinish: (list: List<JoListFileJo>) -> Unit) =
        loadFile(::isZip, ::joListFileJo, onFinish)

    fun loadApk(onFinish: (list: List<JoListFileJo>) -> Unit) =
        loadFile(::isApk, ::joListFileJo, onFinish)

    fun loadDocument(onFinish: (list: List<JoListFileJo>) -> Unit) =
        loadFile(::isDocument, ::joListFileJo, onFinish)
}