MyBudgetPowerShellModule.GUI.psm1

# MyBudgetPowerShellModule.GUI
# PowerShell module providing GUI functionality for MyBudgetPowerShellModule

#Requires -Version 5.1

# Get the module root path
$ModuleRoot = $PSScriptRoot

# Dot source Public functions
$PublicPath = Join-Path -Path $ModuleRoot -ChildPath 'Public'
if (Test-Path $PublicPath) {
    Get-ChildItem -Path $PublicPath -Filter '*.ps1' -Recurse -ErrorAction SilentlyContinue | 
        ForEach-Object {
            try {
                . $_.FullName
                Write-Verbose "Imported function: $($_.BaseName)"
            }
            catch {
                Write-Error "Failed to import function $($_.FullName): $_"
            }
        }
}

# Dot source Private functions
$PrivatePath = Join-Path -Path $ModuleRoot -ChildPath 'Private'
if (Test-Path $PrivatePath) {
    Get-ChildItem -Path $PrivatePath -Filter '*.ps1' -Recurse -ErrorAction SilentlyContinue | 
        Where-Object { $_.DirectoryName -notmatch 'WPFBinaries' } |
        ForEach-Object {
            try {
                . $_.FullName
                Write-Verbose "Imported private function: $($_.BaseName)"
            }
            catch {
                Write-Error "Failed to import private function $($_.FullName): $_"
            }
        }
}

# Verify core module dependency
if (-not (Get-Module -Name MyBudgetPowerShellModule -ListAvailable)) {
    Write-Warning @"
MyBudgetPowerShellModule not found. This GUI module requires the core module to function.
 
To install the core module, run:
    Install-Module MyBudgetPowerShellModule -Scope CurrentUser
 
Or if installing from source:
    Import-Module <path-to-MyBudgetPowerShellModule>
"@

}

# Export module members (functions listed in manifest)
Export-ModuleMember -Function @('Show-BudgetGUI')