Private/Import-AeroFetchTheme.ps1

function Import-AeroFetchTheme {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [string]$Name = 'msWinModern',
        [Parameter(Mandatory)]
        [string]$Logo = 'ElevenClassic'
    )

    $ModuleRoot = Split-Path $PSScriptRoot -Parent 
    $AeroFetchThemesDirectory = "$ModuleRoot\Data\Themes"
    $AvailableThemes = (Get-ChildItem $AeroFetchThemesDirectory -Recurse -Filter *.psd1).BaseName
    
    if ($AvailableThemes -icontains $Name) { $IsValidTheme = $true } else { $IsValidTheme = $false }

    switch($IsValidTheme){
        false{
            Write-Error "Failed to locate $Name as it is not a valid AeroFetch Theme." 
        }

        true{
            $ThemeDirectoryName = "$Name" + "_AeroFetchTheme"
            $ThemeFilename = "$Name" + ".psd1"
            $SelectedTheme = Import-PowerShellDataFile -Path "$AeroFetchThemesDirectory\$ThemeDirectoryName\$ThemeFilename"
            
            return $SelectedTheme
        }
    }
}