## Test bootstrap and container integration

import std/[os, strutils]
import ../src/nimpak/build/bootstrap
import ../src/nimpak/build/container_manager

proc testContainerDetection() =
  echo "Testing container runtime detection in bootstrap..."

  if isContainerRuntimeAvailable():
    echo "✓ Container runtime available"
    echo "  Info: ", getContainerRuntimeInfo()
  else:
    echo "✗ No container runtime detected"
    echo "  This is expected if Podman/Docker is not installed"

proc testBootstrapWithContainer() =
  echo "\nTesting bootstrap integration..."

  # Test that container option is available
  if isContainerRuntimeAvailable():
    echo "✓ Container option should be available in bootstrap prompts"
    echo "  When user selects option 2, container builds will be enabled"
  else:
    echo "✗ Container option will show installation instructions"

proc testToolDetection() =
  echo "\nTesting tool detection..."

  for toolType in BuildToolType:
    let installed = isToolInstalled(toolType)
    let systemAvail = isSystemToolAvailable(toolType)

    echo "  ", toolType, ":"
    if installed:
      echo "    ✓ Installed via NIP"
    elif systemAvail:
      echo "    ✓ Available on system"
    else:
      echo "    ✗ Not available"

proc main() =
  echo "Bootstrap + Container Integration Tests"
  echo "========================================"
  echo ""

  testContainerDetection()
  testBootstrapWithContainer()
  testToolDetection()

  echo ""
  echo "Integration tests complete!"
  echo ""
  echo "Summary:"
  echo "  The bootstrap system now integrates with container support."
  echo "  When users select option 2, they can build in containers"
  echo "  without installing build tools on their system."

when isMainModule:
  main()
