package com.tt.honeyDue.ui.theme

import androidx.compose.ui.graphics.Color

/**
 * Data class representing a complete theme's color palette
 * Matches the iOS theme system with 11 themes
 */
data class ThemeColors(
    val id: String,
    val displayName: String,
    val description: String,

    // Light mode colors
    val lightPrimary: Color,
    val lightSecondary: Color,
    val lightAccent: Color,
    val lightError: Color,
    val lightBackgroundPrimary: Color,
    val lightBackgroundSecondary: Color,
    val lightTextPrimary: Color,
    val lightTextSecondary: Color,
    val lightTextOnPrimary: Color,

    // Dark mode colors
    val darkPrimary: Color,
    val darkSecondary: Color,
    val darkAccent: Color,
    val darkError: Color,
    val darkBackgroundPrimary: Color,
    val darkBackgroundSecondary: Color,
    val darkTextPrimary: Color,
    val darkTextSecondary: Color,
    val darkTextOnPrimary: Color
)

/**
 * All available themes matching iOS implementation
 */
object AppThemes {
    val Default = ThemeColors(
        id = "default",
        displayName = "Default",
        description = "Vibrant iOS system colors",

        // Light mode
        lightPrimary = Color(0xFF0079FF),
        lightSecondary = Color(0xFF5AC7F9),
        lightAccent = Color(0xFFFF9400),
        lightError = Color(0xFFFF3A2F),
        lightBackgroundPrimary = Color(0xFFFFFFFF),
        lightBackgroundSecondary = Color(0xFFF1F7F7),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF3C3C3C),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFF0984FF),
        darkSecondary = Color(0xFF63D2FF),
        darkAccent = Color(0xFFFF9F09),
        darkError = Color(0xFFFF4539),
        darkBackgroundPrimary = Color(0xFF1C1C1C),
        darkBackgroundSecondary = Color(0xFF2C2C2C),
        darkTextPrimary = Color(0xFFFFFFFF),
        darkTextSecondary = Color(0xFFEBEBEB),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Teal = ThemeColors(
        id = "teal",
        displayName = "Teal",
        description = "Blue-green with warm accents",

        // Light mode
        lightPrimary = Color(0xFF069FC3),
        lightSecondary = Color(0xFF0054A4),
        lightAccent = Color(0xFFEFC707),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFFFF0D0),
        lightBackgroundSecondary = Color(0xFFFFFFFF),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFF60CCE2),
        darkSecondary = Color(0xFF60A5D8),
        darkAccent = Color(0xFFEFC707),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF091829),
        darkBackgroundSecondary = Color(0xFF1A2E3E),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Ocean = ThemeColors(
        id = "ocean",
        displayName = "Ocean",
        description = "Deep blues and coral tones",

        // Light mode
        lightPrimary = Color(0xFF006B8F),
        lightSecondary = Color(0xFF008A8A),
        lightAccent = Color(0xFFFF7E50),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFE4EBF1),
        lightBackgroundSecondary = Color(0xFFBCCAD5),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFF49B5D1),
        darkSecondary = Color(0xFF60D1C6),
        darkAccent = Color(0xFFFF7E50),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF161B22),
        darkBackgroundSecondary = Color(0xFF313A4B),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Forest = ThemeColors(
        id = "forest",
        displayName = "Forest",
        description = "Earth greens and golden hues",

        // Light mode
        lightPrimary = Color(0xFF2C5015),
        lightSecondary = Color(0xFF6B8E22),
        lightAccent = Color(0xFFFFD600),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFEBEEE2),
        lightBackgroundSecondary = Color(0xFFC1C8AD),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFF93C66B),
        darkSecondary = Color(0xFFAFD182),
        darkAccent = Color(0xFFFFD600),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF181E17),
        darkBackgroundSecondary = Color(0xFF384436),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Sunset = ThemeColors(
        id = "sunset",
        displayName = "Sunset",
        description = "Warm oranges and reds",

        // Light mode
        lightPrimary = Color(0xFFFF4500),
        lightSecondary = Color(0xFFFF6246),
        lightAccent = Color(0xFFFFD600),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFF7F0E8),
        lightBackgroundSecondary = Color(0xFFDCD0BA),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFFFF9E60),
        darkSecondary = Color(0xFFFFAD7C),
        darkAccent = Color(0xFFFFD600),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF201813),
        darkBackgroundSecondary = Color(0xFF433329),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Monochrome = ThemeColors(
        id = "monochrome",
        displayName = "Monochrome",
        description = "Elegant grayscale",

        // Light mode
        lightPrimary = Color(0xFF333333),
        lightSecondary = Color(0xFF666666),
        lightAccent = Color(0xFF999999),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFF0F0F0),
        lightBackgroundSecondary = Color(0xFFD4D4D4),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFFE5E5E5),
        darkSecondary = Color(0xFFBFBFBF),
        darkAccent = Color(0xFFD1D1D1),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF161616),
        darkBackgroundSecondary = Color(0xFF3B3B3B),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Lavender = ThemeColors(
        id = "lavender",
        displayName = "Lavender",
        description = "Soft purple with pink accents",

        // Light mode
        lightPrimary = Color(0xFF6B418A),
        lightSecondary = Color(0xFF8A60AF),
        lightAccent = Color(0xFFE24982),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFF1EFF5),
        lightBackgroundSecondary = Color(0xFFD9D1DF),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFFD1AFE2),
        darkSecondary = Color(0xFFDDBFEA),
        darkAccent = Color(0xFFFF9EC6),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF17131E),
        darkBackgroundSecondary = Color(0xFF393042),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Crimson = ThemeColors(
        id = "crimson",
        displayName = "Crimson",
        description = "Bold red with warm highlights",

        // Light mode
        lightPrimary = Color(0xFFB51E28),
        lightSecondary = Color(0xFF992D38),
        lightAccent = Color(0xFFE26000),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFF6EDEB),
        lightBackgroundSecondary = Color(0xFFDECFCC),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFFFF827C),
        darkSecondary = Color(0xFFF99993),
        darkAccent = Color(0xFFFFB56B),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF1B1215),
        darkBackgroundSecondary = Color(0xFF412E39),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Midnight = ThemeColors(
        id = "midnight",
        displayName = "Midnight",
        description = "Deep navy with sky blue",

        // Light mode
        lightPrimary = Color(0xFF1E4993),
        lightSecondary = Color(0xFF2D60AF),
        lightAccent = Color(0xFF4993E2),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFEDF0F7),
        lightBackgroundSecondary = Color(0xFFCCD5E2),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFF82B5EA),
        darkSecondary = Color(0xFF93C6F2),
        darkAccent = Color(0xFF9ED8FF),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF12161F),
        darkBackgroundSecondary = Color(0xFF2F3848),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Desert = ThemeColors(
        id = "desert",
        displayName = "Desert",
        description = "Warm terracotta and sand tones",

        // Light mode
        lightPrimary = Color(0xFFAF6049),
        lightSecondary = Color(0xFF9E7C60),
        lightAccent = Color(0xFFD1932D),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFF6F0EA),
        lightBackgroundSecondary = Color(0xFFE5D8C6),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFFF2B593),
        darkSecondary = Color(0xFFEAD1AF),
        darkAccent = Color(0xFFFFD86B),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF1F1C16),
        darkBackgroundSecondary = Color(0xFF494138),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    val Mint = ThemeColors(
        id = "mint",
        displayName = "Mint",
        description = "Fresh green with turquoise",

        // Light mode
        lightPrimary = Color(0xFF38AF93),
        lightSecondary = Color(0xFF60C6AF),
        lightAccent = Color(0xFF2D9EAF),
        lightError = Color(0xFFDD1C1A),
        lightBackgroundPrimary = Color(0xFFEDF6F0),
        lightBackgroundSecondary = Color(0xFFD1E2D8),
        lightTextPrimary = Color(0xFF111111),
        lightTextSecondary = Color(0xFF444444),
        lightTextOnPrimary = Color(0xFFFFFFFF),

        // Dark mode
        darkPrimary = Color(0xFF93F2D8),
        darkSecondary = Color(0xFFBFF9EA),
        darkAccent = Color(0xFF6BEAF2),
        darkError = Color(0xFFFF5244),
        darkBackgroundPrimary = Color(0xFF161F1F),
        darkBackgroundSecondary = Color(0xFF384949),
        darkTextPrimary = Color(0xFFF5F5F5),
        darkTextSecondary = Color(0xFFC6C6C6),
        darkTextOnPrimary = Color(0xFFFFFFFF)
    )

    /**
     * List of all available themes
     */
    val allThemes = listOf(
        Default, Teal, Ocean, Forest, Sunset, Monochrome,
        Lavender, Crimson, Midnight, Desert, Mint
    )

    /**
     * Get theme by ID
     */
    fun getThemeById(id: String): ThemeColors {
        return allThemes.find { it.id == id } ?: Default
    }
}
