<?php
declare(strict_types=1);
namespace App\Controllers;
use App\Core\Auth;use App\Core\Controller;use App\Core\Permission;use App\Services\SiemAnalyticsService;
final class SiemAnalyticsController extends Controller
{
 public function index(): void{Auth::requireLogin();Permission::require('soc.analytics.view');$this->view('security/siem_analytics',['pageTitle'=>'SIEM Analytics','report'=>(new SiemAnalyticsService())->dashboard($_GET)]);}
 public function exportCsv(): void{Auth::requireLogin();Permission::require('soc.analytics.export');$rows=(new SiemAnalyticsService())->events($_GET,5000);header('Content-Type: text/csv; charset=UTF-8');header('Content-Disposition: attachment; filename="axiom-siem-analytics-'.date('Ymd-His').'.csv"');$o=fopen('php://output','wb');fwrite($o,"\xEF\xBB\xBF");fputcsv($o,['Date','Gravité','Catégorie','Module','Action','Résultat','Utilisateur','Message'],';');foreach($rows as $r){fputcsv($o,[$r['occurred_at'],$r['severity'],$r['category'],$r['module'],$r['action'],$r['result'],$r['user_id'],$r['message']],';');}fclose($o);exit;}
}
