source/Public/Show-RJFeatureInfo.ps1

function Show-RJFeatureInfo {
    <#
    .SYNOPSIS
    Displays all available RealmJoin features.
 
    .DESCRIPTION
    Shows a comprehensive list of RealmJoin features including their
    mandatory status, descriptions, and required Microsoft Graph permissions.
    This information helps administrators understand what features are available
    and plan their tenant configuration before running New-RJTenant.
 
    .EXAMPLE
    Show-RJFeatureInfo
    Shows all available features with their mandatory status and descriptions.
 
    .NOTES
    Automatically uses the current environment setting (Production by default).
    To change environments, use Set-RJEnvironment first.
    #>


    [CmdletBinding()]
    param()

    $features = Get-RJFeatureDefinitionList

    Clear-Host
    Write-Host "RealmJoin Features Overview" -ForegroundColor White
    Write-Host ("-" * 80) -ForegroundColor DarkGray
    Write-Host ""

    # Group features by mandatory status
    $mandatoryFeatures = $features | Where-Object { $_.IsMandatory } | Sort-Object Name
    $optionalFeatures = $features | Where-Object { -not $_.IsMandatory } | Sort-Object Name

    # Display mandatory features
    if ($mandatoryFeatures) {
        Write-Host "MANDATORY FEATURES" -ForegroundColor White
        Write-Host ("-" * 40) -ForegroundColor DarkGray
        Write-Host ""

        foreach ($feature in $mandatoryFeatures) {
            Write-Host " * " -NoNewline -ForegroundColor DarkGray
            Write-Host "$($feature.Name)" -ForegroundColor Cyan -NoNewline
            Write-Host " - $($feature.Description)" -ForegroundColor Gray

            # Show permission count
            $permCount = $feature.Permissions.Count
            $readOnlyCount = if ($feature.ReadOnlyPermissions) { $feature.ReadOnlyPermissions.Count } else { 0 }

            Write-Host " Permissions: " -NoNewline -ForegroundColor DarkGray
            Write-Host "$permCount Read/Write" -NoNewline -ForegroundColor White
            if ($readOnlyCount -gt 0) {
                Write-Host ", $readOnlyCount Read-Only available" -ForegroundColor DarkGray
            }
            Write-Host ""
        }
    }

    # Display optional features
    if ($optionalFeatures) {
        Write-Host "OPTIONAL FEATURES" -ForegroundColor White
        Write-Host ("-" * 40) -ForegroundColor DarkGray
        Write-Host ""

        foreach ($feature in $optionalFeatures) {
            Write-Host " * " -NoNewline -ForegroundColor DarkGray
            Write-Host "$($feature.Name)" -ForegroundColor White -NoNewline
            Write-Host " - $($feature.Description)" -ForegroundColor Gray

            # Show permission count
            $permCount = $feature.Permissions.Count
            $readOnlyCount = if ($feature.ReadOnlyPermissions) { $feature.ReadOnlyPermissions.Count } else { 0 }

            Write-Host " Permissions: " -NoNewline -ForegroundColor DarkGray
            if ($readOnlyCount -gt 0 -and $readOnlyCount -eq $permCount) {
                Write-Host "$permCount Read/Write or Read-Only" -ForegroundColor White
            } elseif ($readOnlyCount -gt 0) {
                Write-Host "$permCount Read/Write" -NoNewline -ForegroundColor White
                Write-Host ", $readOnlyCount Read-Only available" -ForegroundColor DarkGray
            } else {
                Write-Host "$permCount Read/Write only" -ForegroundColor White
            }
            Write-Host ""
        }
    }

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