Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
Set-Location $repoRoot

$env:ALLOW_UI_MOCK = "1"

if (-not (Get-Command php -ErrorAction SilentlyContinue)) {
    Write-Host "[ERROR] PHP not found in PATH." -ForegroundColor Red
    Write-Host "Install PHP or add php.exe to PATH, then run again."
    Read-Host "Press Enter to exit"
    exit 1
}

Write-Host "Starting SaleOs in MOCK UI mode..." -ForegroundColor Yellow
Write-Host "URL: http://127.0.0.1:8000/?mock_ui=1" -ForegroundColor Cyan
Write-Host "Press Ctrl+C to stop." -ForegroundColor Gray

php -S 127.0.0.1:8000 -t public
