<#
.SYNOPSIS
    Verifies NT8 SDK deployment without rebuilding.
#>

param(
    [switch]$Detailed
)

$nt8Custom = "$env:USERPROFILE\Documents\NinjaTrader 8\bin\Custom"
$nt8Strategies = "$nt8Custom\Strategies"

$requiredDlls = @("NT8.Core.dll")
$optionalDlls = @("NT8.Adapters.dll")
$strategyFiles = @("NT8StrategyBase.cs", "SimpleORBNT8.cs", "MinimalTestStrategy.cs")

Write-Host "NT8 SDK Deployment Verification" -ForegroundColor Cyan
Write-Host ("=" * 50)

$allGood = $true

Write-Host "\nChecking Custom directory..." -ForegroundColor Yellow
foreach ($dll in $requiredDlls) {
    $path = Join-Path $nt8Custom $dll
    if (Test-Path $path) {
        Write-Host "  [OK] $dll" -ForegroundColor Green
        if ($Detailed) {
            $info = Get-Item $path
            Write-Host ("    Size: {0} KB" -f [math]::Round($info.Length / 1KB, 2)) -ForegroundColor Gray
            Write-Host ("    Modified: {0}" -f $info.LastWriteTime) -ForegroundColor Gray
        }
    }
    else {
        Write-Host "  [MISSING] $dll" -ForegroundColor Red
        $allGood = $false
    }
}

foreach ($dll in $optionalDlls) {
    $path = Join-Path $nt8Custom $dll
    if (Test-Path $path) {
        Write-Host "  [OK] $dll (optional)" -ForegroundColor Green
    }
    else {
        Write-Host "  [SKIP] $dll (optional)" -ForegroundColor Gray
    }
}

Write-Host "\nChecking Strategies directory..." -ForegroundColor Yellow
foreach ($file in $strategyFiles) {
    $path = Join-Path $nt8Strategies $file
    if (Test-Path $path) {
        Write-Host "  [OK] $file" -ForegroundColor Green
        if ($Detailed) {
            $info = Get-Item $path
            Write-Host ("    Size: {0} KB" -f [math]::Round($info.Length / 1KB, 2)) -ForegroundColor Gray
            Write-Host ("    Modified: {0}" -f $info.LastWriteTime) -ForegroundColor Gray
        }
    }
    else {
        Write-Host "  [MISSING] $file" -ForegroundColor Red
        $allGood = $false
    }
}

Write-Host ""
if ($allGood) {
    Write-Host "[OK] Deployment verified - all required files present" -ForegroundColor Green
    exit 0
}

Write-Host "[FAIL] Deployment incomplete - missing required files" -ForegroundColor Red
Write-Host "Run: .\deployment\Deploy-To-NT8.ps1" -ForegroundColor Yellow
exit 1

