#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TEST_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

compose() {
  if docker compose version >/dev/null 2>&1; then
    docker compose "$@"
  else
    docker-compose "$@"
  fi
}

docker container rm -f argus-agent-e2e >/dev/null 2>&1 || true

pushd "$TEST_ROOT" >/dev/null
compose down --remove-orphans
popd >/dev/null

rm -rf "$TEST_ROOT/private"
rm -rf "$TEST_ROOT/tmp"

echo "[INFO] Agent E2E environment cleaned up"
