/**
 * Curated theme presets shipped with the design system.
 *
 * @countermeasure-platform/web-components/services/theme-engine
 */

import type { Theme, ThemePreset } from './types'

export const THEME_PRESETS: ThemePreset[] = [
  {
    id: 'mission-control',
    label: 'Mission Control',
    description: 'CounterMeasure default — dark, restrained, orange accent.',
    theme: {
      mode: 'dark',
      accent: 'orange',
      font: 'inter',
      iconSet: 'lucide',
      density: 'comfortable',
      radius: 8,
      transparency: 0.04,
      iconOverrides: {},
    },
  },
  {
    id: 'glass-violet',
    label: 'Frost & Violet',
    description: 'Glassy surfaces with a violet glow. Operations + intel.',
    theme: {
      mode: 'glass',
      accent: 'violet',
      font: 'sora',
      iconSet: 'phosphor',
      density: 'comfortable',
      radius: 12,
      transparency: 0.1,
      iconOverrides: {},
    },
  },
  {
    id: 'monokai',
    label: 'Monokai',
    description: 'Pure black, IDE-like. For detection engineers.',
    theme: {
      mode: 'monokai',
      accent: 'emerald',
      font: 'jetbrainsMono',
      iconSet: 'countermeasure',
      density: 'compact',
      radius: 4,
      transparency: 0.04,
      iconOverrides: {},
    },
  },
  {
    id: 'cyan-mint',
    label: 'Cyan Mint',
    description: 'Cooler dark surfaces, cyan accent — daytime ops.',
    theme: {
      mode: 'dark',
      accent: 'cyan',
      font: 'inter',
      iconSet: 'heroicons',
      density: 'comfortable',
      radius: 10,
      transparency: 0.05,
      iconOverrides: {},
    },
  },
  {
    id: 'rose-soc',
    label: 'Rose SOC',
    description: 'High-energy red accent for incident-response shifts.',
    theme: {
      mode: 'dark',
      accent: 'rose',
      font: 'inter',
      iconSet: 'material',
      density: 'compact',
      radius: 6,
      transparency: 0.04,
      iconOverrides: {},
    },
  },
  {
    id: 'paper-light',
    label: 'Paper',
    description: 'Light mode for printouts, executives, daylight.',
    theme: {
      mode: 'light',
      accent: 'orange',
      font: 'inter',
      iconSet: 'lucide',
      density: 'comfortable',
      radius: 8,
      transparency: 0.03,
      iconOverrides: {},
    },
  },
]

export const THEME_DEFAULT = 'mission-control'

export function defaultTheme(): Theme {
  const preset = THEME_PRESETS.find(p => p.id === THEME_DEFAULT)
  if (!preset) {
    throw new Error(`THEME_DEFAULT preset "${THEME_DEFAULT}" not found`)
  }
  return JSON.parse(JSON.stringify(preset.theme)) as Theme
}
