source/Private/CurrentConfigurationAnalysis.ps1

function Show-RJCurrentConfiguration {
    <#
    .SYNOPSIS
    Displays the current RealmJoin configuration in a readable format.
 
    .PARAMETER Configuration
    The configuration object from Get-RJCurrentConfiguration
    #>


    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [PSCustomObject]$Configuration
    )

    Clear-Host
    Write-Host "Current RealmJoin Configuration" -ForegroundColor White
    Write-Host ("-" * 50) -ForegroundColor DarkGray
    Write-Host ""

    if ($Configuration.ConfiguredFeatures.Count -eq 0) {
        Write-Host "No RealmJoin features are currently configured." -ForegroundColor Yellow
        Write-Host ""
    } else {
        Write-Host "CONFIGURED FEATURES" -ForegroundColor White
        Write-Host ("-" * 30) -ForegroundColor DarkGray
        Write-Host ""

        # Group by mandatory status
        $mandatory = $Configuration.ConfiguredFeatures | Where-Object { $_.IsMandatory }
        $optional = $Configuration.ConfiguredFeatures | Where-Object { -not $_.IsMandatory }

        if ($mandatory) {
            Write-Host "Mandatory:" -ForegroundColor Gray
            foreach ($feature in $mandatory) {
                Write-Host " * $($feature.Name)" -ForegroundColor Cyan
                if ($feature.CurrentPermissions.Count -gt 0) {
                    Write-Host " Permissions ($($feature.CurrentPermissions.Count)):" -ForegroundColor DarkGray
                    foreach ($permission in $feature.CurrentPermissions) {
                        Write-Host " - $permission" -ForegroundColor Gray
                    }
                } else {
                    Write-Host " No permissions currently assigned" -ForegroundColor Red
                }
                Write-Host ""
            }
        }

        if ($optional) {
            Write-Host "Optional:" -ForegroundColor Gray
            foreach ($feature in $optional) {
                Write-Host " * $($feature.Name)" -ForegroundColor White
                if ($feature.CurrentPermissions.Count -gt 0) {
                    Write-Host " Permissions ($($feature.CurrentPermissions.Count)):" -ForegroundColor DarkGray
                    foreach ($permission in $feature.CurrentPermissions) {
                        Write-Host " - $permission" -ForegroundColor Gray
                    }
                } else {
                    Write-Host " No permissions currently assigned" -ForegroundColor Red
                }
                Write-Host ""
            }
        }
    }

    if ($Configuration.LegacyApplications.Count -gt 0) {
        Write-Host "LEGACY APPLICATIONS" -ForegroundColor White
        Write-Host ("-" * 30) -ForegroundColor DarkGray
        Write-Host ""

        foreach ($app in $Configuration.LegacyApplications) {
            Write-Host " * $($app.DisplayName)" -ForegroundColor DarkYellow
        }
        Write-Host ""
        Write-Host " These legacy applications should be removed." -ForegroundColor DarkGray
        Write-Host ""
    }

    Write-Host ("-" * 50) -ForegroundColor DarkGray
    Write-Host ""
}