# 09-Setup-Common.ps1 - common pc-type setup
#
# common = OpenText-only shopfloor PC. No UDC (collections-only),
# no eDNC (collections + nocollections only). OpenText installs in
# the preinstall phase via Setup-OpenText.ps1; this script just adds
# the auto-start so HostExplorer's "WJ Shopfloor" session launches
# at every login.

$lib = Join-Path $PSScriptRoot '..\Shopfloor\lib\Set-OpenTextAutoStart.ps1'

Write-Host '=== Common Setup ==='
$pxeStatusLib = Join-Path $PSScriptRoot '..\Shopfloor\lib\Send-PxeStatus.ps1'
if (Test-Path $pxeStatusLib) {
    try { . $pxeStatusLib; Send-PxeStatus -Stage '09-Setup-Common: starting' -StageIndex 3 -StageTotal 8 } catch { }
}
if (Test-Path -LiteralPath $lib) {
    & $lib
} else {
    Write-Warning "Set-OpenTextAutoStart.ps1 not found at $lib - OpenText auto-start NOT configured"
}
if (Get-Command Send-PxeStatus -ErrorAction SilentlyContinue) {
    Send-PxeStatus -Stage '09-Setup-Common: complete' -StageIndex 4 -StageTotal 8
}
Write-Host '=== Common Setup Complete ==='
