local M = {}
local cmd = vim.api.nvim_command

function M.highlight(group, guifg, guibg, attr, guisp)
    local fg = guifg ~= '' and 'guifg=' .. guifg or 'guifg=NONE'
    local bg = guibg ~= '' and 'guibg=' .. guibg or 'guibg=NONE'
    local style = attr ~= '' and 'gui=' .. attr or 'gui=NONE'
    local sp = guisp ~= '' and 'guisp=' .. guisp or ''

    cmd('hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp)
end

function M.load_autocmd(definitions)
    for group_name, definition in pairs(definitions) do
        cmd('augroup ' .. group_name)
        cmd('autocmd!')
        for _, def in ipairs(definition) do
            local command = table.concat(vim.tbl_flatten { 'autocmd', def }, ' ')
            cmd(command)
        end
        cmd('augroup END')
    end
end

-- I only use these 3 styles
M.border_styles = {
    single = { '┌', '─', '┐', '│', '┘', '─', '└', '│' },
    rounded = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' },
    double = { '╔', '═', '╗', '║', '╝', '═', '╚', '║' },
}

return M
