// ABOUTME: Enum defining the different mood types available for tracking
// ABOUTME: Each mood has an associated emoji and display properties for user interface
enum MoodType {
  energized,
  calm,
  happy,
  neutral,
  tired,
  stressed,
  sad,
  irritable,
}

/// Extension on MoodType to provide display properties and utilities
extension MoodTypeExtension on MoodType {
  /// Get the emoji representation for this mood type
  String get emoji {
    switch (this) {
      case MoodType.energized:
        return '⚡';
      case MoodType.calm:
        return '🌿';
      case MoodType.neutral:
        return '😐';
      case MoodType.tired:
        return '😴';
      case MoodType.stressed:
        return '😰';
      case MoodType.sad:
        return '😢';
      case MoodType.irritable:
        return '😠';
      case MoodType.happy:
        return '😊';
    }
  }

  /// Get the display name for this mood type
  String get displayName {
    switch (this) {
      case MoodType.energized:
        return 'Energized';
      case MoodType.calm:
        return 'Calm';
      case MoodType.neutral:
        return 'Neutral';
      case MoodType.tired:
        return 'Tired';
      case MoodType.stressed:
        return 'Stressed';
      case MoodType.sad:
        return 'Sad';
      case MoodType.irritable:
        return 'Irritable';
      case MoodType.happy:
        return 'Happy';
    }
  }

  /// Get a descriptive label combining emoji and name
  String get label => '$emoji $displayName';

  /// Get the color associated with this mood type
  /// Returns a color value that can be used with Color(value)
  int get colorValue {
    switch (this) {
      case MoodType.energized:
        return 0xFFFF9800; // Orange - high energy
      case MoodType.calm:
        return 0xFF4CAF50; // Green - peaceful
      case MoodType.neutral:
        return 0xFF9E9E9E; // Grey - neutral
      case MoodType.tired:
        return 0xFF607D8B; // Blue-grey - low energy
      case MoodType.stressed:
        return 0xFFE53935; // Red - alert/stressed
      case MoodType.sad:
        return 0xFF3F51B5; // Indigo - sad/blue
      case MoodType.irritable:
        return 0xFF9C27B0; // Purple - irritated
      case MoodType.happy:
        return 0xFFFFC107; // Amber - joyful/bright
    }
  }

  /// Convert mood type to string for database storage
  String toJson() => name;

  /// Create mood type from string (used when loading from database)
  static MoodType fromJson(String json) {
    return MoodType.values.firstWhere((mood) => mood.name == json);
  }

  /// Get all mood types as a list for UI selection
  static List<MoodType> get all => MoodType.values;

  /// Get mood types grouped by energy level for UI organization
  static Map<String, List<MoodType>> get groupedByEnergy => {
    'High Energy': [MoodType.energized, MoodType.irritable],
    'Balanced': [MoodType.calm, MoodType.neutral, MoodType.happy],
    'Low Energy': [MoodType.tired, MoodType.sad, MoodType.stressed],
  };
}
