#Requires -Version 7.4

function Get-vSEALStatus {
    <#
    .SYNOPSIS
        Returns the current vSEAL execution status.

    .DESCRIPTION
        Queries the status.json file and returns a PSCustomObject containing
        seal and engage sections, or $null if vSEAL has never been run.

        This is the public API for monitoring tools and administrators to
        query vSEAL state without needing to understand file locations.

    .EXAMPLE
        Get-vSEALStatus

        Returns the current status object with seal and engage sections.

    .EXAMPLE
        $status = Get-vSEALStatus
        if ($status -and $status.seal.result -eq 'Success') {
            Write-Host "Last seal was successful on $($status.seal.computerName)"
        }

    .EXAMPLE
        $status = Get-vSEALStatus
        if (-not $status) {
            Write-Host "vSEAL has never been run on this system"
        }

    .OUTPUTS
        [PSCustomObject] with seal and engage sections, or $null if never run.

        seal section contains:
        - computerName: Machine that ran Seal phase
        - timestamp: ISO 8601 timestamp
        - result: Success, PartialSuccess, or Failed
        - pluginsRun: Count of plugins executed
        - pluginsFailed: Count of failed plugins
        - errors: Array of error objects
        - version: vSEAL version used

        engage section contains same fields (or $null if not yet run).
    #>
    [CmdletBinding()]
    [OutputType([PSCustomObject])]
    param()

    Read-vSEALStatus
}
