@file:Suppress("unused", "HardCodedStringLiteral", "DEPRECATION")

package eu.gaudian.translator.view.composable

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.Icons.Default
import androidx.compose.material.icons.automirrored.filled.ArrowBackIos
import androidx.compose.material.icons.automirrored.filled.ArrowForward
import androidx.compose.material.icons.automirrored.filled.DriveFileMove
import androidx.compose.material.icons.automirrored.filled.ExitToApp
import androidx.compose.material.icons.automirrored.filled.LibraryBooks
import androidx.compose.material.icons.automirrored.filled.Redo
import androidx.compose.material.icons.automirrored.filled.Sort
import androidx.compose.material.icons.automirrored.filled.Undo
import androidx.compose.material.icons.automirrored.filled.VolumeUp
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.ArrowCircleUp
import androidx.compose.material.icons.filled.Assessment
import androidx.compose.material.icons.filled.AutoAwesome
import androidx.compose.material.icons.filled.BarChart
import androidx.compose.material.icons.filled.Book
import androidx.compose.material.icons.filled.BrightnessAuto
import androidx.compose.material.icons.filled.BrightnessHigh
import androidx.compose.material.icons.filled.BrightnessLow
import androidx.compose.material.icons.filled.Business
import androidx.compose.material.icons.filled.Cancel
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material.icons.filled.Checklist
import androidx.compose.material.icons.filled.ChevronLeft
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material.icons.filled.CleaningServices
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.ColorLens
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material.icons.filled.ContentPaste
import androidx.compose.material.icons.filled.CreateNewFolder
import androidx.compose.material.icons.filled.Dashboard
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Deselect
import androidx.compose.material.icons.filled.Download
import androidx.compose.material.icons.filled.DragIndicator
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.EditNote
import androidx.compose.material.icons.filled.EmojiEvents
import androidx.compose.material.icons.filled.Error
import androidx.compose.material.icons.filled.ExpandMore
import androidx.compose.material.icons.filled.Extension
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.Filter1
import androidx.compose.material.icons.filled.Filter2
import androidx.compose.material.icons.filled.Filter3
import androidx.compose.material.icons.filled.Filter4
import androidx.compose.material.icons.filled.Filter5
import androidx.compose.material.icons.filled.FilterAlt
import androidx.compose.material.icons.filled.FilterList
import androidx.compose.material.icons.filled.FitnessCenter
import androidx.compose.material.icons.filled.FlashOn
import androidx.compose.material.icons.filled.Folder
import androidx.compose.material.icons.filled.FolderDelete
import androidx.compose.material.icons.filled.FolderSpecial
import androidx.compose.material.icons.filled.HelpOutline
import androidx.compose.material.icons.filled.History
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.Info
import androidx.compose.material.icons.filled.Key
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.KeyboardArrowUp
import androidx.compose.material.icons.filled.Language
import androidx.compose.material.icons.filled.LibraryBooks
import androidx.compose.material.icons.filled.Lightbulb
import androidx.compose.material.icons.filled.LocalFireDepartment
import androidx.compose.material.icons.filled.Lock
import androidx.compose.material.icons.filled.LooksTwo
import androidx.compose.material.icons.filled.MenuBook
import androidx.compose.material.icons.filled.Merge
import androidx.compose.material.icons.filled.ModelTraining
import androidx.compose.material.icons.filled.MonitorHeart
import androidx.compose.material.icons.filled.MoreHoriz
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.NoteAdd
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material.icons.filled.PlayCircleFilled
import androidx.compose.material.icons.filled.PlaylistRemove
import androidx.compose.material.icons.filled.Quiz
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.material.icons.filled.RuleFolder
import androidx.compose.material.icons.filled.Science
import androidx.compose.material.icons.filled.Search
import androidx.compose.material.icons.filled.SelectAll
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.filled.Share
import androidx.compose.material.icons.filled.SmartToy
import androidx.compose.material.icons.filled.Source
import androidx.compose.material.icons.filled.Spellcheck
import androidx.compose.material.icons.filled.Stairs
import androidx.compose.material.icons.filled.Storage
import androidx.compose.material.icons.filled.Style
import androidx.compose.material.icons.filled.SwapHoriz
import androidx.compose.material.icons.filled.Sync
import androidx.compose.material.icons.filled.Today
import androidx.compose.material.icons.filled.ToggleOn
import androidx.compose.material.icons.filled.Translate
import androidx.compose.material.icons.filled.Tune
import androidx.compose.material.icons.filled.Upload
import androidx.compose.material.icons.filled.Wallpaper
import androidx.compose.material.icons.filled.Warning
import androidx.compose.material.icons.outlined.Book
import androidx.compose.material.icons.outlined.FavoriteBorder
import androidx.compose.material.icons.outlined.FilterAlt
import androidx.compose.material.icons.outlined.FitnessCenter
import androidx.compose.material.icons.outlined.LibraryBooks
import androidx.compose.material.icons.outlined.Translate
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import eu.gaudian.translator.ui.theme.ThemePreviews


object AppIcons {
    val Add = Default.Add
    val AddCategory = Icons.Filled.CreateNewFolder
    val AddTo = Default.Add
    val AddToDictionary = Icons.Filled.NoteAdd
    val AI = Default.AutoAwesome
    val Appearance = Icons.Filled.ColorLens
    val ApiKey = Default.Key
    val ArrowBack = Icons.AutoMirrored.Filled.ArrowBackIos
    val ArrowCircleUp = Icons.Filled.ArrowCircleUp
    val ArrowDropDown = Icons.Filled.KeyboardArrowDown
    val ArrowDropUp = Icons.Filled.KeyboardArrowUp
    val ArrowForward = Icons.Filled.ChevronRight
    val ArrowForwardNoChevron = Icons.AutoMirrored.Filled.ArrowForward
    val ArrowLeft = Icons.Filled.ChevronLeft
    val ArrowRight = Icons.Filled.ChevronRight
    val BarChart = Default.BarChart
    val BrightnessAuto = Icons.Filled.BrightnessAuto
    val Business = Icons.Filled.Business
    val Cancel = Default.Cancel
    val Category = Icons.Filled.Folder
    val Check = Default.CheckCircle
    val CheckCircle = Default.CheckCircle
    val CheckList = Icons.Filled.Checklist
    val Clean = Default.CleaningServices
    val Clear = Default.Close
    val Clippy = HintIcons.Clippy
    val Close = Default.Close
    val Copy = Default.ContentCopy
    val Dashboard = Default.Dashboard
    val DarkMode = Icons.Filled.BrightnessLow
    val Delete = Default.Delete
    val DeleteCategory = Icons.Filled.FolderDelete
    val Deselect = Default.Deselect
    val Dictionary = Icons.Filled.Book
    val DictionaryCategory = Icons.Filled.LooksTwo
    val DictionaryFilled = Icons.Filled.Book
    val DictionaryOutlined = Icons.Outlined.Book
    val DragHandle = Icons.Filled.DragIndicator
    val Download = Default.Download
    val Done = Default.CheckCircle
    val Edit = Default.Edit
    val EditNote = Default.EditNote
    val Error = Default.Error
    val Exercise = Default.FitnessCenter
    val Exercises = Icons.Filled.FitnessCenter
    val ExercisesFilled = Icons.Filled.FitnessCenter
    val ExercisesOutlined = Icons.Outlined.FitnessCenter
    val ExitToApp = Icons.AutoMirrored.Filled.ExitToApp
    val Extension = Default.Extension
    val ExpandMore = Default.ExpandMore
    val Favorite = Icons.Filled.Favorite
    val FavoriteOutline = Icons.Outlined.FavoriteBorder
    val Filter = Icons.Filled.FilterList
    val FilterCategory = Icons.Filled.RuleFolder
    val FilterFilled = Icons.Filled.FilterAlt
    val FilterList = Icons.Filled.FolderSpecial
    val FilterOutlined = Icons.Outlined.FilterAlt
    val Flash = Icons.Filled.FlashOn
    val FitnessCenter = Default.FitnessCenter
    val Guessing = Icons.Filled.HelpOutline
    val Help = HintIcons.Help85
    val History = Default.History
    val Home = Default.Home
    val Info = Default.Info
    val Key = Default.Key
    val Language = Default.Language
    val LightMode = Icons.Filled.BrightnessHigh
    val List = Icons.Filled.Source
    val Lock = Default.Lock
    val Log = Icons.Filled.MonitorHeart
    val MenuBook = Icons.Filled.MenuBook
    val Merge = Icons.Filled.Merge
    val ModelTraining = Icons.Filled.ModelTraining
    val More = Default.MoreVert
    val MoreHorizontal = Icons.Filled.MoreHoriz
    val MoreVert = Default.MoreVert
    val MoveTo = Icons.AutoMirrored.Filled.DriveFileMove
    val Paste = Default.ContentPaste
    val Play = Default.PlayArrow
    val PlayCircleFilled = Icons.Filled.PlayCircleFilled
    val Quiz = Icons.Filled.Quiz
    val Redo = Icons.AutoMirrored.Filled.Redo
    val Refresh = Default.Refresh
    val Remove = Default.PlaylistRemove
    val Repository = Default.Storage
    val Robo = Default.SmartToy
    val Science = Icons.Filled.Science
    val Search = Default.Search
    val SelectAll = Default.SelectAll
    val Settings = Default.Settings
    val SettingsFilled = Default.Settings
    val SettingsOutlined = Default.Settings
    val Share = Icons.Filled.Share
    val Sort = Icons.AutoMirrored.Filled.Sort
    val SpellCheck = Icons.Filled.Spellcheck
    val Speech = Icons.AutoMirrored.Filled.VolumeUp
    val Stage1 = Default.Filter1
    val Stage2 = Default.Filter2
    val Stage3 = Default.Filter3
    val Stage4 = Default.Filter4
    val Stage5 = Default.Filter5
    val StageLearned = Default.EmojiEvents
    val StageNew = Default.Lightbulb
    val Stages = Icons.Filled.Stairs
    val Statistics = Icons.Filled.Assessment
    val Streak = Icons.Filled.LocalFireDepartment
    val Storage = Default.Storage
    val Style = Icons.Filled.Style
    val SwapHoriz = Icons.Filled.SwapHoriz
    val Sync = Icons.Filled.Sync
    val TextToSpeech = Icons.AutoMirrored.Filled.VolumeUp
    val Today = Icons.Filled.Today
    val Translate = Default.Translate
    val TranslateFilled = Icons.Filled.Translate
    val TranslateOutlined = Icons.Outlined.Translate
    val Tune = Default.Tune
    val Undo = Icons.AutoMirrored.Filled.Undo
    val Upload = Default.Upload
    val Vocabulary = Icons.AutoMirrored.Filled.LibraryBooks
    val VocabularyFilled = Icons.Filled.LibraryBooks
    val VocabularyOutlined = Icons.Outlined.LibraryBooks
    val Wallpaper = Icons.Filled.Wallpaper
    val Warning = Default.Warning
    val SwitchOn = Default.ToggleOn
}

@ThemePreviews
@Composable
fun AppIconsPreview() {
    val allIcons = AppIcons::class.java.declaredFields.mapNotNull {
        try {
            val icon = when (val value = it.get(AppIcons)) {
                is ImageVector -> value
                is Painter -> null // Cannot preview Painters directly in this setup
                else -> null
            } ?: return@mapNotNull null
            val name = it.name
            name to icon
        } catch (e: Exception) {
            null
        }
    }

    MaterialTheme {
        LazyVerticalGrid(
            columns = GridCells.Adaptive(minSize = 80.dp),
            modifier = Modifier.padding(8.dp),
            horizontalArrangement = Arrangement.spacedBy(8.dp),
            verticalArrangement = Arrangement.spacedBy(16.dp)
        ) {
            items(allIcons) { (name, icon) ->
                Column(
                    horizontalAlignment = Alignment.CenterHorizontally,
                    verticalArrangement = Arrangement.Center
                ) {
                    Icon(imageVector = icon, contentDescription = name)
                    Text(text = name, style = MaterialTheme.typography.bodySmall)
                }
            }
        }
    }
}