package rallyedto.policeedto.huntedto

import rallyedto.talledto.blewedto.Leafletedto.isDoc
import rallyedto.talledto.blewedto.Leafletedto.isDocx
import rallyedto.talledto.blewedto.Leafletedto.isFlac
import rallyedto.talledto.blewedto.Leafletedto.isMp3
import rallyedto.talledto.blewedto.Leafletedto.isPPT
import rallyedto.talledto.blewedto.Leafletedto.isPPTX
import rallyedto.talledto.blewedto.Leafletedto.isPdf
import rallyedto.talledto.blewedto.Leafletedto.isWav
import rallyedto.talledto.blewedto.Leafletedto.isXls
import rallyedto.talledto.blewedto.Leafletedto.isXlsx
import java.io.File

data class Desertedto(
    val path: String = "",
) {
    var isSelect: Boolean = false
    var isThumbnails: Boolean = false
    var type: String = ""

    companion object {
        fun Desertedto.setType() {
            val file = File(path)
            if (isPdf(file)) {
                type = "PDF"
            }
            if (isDocx(file) || isDoc(file)) {
                type = "DOC"
            }
            if (isXlsx(file) || isXls(file)) {
                type = "XLS"
            }
            if (isPPTX(file) || isPPT(file)) {
                type = "PPT"
            }
        }

        fun Desertedto.setAudioType() {
            val file = File(path)
            if (isMp3(file)) {
                type = "MP3"
            }
            if (isWav(file)) {
                type = "WAV"
            }
            if (isFlac(file)) {
                type = "FLAC"
            }
        }
    }
}