local M = {}

--- generate lsp highlights table
-- @param colors color (theme) color table created by require("leaf.colors").setup()
-- @param config config options (optional)
function M.setup(colors, config)
    return {
        ["@lsp.type.class"] = { link = "Structure" },
        ["@lsp.type.comment"] = { link = "Comment" },
        ["@lsp.type.decorator"] = { link = "Function" },
        ["@lsp.type.enum"] = { link = "Structure" },
        ["@lsp.type.enumMember"] = { link = "Constant" },
        ["@lsp.type.function"] = { link = "Function" },
        ["@lsp.type.interface"] = { link = "Structure" },
        ["@lsp.type.keyword"] = { link = "Keyword" },
        ["@lsp.type.macro"] = { link = "Macro" },
        ["@lsp.type.method"] = { link = "Function" },
        ["@lsp.type.modifier"] = { link = "Function" },
        ["@lsp.type.namespace"] = { link = "Structure" },
        ["@lsp.type.number"] = { link = "Number" },
        ["@lsp.type.parameter"] = { link = "Identifier" },
        ["@lsp.type.property"] = { link = "Identifier" },
        ["@lsp.type.regexp"] = { link = "Regexp" },
        ["@lsp.type.operator"] = { link = "Operator" },
        ["@lsp.type.punctuation"] = { link = "Delimiter" },
        ["@lsp.type.struct"] = { link = "Structure" },
        ["@lsp.type.string"] = { link = "String" },
        ["@lsp.type.type"] = { link = "Type" },
        ["@lsp.type.typeParameter"] = { link = "TypeDef" },
        ["@lsp.type.variable"] = { link = "Identifier" },
        ["@lsp.mod.documentation"] = { link = "SpecialComment" },
        ["@lsp.mod.delimiter"] = { link = "Delimiter" },
        DiagnosticError = { link = "Error" },
        DiagnosticWarn = { link = "Warning" },
        DiagnosticInfo = { link = "Info" },
        DiagnosticHint = { link = "Hint" },
        DiagnosticFloatingError = { link = "DiagnosticError" },
        DiagnosticFloatingWarn = { link = "DiagnosticWarn" },
        DiagnosticFloatingInfo = { link = "DiagnosticInfo" },
        DiagnosticFloatingHint = { link = "DiagnosticHint" },
        DiagnosticSignError = { link = "DiagnosticError" },
        DiagnosticSignWarn = { link = "DiagnosticWarn" },
        DiagnosticSignInfo = { link = "DiagnosticInfo" },
        DiagnosticSignHint = { link = "DiagnosticHint" },
        DiagnosticVirtualTextError = { link = "DiagnosticError" },
        DiagnosticVirtualTextWarn = { link = "DiagnosticWarn" },
        DiagnosticVirtualTextInfo = { link = "DiagnosticInfo" },
        DiagnosticVirtualTextHint = { link = "DiagnosticHint" },
        DiagnosticUnderlineError = { style = config.underlineStyle, guisp = colors.red0 },
        DiagnosticUnderlineWarn = { style = config.underlineStyle, guisp = colors.yellow0 },
        DiagnosticUnderlineInfo = { style = config.underlineStyle, guisp = colors.blue0 },
        DiagnosticUnderlineHint = { style = config.underlineStyle, guisp = colors.teal0 },
        LspDiagnosticsDefaultError = { link = "DiagnosticError" },
        LspDiagnosticsDefaultWarning = { link = "DiagnosticWarn" },
        LspDiagnosticsDefaultInformation = { link = "DiagnosticInfo" },
        LspDiagnosticsDefaultHint = { link = "DiagnosticHint" },
        LspDiagnosticsError = { link = "DiagnosticError" },
        LspDiagnosticsWarning = { link = "DiagnosticWarn" },
        LspDiagnosticsInformation = { link = "DiagnosticInfo" },
        LspDiagnosticsHint = { link = "DiagnosticHint" },
        LspDiagnosticsVirtualTextError = { link = "DiagnosticError" },
        LspDiagnosticsVirtualTextWarning = { link = "DiagnosticWarn" },
        LspDiagnosticsVirtualTextInformation = { link = "DiagnosticInfo" },
        LspDiagnosticsVirtualTextHint = { link = "DiagnosticHint" },
        LspDiagnosticsUnderlineError = {
            style = config.underlineStyle,
            guisp = colors.red0,
        },
        LspDiagnosticsUnderlineWarning = {
            style = config.underlineStyle,
            guisp = colors.yellow0,
        },
        LspDiagnosticsUnderlineInformation = {
            style = config.underlineStyle,
            guisp = colors.blue0,
        },
        LspDiagnosticsUnderlineHint = {
            style = config.underlineStyle,
            guisp = colors.teal0,
        },
        LspReferenceText = { fg = colors.bg0, bg = colors.brown0 },
        LspReferenceRead = { link = "LspReferenceText" },
        LspReferenceWrite = { link = "LspReferenceText" },
        LspSignatureActiveParameter = { fg = colors.teal1 },
        LspCodeLens = { fg = colors.bg2 },
        LspInlayHint = { fg = colors.bg3 },
        LspInfoBorder = { link = "FloatBorder" },
    }
end

return M
