package com.zxhyis.toolss.logic

import android.app.usage.UsageEvents
import android.app.usage.UsageStats
import android.graphics.Bitmap
import android.graphics.drawable.Drawable
import android.net.Uri
import com.google.gson.ExclusionStrategy
import com.google.gson.FieldAttributes
import com.google.gson.GsonBuilder
import java.io.File


data class ImageInfoBean(
    val imagePath: String,
    val imageBitmap: Bitmap,
    val file: File,
    val imageUri: Uri,
    var isShow: Boolean = false,
    var isSelected: Boolean = false
)

data class ImageAndVideoBean(
    val path: String,
    val file: File,
    val type: Int,
    val fileName: String? = null,
    val fileSize: Long,
    val recentTime: String?,
    val imageUri: Uri? = null,
    val videoUri: Uri? = null,
    var isShow: Boolean = false,
    var isSelected: Boolean = false
)

data class AppBean(
    val icIcon: Drawable,//Drawable会导致序列化失败
    val appName: String,
    val pkg: String,
    var isSelected: Boolean = false,
    var installTime: Long = 0,
    var appSize: Long = -1L,//0 没有大小  -1没有权限
    var lastUsedTime: Long = -1L, //-1没有权限 -2超过30没用
) {
    var pinYin: String = ""
    var usageEvents: List<UsageEvents.Event>? = null
    var usageStats: List<UsageStats>? = null

    var launchTimes = 0
    var foregroundTimes = 0
    var backgroundTimes = 0
    var isRunning = false
    var screenTime: Long = 0

    companion object {
        val appBeanGson = GsonBuilder().setExclusionStrategies(object : ExclusionStrategy {
            override fun shouldSkipField(f: FieldAttributes): Boolean {
                val skipField = arrayOf("icIcon")
                return skipField.contains(f.name)
            }

            override fun shouldSkipClass(clazz: Class<*>): Boolean {
//                val skipClass = arrayOf("List")
//                skipClass.contains(clazz.name)
                return false
            }

        }).create()
    }
}


data class VideoBean(
    val videoPath: String,
    val file: File,
    val videoUri: Uri,
    var isShow: Boolean = false,
    var isSelected: Boolean = false
)

data class AudioBean(
    val audioPath: String,
    val audioName: String,
    val audioUri: Uri,
    val file: File,
    val apkSize: Long,
    val apkTime: String?,
    var isShow: Boolean = false,
    var isSelected: Boolean = false
)

data class ApkInfoBean(
    val apkIcon: Drawable,
    val apkName: String,
    val apkPath: String,
    val apkSize: Long,
    val apkTime: String?,
    val file: File,
    var isShow: Boolean = false,
    var isSelected: Boolean = false
)

data class EmptyFileBean(
    val filePath: String,
    val fileName: String,
    val file: File,
    val fileSize: Long,
    val fileTime: String?,
    var isShow: Boolean = false,
    var isSelected: Boolean = false
)

data class FileBean(
    val filepath: String,
    val file: File,
    val fileName: String,
    val fileSize: Long,
    val fileTime: String?,
    var isShow: Boolean = false,
    var isSelected: Boolean = false
)

data class ParentBean(
    val title: String,
    val childItem: List<ChildBean>,
    var parentSize: Long,
    var isParentSelected: Boolean,
    var expanded: Boolean = true,
    var isfinish: Boolean = false
)


data class ChildBean(
    val image: Int? = null,
    val childname: String,
    val chilepath: String,
    val childSize: Long = 0L,
    var isChildSelected: Boolean = true,
    var pathList: List<String>? = null,
)


val clauseList = arrayListOf(
    "When you interact with our application,",
    "we may collect non-personally identifiable",
    "information, such as your device model",
    "the,Android version you use. A detailed list of the",
    "information we access and collect is as follows:",
    "• Installed applications information.",
    "When you use My File Master-Reader to clean junks you",
    "on your device, we may collect and upload",
    "your installed applications information to our server.",
    " We need to obtain the application list on",
    "the user's mobile phone to allow the user",
    "to clean up the junk files of applications on the phone.",
    "We do not share your installed applications information",
    "with any third party.",
    "• Device information.",
    "We collect device-specific information (such",
    "as your hardware manufacturer & model,",
    "perating system version, screen size, CPU",
    "model, mobile network information and",
    "installed apps) to implement app features,",
    "provide our services, and improve the app",
    "performance for all our users.",
    "• App Usage Data.",
    "We collect usage data includes information",
    "relating to the behavior and/or the habit when",
    "you are using the app to analyze and improve",
    "the user experience. We do not collect the",
    "content you may transmit or share within the app.",
    "• Storage Access.",
    "We'll read the application information, file",
    "storage information. application cache and",
    "multimedia file information installed both",
    "in your mobile and SD card, to help you clear",
    "junk files including system cache, ads unload",
    "residue, empty folders, useless installation",
    "packages, temporary files, other files,pictures,",
    "audios and videos etc.",
    "• Location Access.",
    "In order to ensure your WiFi environment",
    "safety, we'll read your network connection",
    "information (eg. WiFi connection status,",
    "encryption type, WiFi network connection",
    "status, SSID, etc.) and complete WiFi",
    "security detection through WiFi information",
    "analysis, ARP attack detection, DNS",
    "detection middleman attack detection ,Portal",
    "authentication etc."
)

