package com.base.appzxhy.bean.recovery

import com.base.appzxhy.ui.recovery.FileHexEx.isDoc
import com.base.appzxhy.ui.recovery.FileHexEx.isDocx
import com.base.appzxhy.ui.recovery.FileHexEx.isFlac
import com.base.appzxhy.ui.recovery.FileHexEx.isMp3
import com.base.appzxhy.ui.recovery.FileHexEx.isPPT
import com.base.appzxhy.ui.recovery.FileHexEx.isPPTX
import com.base.appzxhy.ui.recovery.FileHexEx.isPdf
import com.base.appzxhy.ui.recovery.FileHexEx.isWav
import com.base.appzxhy.ui.recovery.FileHexEx.isXls
import com.base.appzxhy.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"
            }
        }

    }
}