@echo off
rem RTGS 네이티브 인프라 종료. (Kafka 창은 자동 종료 시도; 안 되면 창을 닫으세요)
call C:\ai-dev\scripts\env.cmd
set "PGBIN=%DEV_HOME%\apps\postgresql-16.4\bin"
set "PGDATA=%DEV_HOME%\home\pgsql-data"

echo [infra] stopping Kafka (kafka-server-stop.bat uses removed 'wmic', so kill via PowerShell)...
powershell -NoProfile -Command "Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like '*kafka*server.properties*' -and $_.Name -eq 'java.exe' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }"

echo [infra] stopping PostgreSQL...
"%PGBIN%\pg_ctl.exe" -D "%PGDATA%" stop -m fast

echo [infra] done.
