#Requires -Version 7.4

function Resolve-vSEALBaselinePath {
    <#
    .SYNOPSIS
        Resolves the baseline storage path from configuration or defaults.

    .DESCRIPTION
        Returns the path where vSEAL baselines are stored. Checks the configuration
        for a custom baseline.path setting, otherwise returns the default location
        at C:\ProgramData\vSEAL\baselines.

    .PARAMETER Config
        Optional hashtable containing vSEAL configuration. If the configuration
        contains a baseline.path setting, that path will be used instead of the default.

    .EXAMPLE
        Resolve-vSEALBaselinePath

        Returns: C:\ProgramData\vSEAL\baselines (default path)

    .EXAMPLE
        $config = @{ baseline = @{ path = 'D:\Baselines' } }
        Resolve-vSEALBaselinePath -Config $config

        Returns: D:\Baselines (configured path)

    .OUTPUTS
        [string] The resolved baseline storage path.
    #>
    [CmdletBinding()]
    [OutputType([string])]
    param(
        [Parameter()]
        [hashtable]$Config
    )

    # Default baseline path
    $defaultPath = Join-Path $env:ProgramData 'vSEAL\baselines'

    # Check for config override
    if ($null -ne $Config -and
        $Config.ContainsKey('baseline') -and
        $null -ne $Config.baseline -and
        $Config.baseline.ContainsKey('path') -and
        -not [string]::IsNullOrWhiteSpace($Config.baseline.path)) {
        return $Config.baseline.path
    }

    return $defaultPath
}
