Private/Get-TLScoreWeight.ps1

function Get-TLScoreWeight {
    <#
    .SYNOPSIS
        Returns the severity-weighted pass ratio (0..1) over all Pass/Fail findings.
    .DESCRIPTION
        A failing Critical rule hurts the score far more than a failing Low
        rule. Manual/Skipped/Error findings are excluded from the calculation.
    #>

    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [AllowEmptyCollection()]
        [object[]]$Findings
    )

    $weights = @{ Critical = 10.0; High = 7.0; Medium = 4.0; Low = 2.0; Info = 1.0 }

    $passWeight = 0.0
    $failWeight = 0.0
    foreach ($finding in $Findings) {
        $weight = 1.0
        if ($weights.ContainsKey([string]$finding.Severity)) { $weight = $weights[[string]$finding.Severity] }
        if ($finding.Status -eq 'Pass') { $passWeight += $weight }
        elseif ($finding.Status -eq 'Fail') { $failWeight += $weight }
    }

    $total = $passWeight + $failWeight
    if ($total -le 0) { return 0.0 }
    return $passWeight / $total
}