package com.test.basd.smartjunkcleaner.bean

import android.Manifest
import com.test.basd.smartjunkcleaner.R

data class PermissionBean(
    val permissionMatch: String = Manifest.permission.CAMERA,
    var permissionTittle: Int = 0,
    var permissionDesc: Int = 0,
    var isSensitive: Boolean = false,
    var isAuthorized: Boolean = false,
) {
    companion object {

        fun PermissionBean.setTittle() {
            permissionTittle = when (permissionMatch) {
                Manifest.permission.ACCESS_BACKGROUND_LOCATION -> R.string.title_android_permission_ACCESS_BACKGROUND_LOCATION
                Manifest.permission.ACCESS_COARSE_LOCATION -> R.string.title_android_permission_ACCESS_COARSE_LOCATION
                Manifest.permission.ACCESS_FINE_LOCATION -> R.string.title_android_permission_ACCESS_FINE_LOCATION
                Manifest.permission.ACCESS_MEDIA_LOCATION -> R.string.title_android_permission_ACCESS_MEDIA_LOCATION
                Manifest.permission.ACCESS_NETWORK_STATE -> R.string.title_android_permission_ACCESS_NETWORK_STATE
                Manifest.permission.ACCESS_WIFI_STATE -> R.string.title_android_permission_ACCESS_WIFI_STATE
                Manifest.permission.ACTIVITY_RECOGNITION -> R.string.title_android_permission_ACTIVITY_RECOGNITION
                Manifest.permission.ANSWER_PHONE_CALLS -> R.string.title_android_permission_ANSWER_PHONE_CALLS
                Manifest.permission.BLUETOOTH -> R.string.title_android_permission_BLUETOOTH
                Manifest.permission.BLUETOOTH_ADMIN -> R.string.title_android_permission_BLUETOOTH_ADMIN
                Manifest.permission.BLUETOOTH_CONNECT -> R.string.title_android_permission_BLUETOOTH_CONNECT
                Manifest.permission.BLUETOOTH_PRIVILEGED -> R.string.title_android_permission_BLUETOOTH_PRIVILEGED
                Manifest.permission.BLUETOOTH_SCAN -> R.string.title_android_permission_BLUETOOTH_SCAN
                Manifest.permission.BODY_SENSORS -> R.string.title_android_permission_BODY_SENSORS
                Manifest.permission.CALL_PHONE -> R.string.title_android_permission_CALL_PHONE
                Manifest.permission.CAMERA -> R.string.title_android_permission_CAMERA
                Manifest.permission.CHANGE_NETWORK_STATE -> R.string.title_android_permission_CHANGE_NETWORK_STATE
                Manifest.permission.CHANGE_WIFI_STATE -> R.string.title_android_permission_CHANGE_WIFI_STATE
                Manifest.permission.CONTROL_LOCATION_UPDATES -> R.string.title_android_permission_CONTROL_LOCATION_UPDATES
                Manifest.permission.DELETE_PACKAGES -> R.string.title_android_permission_DELETE_PACKAGES
                Manifest.permission.GET_ACCOUNTS -> R.string.title_android_permission_GET_ACCOUNTS
                Manifest.permission.INSTALL_PACKAGES -> R.string.title_android_permission_INSTALL_PACKAGES
                Manifest.permission.INTERNET -> R.string.title_android_permission_INTERNET
                Manifest.permission.MANAGE_EXTERNAL_STORAGE -> R.string.title_android_permission_MANAGE_EXTERNAL_STORAGE
                Manifest.permission.MANAGE_MEDIA -> R.string.title_android_permission_MANAGE_MEDIA
                Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION -> R.string.title_android_permission_MANAGE_WIFI_NETWORK_SELECTION
                Manifest.permission.MODIFY_AUDIO_SETTINGS -> R.string.title_android_permission_MODIFY_AUDIO_SETTINGS
                Manifest.permission.NFC -> R.string.title_android_permission_NFC
                Manifest.permission.QUERY_ALL_PACKAGES -> R.string.title_android_permission_QUERY_ALL_PACKAGES
                Manifest.permission.READ_CALENDAR -> R.string.title_android_permission_READ_CALENDAR
                Manifest.permission.READ_CALL_LOG -> R.string.title_android_permission_READ_CALL_LOG
                Manifest.permission.READ_CONTACTS -> R.string.title_android_permission_READ_CONTACTS
                Manifest.permission.READ_EXTERNAL_STORAGE -> R.string.title_android_permission_READ_EXTERNAL_STORAGE
                Manifest.permission.READ_MEDIA_AUDIO -> R.string.title_android_permission_READ_MEDIA_AUDIO
                Manifest.permission.READ_MEDIA_IMAGES -> R.string.title_android_permission_READ_MEDIA_IMAGES
                Manifest.permission.READ_MEDIA_VIDEO -> R.string.title_android_permission_READ_MEDIA_VIDEO
                Manifest.permission.READ_PHONE_NUMBERS -> R.string.title_android_permission_READ_PHONE_NUMBERS
                Manifest.permission.READ_PHONE_STATE -> R.string.title_android_permission_READ_PHONE_STATE
                Manifest.permission.READ_SMS -> R.string.title_android_permission_READ_SMS
                Manifest.permission.READ_SYNC_SETTINGS -> R.string.title_android_permission_READ_SYNC_SETTINGS
                Manifest.permission.READ_SYNC_STATS -> R.string.title_android_permission_READ_SYNC_STATS
                Manifest.permission.RECEIVE_BOOT_COMPLETED -> R.string.title_android_permission_RECEIVE_BOOT_COMPLETED
                Manifest.permission.RECEIVE_SMS -> R.string.title_android_permission_RECEIVE_SMS
                Manifest.permission.RECORD_AUDIO -> R.string.title_android_permission_RECORD_AUDIO
                Manifest.permission.REQUEST_DELETE_PACKAGES -> R.string.title_android_permission_REQUEST_DELETE_PACKAGES
                Manifest.permission.SEND_SMS -> R.string.title_android_permission_SEND_SMS
                Manifest.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION -> R.string.title_android_permission_UPDATE_PACKAGES_WITHOUT_USER_ACTION
                Manifest.permission.USE_FINGERPRINT -> R.string.title_android_permission_USE_FINGERPRINT
                Manifest.permission.WRITE_CALENDAR -> R.string.title_android_permission_WRITE_CALENDAR
                Manifest.permission.WRITE_CALL_LOG -> R.string.title_android_permission_WRITE_CALL_LOG
                Manifest.permission.WRITE_CONTACTS -> R.string.title_android_permission_WRITE_CONTACTS
                Manifest.permission.WRITE_EXTERNAL_STORAGE -> R.string.title_android_permission_WRITE_EXTERNAL_STORAGE
                Manifest.permission.WRITE_SETTINGS -> R.string.title_android_permission_WRITE_SETTINGS
                Manifest.permission.WRITE_SYNC_SETTINGS -> R.string.title_android_permission_WRITE_SYNC_SETTINGS

                else -> 0
            }
        }

        fun PermissionBean.setDesc() {
            permissionDesc = when (permissionMatch) {
                Manifest.permission.ACCESS_BACKGROUND_LOCATION -> R.string.comment_android_permission_ACCESS_BACKGROUND_LOCATION
                Manifest.permission.ACCESS_COARSE_LOCATION -> R.string.comment_android_permission_ACCESS_COARSE_LOCATION
                Manifest.permission.ACCESS_FINE_LOCATION -> R.string.comment_android_permission_ACCESS_FINE_LOCATION
                Manifest.permission.ACCESS_MEDIA_LOCATION -> R.string.comment_android_permission_ACCESS_MEDIA_LOCATION
                Manifest.permission.ACCESS_NETWORK_STATE -> R.string.comment_android_permission_ACCESS_NETWORK_STATE
                Manifest.permission.ACCESS_WIFI_STATE -> R.string.comment_android_permission_ACCESS_WIFI_STATE
                Manifest.permission.ACTIVITY_RECOGNITION -> R.string.comment_android_permission_ACTIVITY_RECOGNITION
                Manifest.permission.ANSWER_PHONE_CALLS -> R.string.comment_android_permission_ANSWER_PHONE_CALLS
                Manifest.permission.BLUETOOTH -> R.string.comment_android_permission_BLUETOOTH
                Manifest.permission.BLUETOOTH_ADMIN -> R.string.comment_android_permission_BLUETOOTH_ADMIN
                Manifest.permission.BLUETOOTH_CONNECT -> R.string.comment_android_permission_BLUETOOTH_CONNECT
                Manifest.permission.BLUETOOTH_PRIVILEGED -> R.string.comment_android_permission_BLUETOOTH_PRIVILEGED
                Manifest.permission.BLUETOOTH_SCAN -> R.string.comment_android_permission_BLUETOOTH_SCAN
                Manifest.permission.BODY_SENSORS -> R.string.comment_android_permission_BODY_SENSORS
                Manifest.permission.CALL_PHONE -> R.string.comment_android_permission_CALL_PHONE
                Manifest.permission.CAMERA -> R.string.comment_android_permission_CAMERA
                Manifest.permission.CHANGE_NETWORK_STATE -> R.string.comment_android_permission_CHANGE_NETWORK_STATE
                Manifest.permission.CHANGE_WIFI_STATE -> R.string.comment_android_permission_CHANGE_WIFI_STATE
                Manifest.permission.CONTROL_LOCATION_UPDATES -> R.string.comment_android_permission_CONTROL_LOCATION_UPDATES
                Manifest.permission.DELETE_PACKAGES -> R.string.comment_android_permission_DELETE_PACKAGES
                Manifest.permission.GET_ACCOUNTS -> R.string.comment_android_permission_GET_ACCOUNTS
                Manifest.permission.INSTALL_PACKAGES -> R.string.comment_android_permission_INSTALL_PACKAGES
                Manifest.permission.INTERNET -> R.string.comment_android_permission_INTERNET
                Manifest.permission.MANAGE_EXTERNAL_STORAGE -> R.string.comment_android_permission_MANAGE_EXTERNAL_STORAGE
                Manifest.permission.MANAGE_MEDIA -> R.string.comment_android_permission_MANAGE_MEDIA
                Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION -> R.string.comment_android_permission_MANAGE_WIFI_NETWORK_SELECTION
                Manifest.permission.MODIFY_AUDIO_SETTINGS -> R.string.comment_android_permission_MODIFY_AUDIO_SETTINGS
                Manifest.permission.NFC -> R.string.comment_android_permission_NFC
                Manifest.permission.QUERY_ALL_PACKAGES -> R.string.comment_android_permission_QUERY_ALL_PACKAGES
                Manifest.permission.READ_CALENDAR -> R.string.comment_android_permission_READ_CALENDAR
                Manifest.permission.READ_CALL_LOG -> R.string.comment_android_permission_READ_CALL_LOG
                Manifest.permission.READ_CONTACTS -> R.string.comment_android_permission_READ_CONTACTS
                Manifest.permission.READ_EXTERNAL_STORAGE -> R.string.comment_android_permission_READ_EXTERNAL_STORAGE
                Manifest.permission.READ_MEDIA_AUDIO -> R.string.comment_android_permission_READ_MEDIA_AUDIO
                Manifest.permission.READ_MEDIA_IMAGES -> R.string.comment_android_permission_READ_MEDIA_IMAGES
                Manifest.permission.READ_MEDIA_VIDEO -> R.string.comment_android_permission_READ_MEDIA_VIDEO
                Manifest.permission.READ_PHONE_NUMBERS -> R.string.comment_android_permission_READ_PHONE_NUMBERS
                Manifest.permission.READ_PHONE_STATE -> R.string.comment_android_permission_READ_PHONE_STATE
                Manifest.permission.READ_SMS -> R.string.comment_android_permission_READ_SMS
                Manifest.permission.READ_SYNC_SETTINGS -> R.string.comment_android_permission_READ_SYNC_SETTINGS
                Manifest.permission.READ_SYNC_STATS -> R.string.comment_android_permission_READ_SYNC_STATS
                Manifest.permission.RECEIVE_BOOT_COMPLETED -> R.string.comment_android_permission_RECEIVE_BOOT_COMPLETED
                Manifest.permission.RECEIVE_SMS -> R.string.comment_android_permission_RECEIVE_SMS
                Manifest.permission.RECORD_AUDIO -> R.string.comment_android_permission_RECORD_AUDIO
                Manifest.permission.REQUEST_DELETE_PACKAGES -> R.string.comment_android_permission_REQUEST_DELETE_PACKAGES
                Manifest.permission.SEND_SMS -> R.string.comment_android_permission_SEND_SMS
                Manifest.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION -> R.string.comment_android_permission_UPDATE_PACKAGES_WITHOUT_USER_ACTION
                Manifest.permission.USE_FINGERPRINT -> R.string.comment_android_permission_USE_FINGERPRINT
                Manifest.permission.WRITE_CALENDAR -> R.string.comment_android_permission_WRITE_CALENDAR
                Manifest.permission.WRITE_CALL_LOG -> R.string.comment_android_permission_WRITE_CALL_LOG
                Manifest.permission.WRITE_CONTACTS -> R.string.comment_android_permission_WRITE_CONTACTS
                Manifest.permission.WRITE_EXTERNAL_STORAGE -> R.string.comment_android_permission_WRITE_EXTERNAL_STORAGE
                Manifest.permission.WRITE_SETTINGS -> R.string.comment_android_permission_WRITE_SETTINGS
                Manifest.permission.WRITE_SYNC_SETTINGS -> R.string.comment_android_permission_WRITE_SYNC_SETTINGS

                else -> 0
            }
        }

    }
}