{
  "id": "TWCaseApproval2026",
  "name": "Tokenwerk Case Study · lokale Freigabeprüfung",
  "nodes": [
    {
      "id": "922ca023-4531-46a3-acdd-87cea64508e5",
      "name": "Testeingang",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "parameters": {
        "httpMethod": "POST",
        "path": "tokenwerk-case-approval",
        "responseMode": "responseNode",
        "options": {}
      },
      "position": [
        0,
        0
      ]
    },
    {
      "id": "5b7be92b-aa6d-4d70-b695-cbfd1fe194b7",
      "name": "Entwurf",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { vorgang_id: $json.body.vorgang_id, entwurf: $json.body.entwurf } }}",
        "options": {}
      },
      "position": [
        220,
        0
      ]
    },
    {
      "id": "c1cc5191-aa48-47f5-ac1c-b1031716dc90",
      "name": "Prueflink",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ {executionId:$execution.id,resumeUrl:$execution.resumeUrl,vorgang_id:$json.vorgang_id,entwurf:$json.entwurf} }}",
        "options": {}
      },
      "position": [
        440,
        0
      ]
    },
    {
      "id": "93870429-a43e-4400-92a6-3779f1f7510d",
      "name": "Freigabe abwarten",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "parameters": {
        "resume": "webhook",
        "incomingAuthentication": "none",
        "httpMethod": "POST",
        "responseMode": "onReceived",
        "limitWaitTime": true,
        "limitType": "afterTimeInterval",
        "resumeAmount": 5,
        "resumeUnit": "seconds",
        "options": {}
      },
      "position": [
        660,
        0
      ]
    },
    {
      "id": "f8f42e1e-30c3-44ea-9bdd-29adc46b4f20",
      "name": "Gueltige Genehmigung",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e8061ddb-5fd2-4f99-aded-200531e5ac92",
              "leftValue": "={{ $json.body?.entscheidung ?? \"\" }}",
              "rightValue": "genehmigt",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "id": "119239b6-b3ba-485e-9ffa-d886cb5d17f4",
              "leftValue": "={{ $json.body?.vorgang_id ?? \"\" }}",
              "rightValue": "={{ $('Entwurf').first().json.vorgang_id }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "id": "7c87ca26-33a3-4c20-b774-667b0798dd2f",
              "leftValue": "={{ $json.body?.entwurf ?? \"\" }}",
              "rightValue": "={{ $('Entwurf').first().json.entwurf }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ]
        },
        "options": {}
      },
      "position": [
        880,
        0
      ]
    },
    {
      "id": "8f63c090-b1dc-4578-9600-90634859a2df",
      "name": "Genehmigter Vorgang",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { vorgang_id: $('Entwurf').first().json.vorgang_id, entwurf: $('Entwurf').first().json.entwurf } }}",
        "options": {}
      },
      "position": [
        1100,
        -120
      ]
    },
    {
      "id": "aa4709c3-1086-4069-b4e9-01edc5e64c0a",
      "name": "Doppelte IDs sperren",
      "type": "n8n-nodes-base.removeDuplicates",
      "typeVersion": 2,
      "parameters": {
        "operation": "removeItemsSeenInPreviousExecutions",
        "logic": "removeItemsWithAlreadySeenKeyValues",
        "dedupeValue": "={{ $json.vorgang_id }}",
        "options": {
          "scope": "node",
          "historySize": 1000
        }
      },
      "position": [
        1320,
        -120
      ]
    },
    {
      "id": "3cf82cc5-f527-4951-923f-b543ad727bb4",
      "name": "Interne Testausgabe",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { vorgang_id: $json.vorgang_id, notiz: $json.entwurf, aktion: \"nur_interne_testausgabe\" } }}",
        "options": {}
      },
      "position": [
        1540,
        -180
      ]
    },
    {
      "id": "0ecc889a-4b65-4725-ab26-f73e4554c8df",
      "name": "Doppelt verworfen",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { status: \"doppelte_id_keine_aktion\" } }}",
        "options": {}
      },
      "position": [
        1540,
        -20
      ]
    },
    {
      "id": "8c90768d-5b89-4d17-aec5-06b050b7a07d",
      "name": "Ohne Genehmigung",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { status: \"nicht_genehmigt_keine_aktion\" } }}",
        "options": {}
      },
      "position": [
        1100,
        140
      ]
    }
  ],
  "connections": {
    "Testeingang": {
      "main": [
        [
          {
            "node": "Entwurf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Entwurf": {
      "main": [
        [
          {
            "node": "Prueflink",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prueflink": {
      "main": [
        [
          {
            "node": "Freigabe abwarten",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Freigabe abwarten": {
      "main": [
        [
          {
            "node": "Gueltige Genehmigung",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gueltige Genehmigung": {
      "main": [
        [
          {
            "node": "Genehmigter Vorgang",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ohne Genehmigung",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Genehmigter Vorgang": {
      "main": [
        [
          {
            "node": "Doppelte IDs sperren",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Doppelte IDs sperren": {
      "main": [
        [
          {
            "node": "Interne Testausgabe",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Doppelt verworfen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveDataSuccessExecution": "all",
    "saveDataErrorExecution": "all",
    "saveExecutionProgress": true
  },
  "active": false
}
