<#
.SYNOPSIS
    Parses a GuruScan results.json into a human-readable report.
.DESCRIPTION
    Locates a results.json (defaults to the most recent scan in C:\ScanLogs\),
    prints a formatted summary with per-scanner results, threat counts, and
    a remediation recommendation if threats were found.
    Use -AI to send log content to a local Ollama model for threat analysis
    and AI-generated remediation recommendations.
.PARAMETER ResultsFile
    Full path to a specific results.json. If omitted, the latest file in
    C:\ScanLogs\ is used automatically.
.PARAMETER ShowAll
    Show every scanner including those that completed clean (no threats).
.PARAMETER AI
    Send scan logs to local Ollama (http://localhost:11434) for AI-powered
    threat analysis and prioritized remediation recommendations.
.PARAMETER OllamaUrl
    Ollama base URL. Defaults to http://localhost:11434.
.PARAMETER OllamaModel
    Ollama model to use. Defaults to qwen3.6:latest.
.EXAMPLE
    .\Get-ScanSummary.ps1
    .\Get-ScanSummary.ps1 -AI
    .\Get-ScanSummary.ps1 -ResultsFile "C:\ScanLogs\DESKTOP-20260523-143000\results.json" -AI
#>
[CmdletBinding()]
param(
    [string]$ResultsFile  = '',
    [switch]$ShowAll,
    [switch]$AI,
    [string]$OllamaUrl    = 'http://localhost:11434',
    [string]$OllamaModel  = 'qwen3.6:latest'
)

$moduleManifest = Join-Path $PSScriptRoot 'GuruScan.psd1'
if (-not (Test-Path $moduleManifest)) {
    Write-Host "[ERROR] GuruScan module not found: $moduleManifest" -ForegroundColor Red
    exit 1
}

Import-Module $moduleManifest -Force
Get-ScanSummary @PSBoundParameters
