FileShareMigrationTools.psm1

<#
.SYNOPSIS
    Root module loader for FileShareMigrationTools.

.DESCRIPTION
    Dot-sources every function in .\Public and .\Private, then exports only the
    public functions. Public functions are user-facing; private functions are
    internal helpers and are never exported.

    Think of this file as the receptionist: it knows about every room in the
    building (Public and Private), but only hands visitors the keys to the
    public rooms.

.NOTES
    Author : Marcus Tedde
    Version: 1.1.0
    License: MIT (see LICENSE)
#>


Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

$publicRoot  = Join-Path -Path $PSScriptRoot -ChildPath 'Public'
$privateRoot = Join-Path -Path $PSScriptRoot -ChildPath 'Private'

$publicFiles  = @(Get-ChildItem -Path (Join-Path $publicRoot  '*.ps1') -ErrorAction SilentlyContinue)
$privateFiles = @(Get-ChildItem -Path (Join-Path $privateRoot '*.ps1') -ErrorAction SilentlyContinue)

foreach ($file in @($privateFiles + $publicFiles)) {
    try {
        . $file.FullName
    }
    catch {
        throw "Failed to import function file '$($file.FullName)': $($_.Exception.Message)"
    }
}

# Export only the public functions (one function per file, file named after the function).
Export-ModuleMember -Function $publicFiles.BaseName