-- This work is originally based on and modified from https://github.com/folke/tokyonight.nvim.

local util = require("github-monochrome.util")

local M = {}

---@type gm.HighlightsFn
function M.get(c, opts)
  -- stylua: ignore
  return {
    Foo                         = { bg = c.purple, fg = c.fg },
    Comment                     = { fg = c.comment, style = opts.styles.comments },
    ColorColumn                 = { bg = c.black },
    Conceal                     = { fg = c.text_muted },
    Cursor                      = { fg = c.bg, bg = c.fg },
    lCursor                     = { fg = c.bg, bg = c.fg },
    CursorIM                    = { fg = c.bg, bg = c.fg },
    CursorColumn                = { bg = c.bg },
    CursorLine                  = { bg = opts.transparent and c.highlight or c.bg_highlight },
    Directory                   = { fg = c.fg, },
    DiffAdd                     = { bg = c.diff.add },
    DiffChange                  = { bg = c.diff.change },
    DiffDelete                  = { bg = c.diff.delete },
    DiffText                    = { bg = c.diff.text },
    EndOfBuffer                 = { fg = c.bg },
    ErrorMsg                    = { fg = c.error },
    VertSplit                   = { fg = c.border },
    WinSeparator                = { fg = c.border, },
    Folded                      = { fg = c.blue, bg = c.bg_dark },
    FoldColumn                  = { bg = opts.transparent and c.none or c.bg, fg = c.comment },
    SignColumn                  = { fg = c.fg_gutter },
    SignColumnSB                = { bg = c.bg_sidebar, fg = c.fg_gutter },
    Substitute                  = { bg = c.red, fg = c.black },
    LineNr                      = { fg = c.fg_gutter },
    CursorLineNr                = { fg = c.purple, bold = true },
    LineNrAbove                 = { fg = c.fg_gutter },
    LineNrBelow                 = { fg = c.fg_gutter },
    MatchParen                  = { fg = c.match_paren_fg, bold = true, bg = c.match_paren_bg },
    ModeMsg                     = { fg = c.fg_dark, },
    MsgArea                     = { fg = c.fg_dark },
    MoreMsg                     = { fg = c.fg, },
    NonText                     = { fg = c.nontext },
    Normal                      = { fg = c.fg, bg = opts.transparent and c.none or c.bg },
    NormalNC                    = { fg = c.fg, bg = opts.transparent and c.none or c.bg },
    NormalSB                    = { fg = c.fg_sidebar, bg = c.bg_sidebar },
    NormalFloat                 = { fg = c.fg_float, bg = c.bg_float },
    FloatBorder                 = { fg = c.border_highlight, bg = c.bg_float },
    FloatTitle                  = { fg = c.border_highlight, bg = c.bg_float },
    Pmenu                       = { bg = c.bg_popup, fg = c.fg },
    PmenuMatch                  = { bg = c.bg_popup, fg = c.magenta },
    PmenuSel                    = { bg = opts.transparent and c.visual or util.blend_bg(c.fg_gutter, 0.5) },
    PmenuMatchSel               = { bg =  opts.transparent and c.visual or util.blend_bg(c.fg_gutter, 0.5), fg = c.magenta },
    PmenuSbar                   = { bg = util.blend_fg(c.bg_popup, 0.95) },
    PmenuThumb                  = { bg = c.fg_gutter },
    Question                    = { fg = c.fg, },
    QuickFixLine                = { bg = c.bg_visual, bold = true },
    Search                      = { bg = c.bg_search, fg = c.fg_search },
    IncSearch                   = { bg = c.orange, fg = c.black },
    CurSearch                   = "IncSearch",
    SpecialKey                  = { fg = c.text_muted },
    SpellBad                    = { sp = c.error, undercurl = true },
    SpellCap                    = { sp = c.warning, undercurl = true },
    SpellLocal                  = { sp = c.info, undercurl = true },
    SpellRare                   = { sp = c.hint, undercurl = true },
    StatusLine                  = { fg = c.fg_sidebar, bg = opts.transparent and c.none or c.bg_statusline },
    StatusLineNC                = { fg = c.fg_gutter, bg = opts.transparent and c.none or c.bg_statusline },
    TabLine                     = { bg = c.bg_highlight, fg = c.fg_gutter },
    TabLineFill                 = { bg = opts.transparent and c.none or c.bg_highlight },
    TabLineSel                  = { fg = c.fg, bold = true, bg = c.bg_dark },
    Title                       = { fg = c.fg, bold = true },
    Visual                      = { bg = c.bg_visual },
    VisualNOS                   = { bg = c.bg_visual },
    WarningMsg                  = { fg = c.warning },
    Whitespace                  = { fg = c.fg_gutter },
    WildMenu                    = { bg = c.bg_visual },
    WinBar                      = "StatusLine",
    WinBarNC                    = "StatusLineNC",

    Bold                        = { bold = true, fg = c.fg },
    Character                   = { fg = c.fg, },
    Constant                    = { fg = c.fg, },
    Debug                       = { fg = c.orange },
    Delimiter                   = "Special",
    Error                       = { fg = c.error },
    Float                       = { fg = c.number },
    Number                      = { fg = c.number },
    Function                    = { fg = c.fg, style = opts.styles.functions },
    Identifier                  = { fg = c.fg, bold = true, style = opts.styles.variables },
    Italic                      = { italic = true, fg = c.fg },
    Keyword                     = { fg = c.fg, style = opts.styles.keywords },
    Operator                    = { fg = c.fg },
    PreProc                     = { fg = c.fg },
    Special                     = { fg = c.fg },
    Statement                   = { fg = c.fg, style = opts.styles.statements },
    String                      = { fg = c.string },
    Todo                        = { bg = c.yellow, fg = c.bg },
    Type                        = { fg = c.fg, bold = true, },
    Underlined                  = { underline = true },
    debugBreakpoint             = { bg = util.blend_bg(c.info, 0.1), fg = c.info },
    debugPC                     = { bg = c.bg_sidebar },
    dosIniLabel                 = "@property",
    helpCommand                 = { bg = c.bg_dark, fg = c.fg },
    htmlH1                      = { fg = c.magenta, bold = true },
    htmlH2                      = { fg = c.fg, bold = true },
    qfFileName                  = { fg = c.fg },
    qfLineNr                    = { fg = c.text_muted },

    -- These groups are for the native LSP client. Some other LSP clients may
    -- use these groups, or use their own.
    LspReferenceText            = { bg = c.fg_gutter },
    LspReferenceRead            = { bg = c.fg_gutter },
    LspReferenceWrite           = { bg = c.fg_gutter },
    LspSignatureActiveParameter = { bg = util.blend_bg(c.bg_visual, 0.4), bold = true },
    LspCodeLens                 = { fg = c.comment },
    LspInlayHint                = { bg = util.blend_bg(c.fg, 0.05), fg = c.hint_fg },
    LspInfoBorder               = { fg = c.border_highlight, bg = c.bg_float },

    -- diagnostics
    DiagnosticError             = { fg = c.error },
    DiagnosticWarn              = { fg = c.warning },
    DiagnosticInfo              = { fg = c.info },
    DiagnosticHint              = { fg = c.hint },
    DiagnosticUnnecessary       = { fg = c.magenta },
    DiagnosticVirtualTextError  = { bg = util.blend_bg(c.error, 0.1), fg = c.error },
    DiagnosticVirtualTextWarn   = { bg = util.blend_bg(c.warning, 0.1), fg = c.warning },
    DiagnosticVirtualTextInfo   = { bg = util.blend_bg(c.info, 0.1), fg = c.info },
    DiagnosticVirtualTextHint   = { bg = util.blend_bg(c.hint, 0.1), fg = c.hint },
    DiagnosticUnderlineError    = { undercurl = true, sp = c.error },
    DiagnosticUnderlineWarn     = { undercurl = true, sp = c.warning },
    DiagnosticUnderlineInfo     = { undercurl = true, sp = c.info },
    DiagnosticUnderlineHint     = { undercurl = true, sp = c.hint },

    -- Health
    healthError                 = { fg = c.error },
    healthSuccess               = { fg = c.green },
    healthWarning               = { fg = c.warning },

    -- diff
    diffAdded                   = { fg = c.git.add },
    diffRemoved                 = { fg = c.git.delete },
    diffChanged                 = { fg = c.git.change },
    diffOldFile                 = { fg = c.yellow },
    diffNewFile                 = { fg = c.orange },
    diffFile                    = { fg = c.blue },
    diffLine                    = { fg = c.comment },
    diffIndexLine               = { fg = c.magenta },
    helpExample                 = { fg = c.comment },

    -- gitcommit
    gitcommitSummary           = { fg = c.fg, italic = true },
    gitcommitFirstLine         = { fg = c.fg, italic = true },
  }
end

return M
