local M = {}
function M.get_highlight_groups()
    local palette = require("okcolors.palette")
    local highlight_groups = {
        base = {
            Normal = { fg = palette.tx, bg = palette.bg },
        },
        syntax_groups = {
            -- See :help group-name
            Comment        = { fg = palette.muted },

            Constant       = { fg = palette.cyan },
            String         = { fg = palette.green },
            Character      = { link = "String" },
            Number         = { link = "Constant" },
            Boolean        = { link = "Constant" },
            Float          = { link = "Constant" },

            Identifier     = { fg = palette.tx },
            Function       = { italic = true },

            Statement      = { fg = palette.purple },
            Conditional    = { link = "Statement" },
            Repeat         = { link = "Statement" },
            Label          = { link = "Statement" },
            Operator       = { fg = palette.tx },
            Keyword        = { link = "Statement" },
            Exception      = { fg = palette.orange },

            PreProc        = { fg = palette.yellow },
            Include        = { link = "PreProc" },
            Define         = { link = "PreProc" },
            Macro          = { link = "PreProc" },
            PreCondit      = { link = "PreProc" },

            Type           = { fg = palette.blue },
            StorageClass   = { link = "Type" },
            Structure      = { link = "Type" },
            Typedef        = { link = "Type" },

            Special        = { fg = palette.yellow },
            SpecialChar    = { link = "Special" },
            Tag            = { link = "Special" },
            Delimiter      = { fg = palette.muted },
            SpecialComment = { link = "Special" },
            Debug          = { fg = palette.orange },

            Underlined     = { fg = palette.blue, underline = true },

            Ignore         = { fg = palette.muted },

            Error          = { fg = palette.red, bold = true },

            Todo           = { fg = palette.yellow },

            Added          = { fg = palette.green },
            Changed        = { fg = palette.yellow },
            Removed        = { fg = palette.red },
        },
        -- See :help tresitter-highlight-groups
        tree_sitter = {
            ["@variable"]                            = { link = "Identifier" },
            ["@variable.builtin"]                    = { link = "Statement" },

            ["@constant"]                            = { link = "Constant" },
            ["@constant.builtin"]                    = { fg = palette.cyan, bold = true },

            ["@module"]                              = { link = "Include" },
            ["@label"]                               = { link = "Label" },

            ["@string"]                              = { link = "String" },
            ["@string.regexp"]                       = { fg = palette.yellow },
            ["@string.escape"]                       = { fg = palette.yellow },
            ["@string.special"]                      = { link = "Special" },
            ["@string.special.symbol"]               = { link = "Identifier" },
            ["@string.special.path"]                 = { link = "Directory" },
            ["@string.special.url"]                  = { link = "Underlined" },

            ["@character"]                           = { link = "Character" },
            ["@character.special"]                   = { link = "SpecialChar" },

            ["@boolean"]                             = { link = "Boolean" },
            ["@number"]                              = { link = "Number" },
            ["@number.float"]                        = { link = "Float" },

            ["@type"]                                = { link = "Type" },
            ["@type.builtin"]                        = { link = "@type" },

            ["@attribute"]                           = { link = "Constant" },
            ["@attribute.builtin"]                   = { link = "@attribute" },
            ["@property"]                            = { link = "Identifier" },

            ["@function"]                            = { link = "Function" },
            ["@function.builtin"]                    = { link = "@function" },
            ["@function.macro"]                      = { fg = palette.yellow, italic = true },

            ["@constructor"]                         = { link = "@type" },
            ["@operator"]                            = { link = "Operator" },

            ["@keyword"]                             = { link = "Keyword" },
            ["@keyword.debug"]                       = { link = "Debug" },
            ["@keyword.exception"]                   = { link = "Exception" },

            ["@keyword.directive"]                   = { link = "PreProc" },
            ["@keyword.directive.define"]            = { link = "Define" },

            ["@punctuation.delimiter"]               = { link = "Delimiter" },
            ["@punctuation.bracket"]                 = { fg = palette.subtle },
            ["@punctuation.special"]                 = { link = "Special" },

            ["@comment"]                             = { link = "Comment" },

            ["@comment.error"]                       = { fg = palette.red, bold = true },
            ["@comment.warning"]                     = { fg = palette.orange, bold = true },
            ["@comment.todo"]                        = { fg = palette.muted, bold = true },
            ["@comment.note"]                        = { fg = palette.muted, bold = true },

            ["@markup.strong"]                       = { bold = true },
            ["@markup.italic"]                       = { italic = true },
            ["@markup.strikethrough"]                = { strikethrough = true },
            ["@markup.underline"]                    = { underline = true },

            ["@markup.heading"]                      = { fg = palette.tx, bold = true },

            ["@markup.quote"]                        = { fg = palette.subtle },
            ["@markup.math"]                         = { link = "Special" },

            ["@markup.link"]                         = { fg = palette.blue },
            ["@markup.link.url"]                     = { link = "Underlined" },

            ["@markup.raw"]                          = { fg = palette.subtle },

            ["@markup.list"]                         = { fg = palette.tx },
            ["@markup.list.checked"]                 = { fg = palette.green },
            ["@markup.list.unchecked"]               = { fg = palette.tx },

            ["@diff.delta"]                          = { link = "DiffChange" },
            ["@diff.minus"]                          = { link = "DiffDelete" },
            ["@diff.plus"]                           = { link = "DiffAdd" },

            ["@tag"]                                 = { link = "Tag" },
            ["@tag.attribute"]                       = { link = "@variable.parameter" },
            ["@tag.delimiter"]                       = { link = "delimiter" },

            --- Non-highlighting captures
            ["@conceal"]                             = { link = "Conceal" },
            --- Semantic
            ["@lsp.type.enum"]                       = { link = "@type" },
            ["@lsp.type.interface"]                  = { link = "@interface" },
            ["@lsp.type.keyword"]                    = { link = "@keyword" },
            ["@lsp.type.namespace"]                  = { link = "@namespace" },
            ["@lsp.type.namespace.python"]           = { link = "@variable" },
            ["@lsp.type.parameter"]                  = { link = "@parameter" },
            ["@lsp.type.property"]                   = { link = "@property" },
            ["@lsp.type.variable"]                   = {},
            ["@lsp.typemod.function.defaultLibrary"] = { link = "@function.builtin" },
            ["@lsp.typemod.operator.injected"]       = { link = "@operator" },
            ["@lsp.typemod.string.injected"]         = { link = "@string" },
            ["@lsp.typemod.variable.constant"]       = { link = "@constant" },
            ["@lsp.typemod.variable.defaultLibrary"] = { link = "@variable.builtin" },
            ["@lsp.typemod.variable.injected"]       = { link = "@variable" },
        },
        ui = {
            -- See :help highlight-groups
            ColorColumn       = { bg = palette.surface },
            Conceal           = { fg = palette.subtle, bg = "NONE" },
            CurSearch         = { fg = palette.bg, bg = palette.magenta },
            Cursor            = { fg = palette.tx, bg = palette.hilite_hi },
            CursorColumn      = { bg = palette.overlay },
            CursorLine        = { bg = palette.overlay },
            CursorLineNr      = { fg = palette.subtle, bold = true },
            Directory         = { fg = palette.blue },
            ErrorMsg          = { fg = palette.red, bold = true },
            FloatBorder       = { fg = palette.blue, bg = palette.surface },
            FloatTitle        = { bold = true, bg = palette.surface },
            FoldColumn        = { fg = palette.subtle },
            Folded            = { bg = palette.hilite_lo },
            IncSearch         = { link = "CurSearch" },
            LineNr            = { fg = palette.muted },
            MatchParen        = { bg = palette.overlay },
            ModeMsg           = { fg = palette.subtle },
            MoreMsg           = { fg = palette.green },
            NonText           = { fg = palette.muted },
            NormalFloat       = { fg = palette.tx, bg = palette.surface },
            NormalNC          = { link = "Normal" },
            NvimInternalError = { link = "ErrorMsg" },
            Pmenu             = { fg = palette.tx, bg = palette.surface },
            PmenuExtra        = { fg = palette.muted, bg = palette.surface },
            PmenuExtraSel     = { fg = palette.subtle, bg = palette.surface },
            PmenuKind         = { fg = palette.green, bg = palette.surface },
            PmenuKindSel      = { fg = palette.subtle, bg = palette.overlay },
            PmenuSbar         = { bg = palette.surface },
            PmenuSel          = { fg = palette.tx, bg = palette.overlay, bold = true },
            PmenuThumb        = { bg = palette.muted },
            Question          = { fg = palette.yellow },
            QuickFixLine      = { fg = palette.magenta, bg = palette.overlay, bold = true },
            Search            = { fg = palette.magenta, bold = true, underline = true },
            SignColumn        = { fg = palette.tx },
            SpecialKey        = { fg = palette.blue },
            StatusLine        = { fg = palette.tx, bg = palette.hilite_lo },
            StatusLineNC      = { fg = palette.muted, bg = palette.surface },
            StatusLineTerm    = { fg = palette.bg, bg = palette.green },
            StatusLineTermNC  = { fg = palette.muted, bg = palette.surface },
            Substitute        = { link = "IncSearch" },
            TabLine           = { fg = palette.subtle, bg = palette.surface },
            TabLineFill       = { bg = palette.surface },
            TabLineSel        = { fg = palette.tx, bg = palette.overlay, bold = true },
            Title             = { bold = true },
            Visual            = { bg = palette.hilite_mid },
            WarningMsg        = { fg = palette.red, bold = true },
            WildMenu          = { link = "IncSearch" },
            WinBar            = { link = "StatusLine" },
            WinBarNC          = { link = "StatusLineNC" },
            WinSeparator      = { fg = palette.hilite_hi },
        },
        diagnostics = {
            DiagnosticDeprecated       = { sp = palette.red, undercurl = true },
            DiagnosticError            = { fg = palette.red },
            DiagnosticHint             = { fg = palette.yellow },
            DiagnosticInfo             = { fg = palette.blue },
            DiagnosticOk               = { fg = palette.green },
            DiagnosticWarn             = { fg = palette.orange },
            DiagnosticUnderlineError   = { sp = palette.red, undercurl = true },
            DiagnosticUnderlineHint    = { sp = palette.yellow, undercurl = true },
            DiagnosticUnderlineInfo    = { sp = palette.blue, undercurl = true },
            DiagnosticUnderlineOk      = { sp = palette.green, undercurl = true },
            DiagnosticUnderlineWarn    = { sp = palette.orange, undercurl = true },
            DiagnosticVirtualTextError = { fg = palette.red, sp = palette.red, underline = true },
            DiagnosticVirtualTextHint  = { fg = palette.yellow, sp = palette.yellow, underline = true },
            DiagnosticVirtualTextInfo  = { fg = palette.blue, sp = palette.blue, underline = true },
            DiagnosticVirtualTextWarn  = { fg = palette.orange, sp = palette.orange, underline = true },

            DiagnosticDefaultError     = { link = "DiagnosticError" },
            DiagnosticDefaultHint      = { link = "DiagnosticHint" },
            DiagnosticDefaultInfo      = { link = "DiagnosticInfo" },
            DiagnosticDefaultWarn      = { link = "DiagnosticWarn" },
            DiagnosticFloatingError    = { link = "DiagnosticError" },
            DiagnosticFloatingHint     = { link = "DiagnosticHint" },
            DiagnosticFloatingInfo     = { link = "DiagnosticInfo" },
            DiagnosticFloatingWarn     = { link = "DiagnosticWarn" },
            DiagnosticSignError        = { link = "DiagnosticError" },
            DiagnosticSignHint         = { link = "DiagnosticHint" },
            DiagnosticSignInfo         = { link = "DiagnosticInfo" },
            DiagnosticSignWarn         = { link = "DiagnosticWarn" },
        },
        diffs = {
            DiffText       = { fg = palette.yellow, bold = true },

            DiffAdd        = { link = "Added" },
            DiffChange     = { link = "Changed" },
            DiffDelete     = { link = "Removed" },
            GitSignsAdd    = { link = "DiffAdd" },
            GitSignsChange = { link = "DiffChange" },
            GitSignsDelete = { link = "DiffDelete" },
            diffAdded      = { link = "DiffAdd" },
            diffChanged    = { link = "DiffChange" },
            diffRemoved    = { link = "DiffDelete" },
        },
        spell = {
            SpellBad   = { sp = palette.red, undercurl = true },
            SpellCap   = { sp = palette.yellow, undercurl = true },
            SpellLocal = { sp = palette.green, undercurl = true },
            SpellRare  = { sp = palette.cyan, undercurl = true },
        },
        telescope = {
            TelescopeBorder       = { link = "FloatBorder" },
            TelescopeTitle        = { link = "FloatTitle" },
            TelescopeNormal       = { link = "NormalFloat" },
            TelescopePreviewMatch = { link = "IncSearch" },
            TelescopeMatching     = { link = "Search" },
        },
        cmp = {
            CmpItemAbbr           = { fg = palette.subtle },
            CmpItemAbbrDeprecated = { fg = palette.subtle, strikethrough = true },
            CmpItemAbbrMatch      = { fg = palette.tx, bold = true },
            CmpItemAbbrMatchFuzzy = { fg = palette.tx, bold = true },
            CmpItemKind           = { fg = palette.subtle },

            CmpItemKindClass      = { link = "StorageClass" },
            CmpItemKindFunction   = { link = "Function" },
            CmpItemKindInterface  = { link = "Type" },
            CmpItemKindMethod     = { link = "PreProc" },
            CmpItemKindSnippet    = { link = "String" },
            CmpItemKindVariable   = { link = "Identifier" },
        },
        blink = {
            BlinkCmpDefault             = { fg = palette.highlight_med },
            BlinkCmpKindText            = { fg = palette.blue },
            BlinkCmpGhostText           = { fg = palette.muted },
            BlinkCmpLabel               = { fg = palette.muted },
            BlinkCmpLabelDeprecated     = { fg = palette.muted, strikethrough = true },
            BlinkCmpLabelMatch          = { fg = palette.tx, bold = true },
            BlinkCmpDoc                 = { link = "NormalFloat" },
            BlinkCmpDocBorder           = { link = "FloatBorder" },
            BlinkCmpSignatureHelpBorder = { link = "FloatBorder" },
            BlinkCmpKindMethod          = { link = "@function" },
            BlinkCmpKindFunction        = { link = "@function.method" },
            BlinkCmpKindConstructor     = { link = "@constructor" },
            BlinkCmpKindField           = { link = "@variable.member" },
            BlinkCmpKindVariable        = { link = "@variable" },
            BlinkCmpKindClass           = { link = "@type" },
            BlinkCmpKindInterface       = { link = "@interface" },
            BlinkCmpKindModule          = { link = "@module" },
            BlinkCmpKindProperty        = { link = "@property" },
            BlinkCmpKindUnit            = { link = "@variable" },
            BlinkCmpKindValue           = { link = "@constant" },
            BlinkCmpKindKeyword         = { link = "@keyword" },
            BlinkCmpKindSnippet         = { link = "@function" },
            BlinkCmpKindColor           = { link = "Identifier" },
            BlinkCmpKindFile            = { link = "@string.special.path" },
            BlinkCmpKindReference       = { link = "Identifier" },
            BlinkCmpKindFolder          = { link = "@string.special.path" },
            BlinkCmpKindEnum            = { link = "@type" },
            BlinkCmpKindEnumMember      = { link = "@type" },
            BlinkCmpKindConstant        = { link = "@constant" },
            BlinkCmpKindStruct          = { link = "@type" },
            BlinkCmpKindEvent           = { link = "Identifier" },
            BlinkCmpKindOperator        = { link = "@operator" },
            BlinkCmpKindTypeParameter   = { link = "@variable.parameter" },
        },
    }
    return highlight_groups
end

return M
