package com.base.filerecoveryrecyclebin.bean

data class FileBean(
    var name: String = "",
    var path: String,
    val size: Long,
    val isDir: Boolean = false,
    val type: String = "",
    val time: Long = 0L,
    var isSelect: Boolean = false
) {

    fun isImage() = !isDir && type in listOf("png", "jpg", "gif")


    fun isVideo() = !isDir && type in listOf("mp4")

    fun isAudio() = !isDir && type in listOf("mp3")

    fun isLargeFile() = !isDir && size >= 10 * 1024 * 1024

    fun isZip() = !isDir && type in listOf("zip", "tar", "7z")

    fun isApk() = !isDir && type in listOf("apk")

    fun isDoc() = !isDir && type in listOf("pdf", "doc", "docx", "xls", "ppt", "txt")

    fun isOther() = !isImage() && !isVideo() && !isAudio() && !isZip() && !isApk()
    fun isJunk() = !isDir && type in listOf("tmp", "cache", "temp")
//    fun isOtherTrash() = !isDir && type in listOf("log", "bak", "old", "chk", "gid", "dmp", "thumb", "crdownload", "part", "trash", "trashes")
    fun isOtherTrash() = !isDir && type in listOf("log","tmp")
    override fun toString(): String {
        return "FileBean(name='$name', path='$path', size=$size, isDir=$isDir, type='$type', time=$time, isSelect=$isSelect)"
    }
}