package com.base.appzxhy.bean

import com.base.appzxhy.utils.AppPreferences
import com.base.appzxhy.utils.KotlinExt.toFormatTime4

class FeatureBean(
    val key: String = "",
    val titleRes: Int = 0,
    val icon: Int = 0,
    val content: Int = 0,
) {
    var color: Int = 0
    var span: Int = 1
    var todayUsed = false

    companion object {
        const val JUNK_CLEAN = "junk_clean"
        const val BATTERY_INFO = "battery_info"
        const val SCREENSHOT_CLEAN = "screenshot_clean"
        const val LARGE_FILE_CLEAN = "large_file_clean"
        const val PHOTO_COMPRESSION = "photo_compression"
        const val SIMILAR_PHOTOS = "similar_photos"
        const val VIDEO_CLEAN = "video_clean"
        const val UNINSTALL_APP = "uninstall_app"
        const val DEVICE_INFO = "device_info"

        const val RECOVERY_PHOTOS = "recovery_photos"
        const val RECOVERY_VIDEOS = "recovery_videos"
        const val RECOVERY_AUDIOS = "recovery_audios"
        const val RECOVERY_DOCUMENTS = "recovery_documents"

        const val ANTIVIRUS = "antivirus"

        const val SETTINGS = "settings"

        /**
         * 今天功能使用过否
         */
        fun getFunctionTodayUsed(key: String): Boolean {
            return AppPreferences.getInstance().getBoolean("${key}_${System.currentTimeMillis().toFormatTime4()}", false)
        }

        /**
         * 设置今天功能使用过
         */
        fun setFunctionTodayUsed(key: String, used: Boolean = true) {
            return AppPreferences.getInstance().put("${key}_${System.currentTimeMillis().toFormatTime4()}", used)
        }

    }
}