{
  "name": "NetAlertX DevContainer",
  "remoteUser": "netalertx",
  "workspaceFolder": "/workspaces/NetAlertX",
  "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/NetAlertX,type=bind,consistency=cached",
  "onCreateCommand": "mkdir -p /tmp/api /tmp/log",
  "build": {
    "dockerfile": "./Dockerfile", // Dockerfile generated by script
    "context": "../", // Context is the root of the repository
    "target": "netalertx-devcontainer"
  },
  "capAdd": [
    "SYS_ADMIN", // For mounting ramdisks
    "NET_ADMIN", // For network interface configuration
    "NET_RAW" // For raw packet manipulation
  ],
  "runArgs": [
    "--security-opt",
    "apparmor=unconfined", // for allowing ramdisk mounts
    "--add-host=host.docker.internal:host-gateway"

    // Uncomment --network=host to run full NetAlertX scanning capabilities of network scanning in
    // container. This runs too slowly in a large network to be practical for development purposes.
    // You can start services such as avahi on the host, in other containers within the network, or
    // even within this container and connect to them as needed.
    // "--network=host",
  ],
  "mounts": [
    "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" //used for testing various conditions in docker
  ],
  // ATTENTION: If running with --network=host, COMMENT `forwardPorts` OR ELSE THERE WILL BE NO WEBUI!
  "forwardPorts": [20211, 20212, 5678],
  "portsAttributes": { // the ports we care about
    "20211": {
      "label": "Frontend:Nginx+PHP"
    },
    "20212": {
      "label": "Backend:GraphQL"
    },
    "9003": {
      "label": "PHP Debug:Xdebug"
    },
    "5678": {
      "label": "Python Debug:debugpy"
    }
  },

  "postCreateCommand": {
      "Install Pip Requirements": "/opt/venv/bin/pip3 install pytest docker debugpy",
      "Workspace Instructions": "printf '\n\n� DevContainer Ready!\n\n📁 To access /tmp folders in the workspace:\n   File → Open Workspace from File → NetAlertX.code-workspace\n\n📖 See .devcontainer/WORKSPACE.md for details\n\n'"
  },
  "postStartCommand": {
      "Start Environment":"${containerWorkspaceFolder}/.devcontainer/scripts/setup.sh",
      "Build test-container":"echo building netalertx-test container in background. check /tmp/build.log for progress. && setsid docker buildx build -t netalertx-test . > /tmp/build.log 2>&1 &"
  },
  "customizations": {
    "vscode": {
      "extensions": [
        "ms-python.python",
        "ms-azuretools.vscode-docker",
        "felixfbecker.php-debug",
        "bmewburn.vscode-intelephense-client",
        "xdebug.php-debug",
        "ms-python.vscode-pylance",
        "pamaron.pytest-runner",
        "coderabbit.coderabbit-vscode",
        "ms-python.black-formatter",
        "jeff-hykin.better-dockerfile-syntax",
        "GitHub.codespaces",
        "ms-azuretools.vscode-containers",
        "ms-python.vscode-python-envs",
        "dbaeumer.vscode-eslint",
        "esbenp.prettier-vscode",
        "eamodio.gitlens",
        "alexcvzz.vscode-sqlite",
        "mkhl.shfmt",
        "charliermarsh.ruff",
        "ms-python.flake8",
        "exiasr.hadolint",
        "timonwong.shellcheck"
      ],
      "settings": {
        "terminal.integrated.cwd": "${containerWorkspaceFolder}",
        "terminal.integrated.profiles.linux": {
          "zsh": {
            "path": "/bin/zsh",
            "args": ["-l"]
          }
        },
        "terminal.integrated.defaultProfile.linux": "zsh",

        // Python testing configuration
        "python.testing.pytestEnabled": true,
        "python.testing.unittestEnabled": false,
        "python.testing.pytestArgs": ["test"],
        "python.testing.cwd": "${containerWorkspaceFolder}",
        // Make sure we discover tests and import server correctly
        "python.analysis.extraPaths": [
          "/workspaces/NetAlertX",
          "/workspaces/NetAlertX/server",
          "/app",
          "/app/server"
        ]
      }
    }
  },

  "shutdownAction": "stopContainer" // stop container when VSCode is closed
}
