<?php
declare(strict_types=1);
namespace App\Controllers;

use App\Core\Auth;
use App\Core\Controller;
use App\Core\Permission;
use App\Services\SecurityBehaviorAnalyticsService;

final class SecurityBehaviorAnalyticsController extends Controller
{
    public function index(): void
    {
        Auth::requireLogin();
        Permission::require('administration.permissions.view');
        $hours=max(1,min(168,(int)($_GET['hours']??24)));
        $this->view('security/ueba',[
            'pageTitle'=>'Détection comportementale UEBA',
            'report'=>(new SecurityBehaviorAnalyticsService())->report($hours),
        ]);
    }
}
