import type { editor } from 'monaco-editor'

/**
 * Dark theme for ResolutionFlow markdown syntax.
 * Matches the monochrome design system with functional color for node types.
 */
export const resolutionFlowTheme: editor.IStandaloneThemeData = {
  base: 'vs-dark',
  inherit: true,
  rules: [
    // Frontmatter
    { token: 'delimiter.frontmatter', foreground: '6b7280' },
    { token: 'keyword.frontmatter', foreground: '9ca3af' },
    { token: 'string.id', foreground: 'e5e7eb', fontStyle: 'bold' },
    { token: 'type.value', foreground: '60a5fa' },
    { token: 'string.parent', foreground: 'a78bfa' },

    // Headings
    { token: 'heading.decision', foreground: '60a5fa', fontStyle: 'bold' },
    { token: 'heading.action', foreground: 'fbbf24', fontStyle: 'bold' },

    // Options
    { token: 'keyword.option', foreground: '60a5fa' },
    { token: 'string.option', foreground: 'e5e7eb' },

    // References
    { token: 'variable.reference', foreground: 'a78bfa' },

    // Variables
    { token: 'variable.input', foreground: 'fb923c', fontStyle: 'bold' },
    { token: 'variable.save', foreground: 'fb923c' },

    // Commands
    { token: 'delimiter.commands', foreground: '6b7280' },
    { token: 'string.command', foreground: '34d399' },

    // Expected outcome
    { token: 'keyword.expected', foreground: '34d399' },

    // Ordered list
    { token: 'keyword.step', foreground: '9ca3af' },

    // Help text
    { token: 'string.blockquote', foreground: '9ca3af', fontStyle: 'italic' },

    // Formatting
    { token: 'strong', fontStyle: 'bold' },
    { token: 'string.code', foreground: '34d399' },

    // Default
    { token: 'text', foreground: 'd1d5db' },
  ],
  colors: {
    'editor.background': '#0a0a0a',
    'editor.foreground': '#d1d5db',
    'editor.lineHighlightBackground': '#ffffff08',
    'editor.selectionBackground': '#ffffff20',
    'editorCursor.foreground': '#ffffff',
    'editor.inactiveSelectionBackground': '#ffffff10',
    'editorLineNumber.foreground': '#4b5563',
    'editorLineNumber.activeForeground': '#9ca3af',
    'editorGutter.background': '#0a0a0a',
    'editorWidget.background': '#111111',
    'editorWidget.border': '#ffffff10',
    'editorSuggestWidget.background': '#111111',
    'editorSuggestWidget.border': '#ffffff10',
    'editorSuggestWidget.selectedBackground': '#ffffff15',
  },
}

export const THEME_ID = 'resolutionflow-dark'
