AsBuiltReport.Microsoft.Intune.psm1

# AsBuiltReport.Microsoft.Intune.psm1
# Root module loader -- dot-sources all Private and Public functions.
# Uses Join-Path for cross-platform path safety (Windows / macOS / Linux).

# Helpers.ps1 is dot-sourced FIRST to ensure shared utility functions
# (Write-AbrSectionError, Get-IntuneExcelSheetEnabled, Get-IntuneBackupSectionEnabled, etc.)
# are available before any section function is loaded.
$helpersPath = Join-Path $PSScriptRoot 'Src' 'Private' 'Helpers.ps1'
if (Test-Path $helpersPath) { . $helpersPath }

# Dot-source remaining Private functions (alphabetical, Helpers.ps1 skipped -- already loaded)
Get-ChildItem -Path (Join-Path $PSScriptRoot 'Src' 'Private' '*.ps1') -ErrorAction SilentlyContinue |
    Where-Object { $_.Name -ne 'Helpers.ps1' } |
    ForEach-Object { . $_.FullName }

# Dot-source all Public functions
Get-ChildItem -Path (Join-Path $PSScriptRoot 'Src' 'Public' '*.ps1') -ErrorAction SilentlyContinue |
    ForEach-Object { . $_.FullName }