package com.dumpster.cleaner.bean.recovery

import com.dumpster.cleaner.ui.recovery.FileHexEx.isDoc
import com.dumpster.cleaner.ui.recovery.FileHexEx.isDocx
import com.dumpster.cleaner.ui.recovery.FileHexEx.isFlac
import com.dumpster.cleaner.ui.recovery.FileHexEx.isMp3
import com.dumpster.cleaner.ui.recovery.FileHexEx.isPPT
import com.dumpster.cleaner.ui.recovery.FileHexEx.isPPTX
import com.dumpster.cleaner.ui.recovery.FileHexEx.isPdf
import com.dumpster.cleaner.ui.recovery.FileHexEx.isWav
import com.dumpster.cleaner.ui.recovery.FileHexEx.isXls
import com.dumpster.cleaner.ui.recovery.FileHexEx.isXlsx
import java.io.File

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

    companion object {
        fun RecoveryBean.setDocumentType() {
            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 RecoveryBean.setAudioType() {
            val file = File(path)
            if (isMp3(file)) {
                type = "MP3"
            }
            if (isWav(file)) {
                type = "WAV"
            }
            if (isFlac(file)) {
                type = "FLAC"
            }
        }

    }
}