/**
 * ==========================================================================
 * DEFAULT THEME PRESETS
 * ==========================================================================
 * Built-in theme configurations with carefully selected color combinations
 * Provides professionally designed themes for immediate use
 * ==========================================================================
 */

import { ThemeCollection } from '../models/hcl.models';

/**
 * Default theme collection with professionally curated color combinations
 */
export const DEFAULT_THEMES: ThemeCollection = {
  
  // ==========================================================================
  // MATERIAL DESIGN THEMES
  // ==========================================================================
  
  'material-purple': {
    name: 'Material Purple',
    description: 'Classic Material Design purple theme',
    colors: {
      primary: '#6750A4',
      secondary: '#625B71',
      tertiary: '#7D5260'
    }
  },

  'material-blue': {
    name: 'Material Blue',
    description: 'Material Design blue theme',
    colors: {
      primary: '#1976D2',
      secondary: '#455A64',
      tertiary: '#7B1FA2'
    }
  },

  'material-green': {
    name: 'Material Green',
    description: 'Material Design green theme',
    colors: {
      primary: '#2E7D32',
      secondary: '#5D4037',
      tertiary: '#1976D2'
    }
  },

  // ==========================================================================
  // CORPORATE/BUSINESS THEMES
  // ==========================================================================
  
  'corporate-blue': {
    name: 'Corporate Blue',
    description: 'Professional blue theme for business applications',
    colors: {
      primary: '#1565C0',
      secondary: '#37474F',
      tertiary: '#5E35B1'
    }
  },

  'executive': {
    name: 'Executive',
    description: 'Sophisticated theme with navy and gold accents',
    colors: {
      primary: '#263238',
      secondary: '#455A64',
      tertiary: '#FF8F00'
    }
  },

  'modern-corporate': {
    name: 'Modern Corporate',
    description: 'Contemporary corporate theme with teal accents',
    colors: {
      primary: '#00695C',
      secondary: '#424242',
      tertiary: '#7B1FA2'
    }
  },

  // ==========================================================================
  // NATURE-INSPIRED THEMES
  // ==========================================================================

  'forest': {
    name: 'Forest',
    description: 'Deep greens inspired by forest landscapes',
    colors: {
      primary: '#2E7D32',
      secondary: '#5D4037',
      tertiary: '#FF6F00'
    }
  },

  'ocean': {
    name: 'Ocean',
    description: 'Cool blues and teals reminiscent of ocean depths',
    colors: {
      primary: '#006064',
      secondary: '#263238',
      tertiary: '#00ACC1'
    }
  },

  'sunset': {
    name: 'Sunset',
    description: 'Warm oranges and deep purples of a sunset sky',
    colors: {
      primary: '#FF6F00',
      secondary: '#5D4037',
      tertiary: '#7B1FA2'
    }
  },

  'lavender': {
    name: 'Lavender Fields',
    description: 'Soft purples and greens inspired by lavender fields',
    colors: {
      primary: '#7E57C2',
      secondary: '#689F38',
      tertiary: '#8BC34A'
    }
  },

  // ==========================================================================
  // VIBRANT/CREATIVE THEMES
  // ==========================================================================

  'electric': {
    name: 'Electric',
    description: 'High-energy theme with electric blues and purples',
    colors: {
      primary: '#3F51B5',
      secondary: '#9C27B0',
      tertiary: '#00BCD4'
    }
  },

  'neon': {
    name: 'Neon',
    description: 'Bold neon-inspired theme for creative applications',
    colors: {
      primary: '#E91E63',
      secondary: '#9C27B0',
      tertiary: '#00BCD4'
    }
  },

  'cyberpunk': {
    name: 'Cyberpunk',
    description: 'Futuristic theme with cyan and magenta accents',
    colors: {
      primary: '#00E5FF',
      secondary: '#263238',
      tertiary: '#FF1744'
    }
  },

  // ==========================================================================
  // WARM/COZY THEMES
  // ==========================================================================

  'autumn': {
    name: 'Autumn',
    description: 'Warm autumn colors with orange and brown tones',
    colors: {
      primary: '#FF5722',
      secondary: '#5D4037',
      tertiary: '#FF9800'
    }
  },

  'coffee': {
    name: 'Coffee House',
    description: 'Rich browns and warm tones for a cozy feel',
    colors: {
      primary: '#5D4037',
      secondary: '#8D6E63',
      tertiary: '#FF8F00'
    }
  },

  'golden': {
    name: 'Golden',
    description: 'Luxurious theme with gold and deep blue accents',
    colors: {
      primary: '#FF8F00',
      secondary: '#1565C0',
      tertiary: '#7B1FA2'
    }
  },

  // ==========================================================================
  // MONOCHROMATIC THEMES
  // ==========================================================================

  'midnight': {
    name: 'Midnight',
    description: 'Dark theme with subtle blue undertones',
    colors: {
      primary: '#1A237E',
      secondary: '#283593',
      tertiary: '#3F51B5'
    }
  },

  'slate': {
    name: 'Slate',
    description: 'Sophisticated grays with blue-gray undertones',
    colors: {
      primary: '#455A64',
      secondary: '#607D8B',
      tertiary: '#90A4AE'
    }
  },

  'charcoal': {
    name: 'Charcoal',
    description: 'Dark charcoal theme with minimal color accents',
    colors: {
      primary: '#263238',
      secondary: '#37474F',
      tertiary: '#546E7A'
    }
  },

  // ==========================================================================
  // PASTEL/SOFT THEMES
  // ==========================================================================

  'soft-pink': {
    name: 'Soft Pink',
    description: 'Gentle theme with soft pink and lavender tones',
    colors: {
      primary: '#AD1457',
      secondary: '#7B1FA2',
      tertiary: '#512DA8'
    }
  },

  'mint': {
    name: 'Mint',
    description: 'Fresh theme with mint greens and soft blues',
    colors: {
      primary: '#00695C',
      secondary: '#00838F',
      tertiary: '#0277BD'
    }
  },

  'cream': {
    name: 'Cream',
    description: 'Warm, soft theme with cream and beige tones',
    colors: {
      primary: '#8D6E63',
      secondary: '#A1887F',
      tertiary: '#FF8A65'
    }
  },

  // ==========================================================================
  // HIGH CONTRAST THEMES
  // ==========================================================================

  'high-contrast': {
    name: 'High Contrast',
    description: 'Maximum contrast theme for accessibility',
    colors: {
      primary: '#000000',
      secondary: '#424242',
      tertiary: '#757575'
    }
  },

  'accessibility': {
    name: 'Accessibility',
    description: 'Optimized for maximum readability and contrast',
    colors: {
      primary: '#1565C0',
      secondary: '#0D47A1',
      tertiary: '#1A237E'
    }
  }
};

/**
 * Get theme by category
 */
export const getThemesByCategory = () => {
  return {
    material: ['material-purple', 'material-blue', 'material-green'],
    corporate: ['corporate-blue', 'executive', 'modern-corporate'],
    nature: ['forest', 'ocean', 'sunset', 'lavender'],
    vibrant: ['electric', 'neon', 'cyberpunk'],
    warm: ['autumn', 'coffee', 'golden'],
    monochrome: ['midnight', 'slate', 'charcoal'],
    pastel: ['soft-pink', 'mint', 'cream'],
    accessibility: ['high-contrast', 'accessibility']
  };
};

/**
 * Get recommended themes for specific use cases
 */
export const getRecommendedThemes = () => {
  return {
    business: ['corporate-blue', 'executive', 'modern-corporate', 'slate'],
    creative: ['electric', 'neon', 'cyberpunk', 'sunset'],
    healthcare: ['soft-pink', 'mint', 'ocean', 'accessibility'],
    finance: ['corporate-blue', 'executive', 'charcoal', 'midnight'],
    education: ['material-blue', 'forest', 'accessibility', 'mint'],
    ecommerce: ['material-purple', 'golden', 'sunset', 'electric'],
    dashboard: ['corporate-blue', 'slate', 'midnight', 'accessibility'],
    mobile: ['material-purple', 'material-blue', 'ocean', 'neon']
  };
};

/**
 * Get theme metadata
 * @param themeId Theme identifier
 * @returns Theme metadata or null
 */
export const getThemeMetadata = (themeId: string) => {
  const theme = DEFAULT_THEMES[themeId];
  if (!theme) return null;

  const categories = getThemesByCategory();
  const recommendations = getRecommendedThemes();

  // Find which category this theme belongs to
  let category = 'other';
  for (const [cat, themes] of Object.entries(categories)) {
    if (themes.includes(themeId)) {
      category = cat;
      break;
    }
  }

  // Find recommended use cases
  const useCases: string[] = [];
  for (const [useCase, themes] of Object.entries(recommendations)) {
    if (themes.includes(themeId)) {
      useCases.push(useCase);
    }
  }

  return {
    ...theme,
    category,
    useCases,
    id: themeId
  };
};