/**
 * Shared theme definitions for Maestro
 *
 * This file contains the canonical theme definitions used across:
 * - Main process (Electron / Web server)
 * - Renderer process (Desktop React app)
 * - Web interface (Mobile and Desktop web builds)
 *
 * IMPORTANT: This is the single source of truth for theme colors.
 * Do NOT duplicate theme definitions elsewhere.
 */

import type { Theme, ThemeId } from './theme-types';

export const THEMES: Record<ThemeId, Theme> = {
	// Dark themes
	dracula: {
		id: 'dracula',
		name: 'Dracula',
		mode: 'dark',
		colors: {
			bgMain: '#282a36',
			bgSidebar: '#21222c',
			bgActivity: '#343746',
			border: '#44475a',
			textMain: '#f8f8f2',
			textDim: '#6272a4',
			accent: '#bd93f9',
			accentDim: 'rgba(189, 147, 249, 0.2)',
			accentText: '#ff79c6',
			accentForeground: '#282a36',
			success: '#50fa7b',
			warning: '#ffb86c',
			error: '#ff5555',
		},
	},
	monokai: {
		id: 'monokai',
		name: 'Monokai',
		mode: 'dark',
		colors: {
			bgMain: '#272822',
			bgSidebar: '#1e1f1c',
			bgActivity: '#3e3d32',
			border: '#49483e',
			textMain: '#f8f8f2',
			textDim: '#8f908a',
			accent: '#fd971f',
			accentDim: 'rgba(253, 151, 31, 0.2)',
			accentText: '#fdbf6f',
			accentForeground: '#1e1f1c',
			success: '#a6e22e',
			warning: '#e6db74',
			error: '#f92672',
		},
	},
	nord: {
		id: 'nord',
		name: 'Nord',
		mode: 'dark',
		colors: {
			bgMain: '#2e3440',
			bgSidebar: '#3b4252',
			bgActivity: '#434c5e',
			border: '#4c566a',
			textMain: '#eceff4',
			textDim: '#d8dee9',
			accent: '#88c0d0',
			accentDim: 'rgba(136, 192, 208, 0.2)',
			accentText: '#8fbcbb',
			accentForeground: '#2e3440',
			success: '#a3be8c',
			warning: '#ebcb8b',
			error: '#bf616a',
		},
	},
	'tokyo-night': {
		id: 'tokyo-night',
		name: 'Tokyo Night',
		mode: 'dark',
		colors: {
			bgMain: '#1a1b26',
			bgSidebar: '#16161e',
			bgActivity: '#24283b',
			border: '#414868',
			textMain: '#c0caf5',
			textDim: '#9aa5ce',
			accent: '#7aa2f7',
			accentDim: 'rgba(122, 162, 247, 0.2)',
			accentText: '#7dcfff',
			accentForeground: '#1a1b26',
			success: '#9ece6a',
			warning: '#e0af68',
			error: '#f7768e',
		},
	},
	'catppuccin-mocha': {
		id: 'catppuccin-mocha',
		name: 'Catppuccin Mocha',
		mode: 'dark',
		colors: {
			bgMain: '#1e1e2e',
			bgSidebar: '#181825',
			bgActivity: '#313244',
			border: '#45475a',
			textMain: '#cdd6f4',
			textDim: '#a6adc8',
			accent: '#94e2d5',
			accentDim: 'rgba(148, 226, 213, 0.2)',
			accentText: '#f5e0dc',
			accentForeground: '#1e1e2e',
			success: '#a6e3a1',
			warning: '#fab387',
			error: '#f38ba8',
		},
	},
	'gruvbox-dark': {
		id: 'gruvbox-dark',
		name: 'Gruvbox Dark',
		mode: 'dark',
		colors: {
			bgMain: '#282828',
			bgSidebar: '#1d2021',
			bgActivity: '#3c3836',
			border: '#504945',
			textMain: '#ebdbb2',
			textDim: '#a89984',
			accent: '#83a598',
			accentDim: 'rgba(131, 165, 152, 0.2)',
			accentText: '#8ec07c',
			accentForeground: '#1d2021',
			success: '#b8bb26',
			warning: '#fabd2f',
			error: '#fb4934',
		},
	},
	// Light themes
	'github-light': {
		id: 'github-light',
		name: 'GitHub',
		mode: 'light',
		colors: {
			bgMain: '#ffffff',
			bgSidebar: '#f6f8fa',
			bgActivity: '#eff2f5',
			border: '#d0d7de',
			textMain: '#24292f',
			textDim: '#57606a',
			accent: '#0969da',
			accentDim: 'rgba(9, 105, 218, 0.1)',
			accentText: '#0969da',
			accentForeground: '#ffffff',
			success: '#1a7f37',
			warning: '#9a6700',
			error: '#cf222e',
		},
	},
	'solarized-light': {
		id: 'solarized-light',
		name: 'Solarized',
		mode: 'light',
		colors: {
			bgMain: '#fdf6e3',
			bgSidebar: '#eee8d5',
			bgActivity: '#e6dfc8',
			border: '#d3cbb7',
			textMain: '#657b83',
			textDim: '#93a1a1',
			accent: '#2aa198',
			accentDim: 'rgba(42, 161, 152, 0.1)',
			accentText: '#2aa198',
			accentForeground: '#fdf6e3',
			success: '#859900',
			warning: '#b58900',
			error: '#dc322f',
		},
	},
	'one-light': {
		id: 'one-light',
		name: 'One Light',
		mode: 'light',
		colors: {
			bgMain: '#fafafa',
			bgSidebar: '#eaeaeb',
			bgActivity: '#dbdbdc',
			border: '#c8c8c9',
			textMain: '#383a42',
			textDim: '#696c77',
			accent: '#a626a4',
			accentDim: 'rgba(166, 38, 164, 0.1)',
			accentText: '#0184bc',
			accentForeground: '#ffffff',
			success: '#50a14f',
			warning: '#c18401',
			error: '#e45649',
		},
	},
	'gruvbox-light': {
		id: 'gruvbox-light',
		name: 'Gruvbox Light',
		mode: 'light',
		colors: {
			bgMain: '#fbf1c7',
			bgSidebar: '#ebdbb2',
			bgActivity: '#d5c4a1',
			border: '#bdae93',
			textMain: '#3c3836',
			textDim: '#7c6f64',
			accent: '#458588',
			accentDim: 'rgba(69, 133, 136, 0.1)',
			accentText: '#076678',
			accentForeground: '#fbf1c7',
			success: '#98971a',
			warning: '#d79921',
			error: '#cc241d',
		},
	},
	'catppuccin-latte': {
		id: 'catppuccin-latte',
		name: 'Catppuccin Latte',
		mode: 'light',
		colors: {
			bgMain: '#eff1f5',
			bgSidebar: '#e6e9ef',
			bgActivity: '#dce0e8',
			border: '#acb0be',
			textMain: '#4c4f69',
			textDim: '#6c6f85',
			accent: '#8839ef',
			accentDim: 'rgba(136, 57, 239, 0.12)',
			accentText: '#ea76cb',
			accentForeground: '#ffffff',
			success: '#40a02b',
			warning: '#fe640b',
			error: '#d20f39',
		},
	},
	'ayu-light': {
		id: 'ayu-light',
		name: 'Ayu Light',
		mode: 'light',
		colors: {
			bgMain: '#fafafa',
			bgSidebar: '#f3f4f5',
			bgActivity: '#e7e8e9',
			border: '#d9d9d9',
			textMain: '#5c6166',
			textDim: '#828c99',
			accent: '#55b4d4',
			accentDim: 'rgba(85, 180, 212, 0.1)',
			accentText: '#399ee6',
			accentForeground: '#1a1a1a',
			success: '#86b300',
			warning: '#f2ae49',
			error: '#f07171',
		},
	},
	// Vibe themes
	pedurple: {
		id: 'pedurple',
		name: 'Pedurple',
		mode: 'vibe',
		colors: {
			bgMain: '#1a0f24',
			bgSidebar: '#140a1c',
			bgActivity: '#2a1a3a',
			border: '#4a2a6a',
			textMain: '#e8d5f5',
			textDim: '#b89fd0',
			accent: '#ff69b4',
			accentDim: 'rgba(255, 105, 180, 0.25)',
			accentText: '#ff8dc7',
			accentForeground: '#1a0f24',
			success: '#7cb342',
			warning: '#d4af37',
			error: '#da70d6',
		},
	},
	'maestros-choice': {
		id: 'maestros-choice',
		name: "Maestro's Choice",
		mode: 'vibe',
		colors: {
			bgMain: '#1a1a24',
			bgSidebar: '#141420',
			bgActivity: '#24243a',
			border: '#3a3a5a',
			textMain: '#fff8e8',
			textDim: '#a8a0a0',
			accent: '#f4c430',
			accentDim: 'rgba(244, 196, 48, 0.25)',
			accentText: '#ffd54f',
			accentForeground: '#1a1a24',
			success: '#66d9a0',
			warning: '#f4c430',
			error: '#e05070',
		},
	},
	'dre-synth': {
		id: 'dre-synth',
		name: 'Dre Synth',
		mode: 'vibe',
		colors: {
			bgMain: '#0d0221',
			bgSidebar: '#0a0118',
			bgActivity: '#150530',
			border: '#00d4aa',
			textMain: '#f0e6ff',
			textDim: '#60e0d0',
			accent: '#00ffcc',
			accentDim: 'rgba(0, 255, 204, 0.25)',
			accentText: '#40ffdd',
			accentForeground: '#0d0221',
			success: '#00ffcc',
			warning: '#ff2a6d',
			error: '#ff2a6d',
		},
	},
	inquest: {
		id: 'inquest',
		name: 'InQuest',
		mode: 'vibe',
		colors: {
			bgMain: '#0a0a0a',
			bgSidebar: '#050505',
			bgActivity: '#141414',
			border: '#2a2a2a',
			textMain: '#f5f5f5',
			textDim: '#888888',
			accent: '#cc0033',
			accentDim: 'rgba(204, 0, 51, 0.25)',
			accentText: '#ff3355',
			accentForeground: '#ffffff',
			success: '#f5f5f5',
			warning: '#cc0033',
			error: '#cc0033',
		},
	},
	// Custom theme - user-configurable, defaults to Dracula
	custom: {
		id: 'custom',
		name: 'Custom',
		mode: 'dark',
		colors: {
			bgMain: '#282a36',
			bgSidebar: '#21222c',
			bgActivity: '#343746',
			border: '#44475a',
			textMain: '#f8f8f2',
			textDim: '#6272a4',
			accent: '#bd93f9',
			accentDim: 'rgba(189, 147, 249, 0.2)',
			accentText: '#ff79c6',
			accentForeground: '#282a36',
			success: '#50fa7b',
			warning: '#ffb86c',
			error: '#ff5555',
		},
	},
};

// Default custom theme colors (Dracula-based)
export const DEFAULT_CUSTOM_THEME_COLORS = THEMES.dracula.colors;

/**
 * Get a theme by its ID
 * Returns null if the theme ID is not found
 */
export function getThemeById(themeId: string): Theme | null {
	return THEMES[themeId as ThemeId] || null;
}

// Re-export types for convenience
export type { Theme, ThemeId, ThemeColors, ThemeMode } from './theme-types';
