Src/Private/Get-AbrExoSections.ps1

#region --- Section Orchestrators ---

function Get-AbrExoTenantOverviewSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    if ($InfoLevel.TenantOverview -lt 1) { return }
    Section -Style Heading1 'Tenant Overview' {
        Paragraph "The following section documents tenant-level Exchange Online configuration for $TenantId."
        BlankLine
        Write-Host ' - Working on Tenant Overview sub-section.'
        Get-AbrExoTenantOverview -TenantId $TenantId
    }
}

function Get-AbrExoHybridSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    if ($InfoLevel.Hybrid -lt 1) { return }
    Section -Style Heading1 'Hybrid Configuration & Identity Integration' {
        Paragraph "The following section documents hybrid Exchange configuration, directory synchronisation, and identity integration for $TenantId."
        BlankLine
        Write-Host ' - Working on Hybrid sub-section.'
        Get-AbrExoHybrid -TenantId $TenantId
    }
}

function Get-AbrExoMailboxSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    $anyEnabled = ($InfoLevel.Mailboxes -ge 1 -or $InfoLevel.MailboxGovernance -ge 1 -or
                   $InfoLevel.MailboxPermissions -ge 1 -or $InfoLevel.DistributionGroups -ge 1)
    if (-not $anyEnabled) { return }
    Section -Style Heading1 'Recipients' {
        Paragraph "The following section provides a summary of mailboxes, groups, and recipient configuration for tenant $TenantId."
        BlankLine
        if ($InfoLevel.Mailboxes -ge 1) {
            Write-Host ' - Working on Mailboxes sub-section.'
            Get-AbrExoMailboxes -TenantId $TenantId
        }
        if ($InfoLevel.MailboxGovernance -ge 1) {
            Write-Host ' - Working on Mailbox Governance sub-section.'
            Get-AbrExoMailboxGovernance -TenantId $TenantId
        }
        if ($InfoLevel.MailboxPermissions -ge 1) {
            Write-Host ' - Working on Mailbox Permissions sub-section.'
            Get-AbrExoMailboxPermissions -TenantId $TenantId
        }
        if ($InfoLevel.DistributionGroups -ge 1) {
            Write-Host ' - Working on Distribution Groups sub-section.'
            Get-AbrExoDistributionGroups -TenantId $TenantId
        }
    }
}

function Get-AbrExoClientAccessSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    if ($InfoLevel.ClientAccess -lt 1) { return }
    Section -Style Heading1 'Client Access & Authentication' {
        Paragraph "The following section documents client access protocols, authentication policies, and how users connect to Exchange Online in tenant $TenantId."
        BlankLine
        Write-Host ' - Working on Client Access sub-section.'
        Get-AbrExoClientAccess -TenantId $TenantId
    }
}

function Get-AbrExoProtectionSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    $anyEnabled = ($InfoLevel.AntiSpam -ge 1 -or $InfoLevel.AntiMalware -ge 1 -or
                   $InfoLevel.AntiPhishing -ge 1 -or $InfoLevel.Quarantine -ge 1)
    if (-not $anyEnabled) { return }
    Section -Style Heading1 'Exchange Online Protection' {
        Paragraph "The following section documents the Exchange Online Protection (EOP) security policies for tenant $TenantId."
        BlankLine
        if ($InfoLevel.AntiSpam -ge 1) {
            Write-Host ' - Working on Anti-Spam sub-section.'
            Get-AbrExoAntiSpam -TenantId $TenantId
        }
        if ($InfoLevel.AntiMalware -ge 1) {
            Write-Host ' - Working on Anti-Malware sub-section.'
            Get-AbrExoAntiMalware -TenantId $TenantId
        }
        if ($InfoLevel.AntiPhishing -ge 1) {
            Write-Host ' - Working on Anti-Phishing sub-section.'
            Get-AbrExoAntiPhishing -TenantId $TenantId
        }
        if ($InfoLevel.Quarantine -ge 1) {
            Write-Host ' - Working on Quarantine sub-section.'
            Get-AbrExoQuarantine -TenantId $TenantId
        }
    }
}

function Get-AbrExoEmailAuthSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    $anyEnabled = ($InfoLevel.DKIM -ge 1 -or $InfoLevel.DMARC -ge 1)
    if (-not $anyEnabled) { return }
    Section -Style Heading1 'Email Authentication' {
        Paragraph "The following section documents email authentication (DKIM and DMARC) for tenant $TenantId."
        BlankLine
        Write-Host ' - Working on DKIM/DMARC sub-section.'
        Get-AbrExoDKIMDMARC -TenantId $TenantId
    }
}

function Get-AbrExoMailFlowSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    $anyEnabled = ($InfoLevel.TransportRules -ge 1 -or $InfoLevel.Connectors -ge 1 -or $InfoLevel.ExternalSharing -ge 1)
    if (-not $anyEnabled) { return }
    Section -Style Heading1 'Mail Flow & External Controls' {
        Paragraph "The following section documents mail flow configuration, transport rules, connectors, and external sharing controls for tenant $TenantId."
        BlankLine
        if ($InfoLevel.TransportRules -ge 1) {
            Write-Host ' - Working on Transport Rules sub-section.'
            Get-AbrExoTransportRules -TenantId $TenantId
        }
        if ($InfoLevel.Connectors -ge 1) {
            Write-Host ' - Working on Connectors sub-section.'
            Get-AbrExoConnectors -TenantId $TenantId
        }
        if ($InfoLevel.ExternalSharing -ge 1) {
            Write-Host ' - Working on External Sharing sub-section.'
            Get-AbrExoExternalSharing -TenantId $TenantId
        }
    }
}

function Get-AbrExoDefenderSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    $anyEnabled = ($InfoLevel.SafeAttachments -ge 1 -or $InfoLevel.SafeLinks -ge 1)
    if (-not $anyEnabled) { return }
    Section -Style Heading1 'Microsoft Defender for Office 365' {
        Paragraph "The following section documents Defender for Office 365 policies for tenant $TenantId. These features require Defender for Office 365 Plan 1 or higher."
        BlankLine
        Write-Host ' - Working on Safe Attachments and Safe Links sub-section.'
        Get-AbrExoSafeAttachmentsSafeLinks -TenantId $TenantId
    }
}

function Get-AbrExoComplianceSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    $anyEnabled = ($InfoLevel.RetentionPolicies -ge 1 -or $InfoLevel.AuditLogging -ge 1)
    if (-not $anyEnabled) { return }
    Section -Style Heading1 'Compliance & Retention' {
        Paragraph "The following section documents compliance configuration including retention policies, journaling, and audit logging for tenant $TenantId."
        BlankLine
        if ($InfoLevel.RetentionPolicies -ge 1) {
            Write-Host ' - Working on Retention Policies & Journaling sub-section.'
            Get-AbrExoRetentionPolicies -TenantId $TenantId
        }
        if ($InfoLevel.AuditLogging -ge 1) {
            Write-Host ' - Working on Audit Logging sub-section.'
            Get-AbrExoAuditLogging -TenantId $TenantId
        }
    }
}

function Get-AbrExoMobileSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    if ($InfoLevel.MobileDevices -lt 1) { return }
    Section -Style Heading1 'Mobile Device Access' {
        Paragraph "The following section documents mobile device access policies and device partnerships for tenant $TenantId."
        BlankLine
        Write-Host ' - Working on Mobile Devices sub-section.'
        Get-AbrExoMobileDevices -TenantId $TenantId
    }
}

function Get-AbrExoAddressListSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    if ($InfoLevel.AddressLists -lt 1) { return }
    Section -Style Heading1 'Address Lists & Policies' {
        Paragraph "The following section documents address lists, offline address books, and email address policies for tenant $TenantId."
        BlankLine
        Write-Host ' - Working on Address Lists sub-section.'
        Get-AbrExoAddressLists -TenantId $TenantId
    }
}

function Get-AbrExoAlertingSection {
    [CmdletBinding()]
    param ([Parameter(Mandatory)][string]$TenantId)
    if ($InfoLevel.Alerting -lt 1) { return }
    Section -Style Heading1 'Monitoring & Alerting' {
        Paragraph "The following section documents alert policies and operational monitoring configuration for tenant $TenantId."
        BlankLine
        Write-Host ' - Working on Alerting sub-section.'
        Get-AbrExoAlerting -TenantId $TenantId
    }
}


#endregion