Public/Get-specTonorefIconName.ps1

Function Get-specTonorefIconName {
    <#
    .SYNOPSIS
        Maps Tonoref codes to corresponding icon filenames.
 
    .DESCRIPTION
        This function acts as a simple lookup table. It takes a Tonoref code (e.g., 'n1', 'h2') as input and returns a custom object containing the associated icon file name.
 
    .PARAMETER Tonoref
        Mandatory parameter. A valid Tonoref code from the supported set ('n1', 'n2', 'n3', 'h1', 'h2', 'h3').
 
    .EXAMPLE
        # Get icon name for a single code
        Get-specTonorefIconName -Tonoref 'h2'
 
    .EXAMPLE
        # Pipeline example (assuming $tonorefCodes is a PSCustomObject)
        $tonorefCodes | Get-specTonorefIconName
 
    .NOTES
        Author: owen.heaume
        Version: 1.0.0 - Initial release
    #>

    [cmdletbinding()]

    param (
        [Parameter(Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
        [ValidateSet('n1', 'n2', 'n3', 'h1', 'h2', 'h3')]
        [string]$Tonoref
    )

    Begin {
    }

    Process {
        foreach ($t in $Tonoref) {
            switch ($t) {
                'n1' {
                    [pscustomobject]@{iconName = 'TonorefGreen.ico' }
                }
                'n2' {
                    [pscustomobject]@{iconName = 'TonorefBlue.ico' }
                }
                'n3' {
                    [pscustomobject]@{iconName = 'TonorefYellow.ico' }
                }
                'h1' {
                    [pscustomobject]@{iconName = 'TonorefGreen.ico' }
                }
                'h2' {
                    [pscustomobject]@{iconName = 'TonorefBlue.ico' }
                }
                'h3' {
                    [pscustomobject]@{iconName = 'TonorefYellow.ico' }
                }
            }
        }
    }

    End {
    }
}