# Script PowerShell para test completo del buque
# Uso: .\test_buque_powershell.ps1

Write-Host "===========================================" -ForegroundColor Cyan
Write-Host "Test Completo - Simulador del Buque" -ForegroundColor Cyan
Write-Host "===========================================" -ForegroundColor Cyan
Write-Host ""

# Ruta de PHP en XAMPP
$phpPath = "C:\xampp\php\php.exe"

# Verificar que PHP existe
if (-not (Test-Path $phpPath)) {
    Write-Host "❌ Error: PHP no encontrado en $phpPath" -ForegroundColor Red
    Write-Host "   Verifica que XAMPP esté instalado correctamente" -ForegroundColor Yellow
    exit 1
}

Write-Host "Paso 1: Generando archivo TXT del buque..." -ForegroundColor Yellow
& $phpPath simular_buque_txt.php 10
if ($LASTEXITCODE -ne 0) {
    Write-Host "❌ Error al generar archivo TXT" -ForegroundColor Red
    exit 1
}

Write-Host ""
Write-Host "Paso 2: Procesando archivo TXT..." -ForegroundColor Yellow
& $phpPath procesar_y_verificar.php
if ($LASTEXITCODE -ne 0) {
    Write-Host "❌ Error al procesar archivo" -ForegroundColor Red
    exit 1
}

Write-Host ""
Write-Host "===========================================" -ForegroundColor Green
Write-Host "✅ Test completado exitosamente!" -ForegroundColor Green
Write-Host "===========================================" -ForegroundColor Green
Write-Host ""
Write-Host "Verifica los datos en:" -ForegroundColor Cyan
Write-Host "  http://localhost/buque/ver_datos.php" -ForegroundColor White
Write-Host "  http://localhost/buque/dashboard.php" -ForegroundColor White
Write-Host ""

