exportData method

Map<String, dynamic> exportData()

Exportar datos para análisis

Implementation

Map<String, dynamic> exportData() {
  return {
    'metadata': {
      'export_time': DateTime.now().toIso8601String(),
      'total_events': _eventHistory.length,
      'total_rule_executions': _totalExecutions,
      'max_history_size': _maxHistorySize,
    },
    'metrics': {
      'total_events': _eventHistory.length,
      'total_rule_executions': _totalExecutions,
      'successful_executions': _successfulExecutions,
      'failed_executions': _failedExecutions,
      'success_rate': _totalExecutions > 0
          ? _successfulExecutions / _totalExecutions
          : 0.0,
      'top_rules': _getTopRules(),
      'top_event_types': _getTopEventTypes(),
    },
    'performance': getPerformanceStats(),
    'events': _eventHistory.map((e) => e.toJson()).toList(),
  };
}