{
  "name": "SMP - Traffic Ingest Router",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "traffic",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "4a4a4a4a-0004-0004-0004-000000000001",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const input = $input.first().json.body || $input.first().json;\nreturn [{\n  json: {\n    organizationId: input.organizationId || 'org_traffic',\n    deviceId: input.deviceId || 'dev_traf_01',\n    domain: 'traffic',\n    metrics: input.metrics || {},\n    timestamp: input.timestamp || Date.now()\n  }\n}];"
      },
      "id": "4a4a4a4a-0004-0004-0004-000000000002",
      "name": "Normalize Payload",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://host.docker.internal:3000/api/ingest",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-ingest-key",
              "value": "spla_ingest_dev_key"
            }
          ]
        }
      },
      "id": "4a4a4a4a-0004-0004-0004-000000000003",
      "name": "POST to Core",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        760,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Normalize Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Payload": {
      "main": [
        [
          {
            "node": "POST to Core",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}