import 'package:xp_nix/src/interfaces/i_desktop_enhancer.dart';

/// Mock desktop enhancer for testing that doesn't perform actual desktop operations
class MockDesktopEnhancer implements IDesktopEnhancer {
  String _currentTheme = 'default';
  int _lastAppliedLevel = 1;
  List<String> _operations = [];

  /// Get the operations that were performed (for testing verification)
  List<String> get operations => List.unmodifiable(_operations);

  /// Clear the operations log
  void clearOperations() => _operations.clear();

  @override
  Future<void> applyThemeForLevel(int level) async {
    _lastAppliedLevel = level;
    
    if (level >= 25) {
      _currentTheme = 'legendary';
    } else if (level >= 15) {
      _currentTheme = 'master';
    } else if (level >= 10) {
      _currentTheme = 'advanced';
    } else if (level >= 5) {
      _currentTheme = 'intermediate';
    } else {
      _currentTheme = 'default';
    }

    _operations.add('applyThemeForLevel($level) -> $_currentTheme');
    print('🎨 [MOCK] Applied theme: $_currentTheme for level $level');
  }

  @override
  Future<void> celebrateLevelUp(int level) async {
    _operations.add('celebrateLevelUp($level)');
    print('🎉 [MOCK] Celebrating level up to $level!');
    
    // Apply the theme as part of celebration
    await applyThemeForLevel(level);
  }

  @override
  String getCurrentThemeInfo() {
    return 'Theme: $_currentTheme (Level $_lastAppliedLevel)';
  }

  @override
  Future<void> restoreBackup() async {
    _operations.add('restoreBackup()');
    _currentTheme = 'default';
    _lastAppliedLevel = 1;
    print('🔧 [MOCK] Restored desktop from backup');
  }

  @override
  Future<void> refreshBaseConfig() async {
    _operations.add('refreshBaseConfig()');
    print('🔄 [MOCK] Refreshed base config from system');
  }
}
