package com.base.pdfviewerscannerwhite.bean

import com.base.pdfviewerscannerwhite.utils.AppPreferences
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale


object ConstObject {


    const val MIME_TYPE_IMAGE = "image/*"
    const val MIME_TYPE_VIDEO = "video/*"
    const val MIME_TYPE_AUDIO = "audio/*"
    const val MIME_TYPE_PDF = "application/pdf"
    const val MIME_TYPE_DOC = "application/msword"
    const val MIME_TYPE_DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    const val MIME_TYPE_XLS = "application/vnd.ms-excel"
    const val MIME_TYPE_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
    const val MIME_TYPE_PPT = "application/vnd.ms-powerpoint"
    const val MIME_TYPE_PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation"
    const val MIME_TYPE_APK = "application/vnd.android.package-archive"
    const val MIME_TYPE_ZIP = "application/zip"


    const val DO_SPLIT_PDF = "do_split_pdf"
    const val DO_SAVE_PDF = "do_save_pdf"
    const val DO_MERGE_PDF = "do_merge_pdf"
    const val DO_LOCK_PDF = "do_lock_pdf"
    const val DO_UNLOCK_PDF = "do_unlock_pdf"

    const val DOCUMENT_DATA_TYPE = "document"
    const val RECENT_DATA_TYPE = "recent"
    const val BOOKMARK_DATA_TYPE = "bookmark"

    const val UI_MODE_NORMAL = "ui_mode_normal"
    const val UI_MODE_SELECT = "ui_mode_select"
    const val UI_MODE_SEARCH = "ui_mode_search"

    const val UI_SORT_LAST_MODIFIED = "ui_sort_last_modified"
    const val UI_SORT_FINAL_MODIFIED = "ui_sort_final_modified"
    const val UI_SORT_NAME_A_Z = "ui_sort_name_a_z"
    const val UI_SORT_NAME_Z_A = "ui_sort_name_z_a"

    const val NOTIFICATION_ACTION_LOG = "notification_action_log"
    const val NOTIFICATION_ACTION_DOCUMENT = "notification_action_document"
    const val NOTIFICATION_ACTION_BOOKMARK = "notification_action_bookmark"
    const val NOTIFICATION_ACTION_NEW_IMAGE_PDF = "notification_action_new_image_pdf"

    const val NOTIFICATION_ACTION_READ_PDF = "notification_action_read_pdf"
    const val NOTIFICATION_ACTION_READ_DOCUMENTS = "notification_action_read_documents"
    const val NOTIFICATION_ACTION_UN_VIEW_FILES = "notification_action_un_view_files"
    const val NOTIFICATION_ACTION_IMPORTANT_DOCUMENT = "notification_action_important_document"
    const val NOTIFICATION_ACTION_APP_PROCESS = "notification_action_app_process"
    const val NOTIFICATION_ACTION_CLEAN_JUNK = "notification_action_clean_junk"
    const val NOTIFICATION_ACTION_WEATHER = "notification_action_weather"

    const val SHORTCUT_SCAN_PDF = "shortcut_scan_pdf"
    const val SHORTCUT_SPLIT_PDF = "shortcut_split_pdf"
    const val SHORTCUT_MERGE_PDF = "shortcut_merge_pdf"

    const val FUNCTION_SCAM_JUNK = "function_scam_junk"
    const val FUNCTION_APP_PROCESS = "function_app_process"

    var ifAgreePrivacy = false
        get() {
            return AppPreferences.getInstance().getBoolean("ifAgreePrivacy", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("ifAgreePrivacy", value, true)
        }
    var haveSaveDemo = false
        get() {
            return AppPreferences.getInstance().getBoolean("haveSaveDemo", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("haveSaveDemo", value, true)
        }

    var haveGuideGesture = false
        get() {
            return AppPreferences.getInstance().getBoolean("haveGuideGesture", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("haveGuideGesture", value, true)
        }
    var appLanguageSp = Locale.ENGLISH.language
        get() {
            return AppPreferences.getInstance().getString("appLanguageSp", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("appLanguageSp", value, true)
        }
    var changeLanguageSp = appLanguageSp
        get() {
            return AppPreferences.getInstance().getString("changeLanguageSp", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("changeLanguageSp", value, true)
        }

    var haveSelectLanguage = false
        get() {
            return AppPreferences.getInstance().getBoolean("selectFollowLanguage", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("selectFollowLanguage", value, true)
        }
    var selectFollowLanguage = false
        get() {
            return AppPreferences.getInstance().getBoolean("selectFollowLanguage", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("selectFollowLanguage", value, true)
        }

    //是否第一次启动
    var isFirstStart = true
        get() {
            return AppPreferences.getInstance().getBoolean("isFirstStart", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("isFirstStart", value, true)
        }

    //主页启动次数
    var mainStartTimes = 0
        get() {
            return AppPreferences.getInstance().getInt("mainStartTimes", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("mainStartTimes", value, true)
        }

    var todayShowNotificationDialog = false
        get() {
            return AppPreferences.getInstance().getBoolean("todayShowNotificationDialog_${currentDate()}", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("todayShowNotificationDialog_${currentDate()}", value, true)
        }
    var setDefault = false
        get() {
            return AppPreferences.getInstance().getBoolean("setDefault", field)
        }
        set(value) {
            field = value
            AppPreferences.getInstance().put("setDefault", value, true)
        }

    private fun currentDate(): String {
        val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
        val currentDate = Calendar.getInstance().time
        return dateFormat.format(currentDate)
    }

}