# Script pour auditer les use cases de chaque feature

$featuresPath = "C:\Users\dadyo\PersonalProjects\lions-workspace\unionflow\unionflow-mobile-apps\lib\features"

Write-Host "=== Audit Use Cases par Feature ===" -ForegroundColor Cyan
Write-Host ""

$features = Get-ChildItem -Path $featuresPath -Directory

foreach ($feature in $features) {
    $usecasesPath = Join-Path $feature.FullName "domain\usecases"

    if (Test-Path $usecasesPath) {
        $usecases = Get-ChildItem -Path $usecasesPath -Filter "*.dart" -File

        Write-Host "[$($feature.Name)]" -ForegroundColor Yellow
        Write-Host "  Use cases: $($usecases.Count)"

        if ($usecases.Count -gt 0) {
            foreach ($usecase in $usecases) {
                $name = $usecase.Name -replace '\.dart$', ''
                Write-Host "    - $name" -ForegroundColor Gray
            }
        } else {
            Write-Host "    (aucun use case trouvé)" -ForegroundColor Red
        }

        Write-Host ""
    }
}

Write-Host "=== Résumé ===" -ForegroundColor Cyan
$totalFeatures = ($features | Where-Object { Test-Path (Join-Path $_.FullName "domain\usecases") }).Count
Write-Host "Features avec use cases: $totalFeatures"
