{
  "nodes": [
    {
      "type": "inputNode",
      "id": "input",
      "name": "request",
      "position": { "x": 100, "y": 200 }
    },
    {
      "type": "decisionTableNode",
      "id": "transactionRisk",
      "name": "TransactionRisk",
      "position": { "x": 400, "y": 80 },
      "content": {
        "hitPolicy": "first",
        "inputs": [
          { "id": "i1", "name": "Amount", "field": "transaction.amount" },
          { "id": "i2", "name": "Country", "field": "transaction.country" }
        ],
        "outputs": [
          { "id": "o1", "name": "Amount Score", "field": "amountScore" },
          { "id": "o2", "name": "Country Score", "field": "countryScore" }
        ],
        "rules": [
          { "_id": "r1", "i1": ">= 5000", "i2": "", "o1": "30", "o2": "0" },
          { "_id": "r2", "i1": "[1000..4999]", "i2": "", "o1": "20", "o2": "0" },
          { "_id": "r3", "i1": "[500..999]", "i2": "", "o1": "10", "o2": "0" },
          { "_id": "r4", "i1": "< 500", "i2": "", "o1": "5", "o2": "0" },
          { "_id": "r5", "i1": "", "i2": "\"NG\", \"RU\", \"CN\"", "o1": "0", "o2": "25" },
          { "_id": "r6", "i1": "", "i2": "\"BR\", \"IN\", \"ID\"", "o1": "0", "o2": "15" },
          { "_id": "r7", "i1": "", "i2": "", "o1": "0", "o2": "5" }
        ],
        "passThrough": true
      }
    },
    {
      "type": "decisionTableNode",
      "id": "customerRisk",
      "name": "CustomerRisk",
      "position": { "x": 400, "y": 200 },
      "content": {
        "hitPolicy": "first",
        "inputs": [
          { "id": "i1", "name": "Account Age (days)", "field": "customer.accountAgeDays" },
          { "id": "i2", "name": "Verification Level", "field": "customer.verificationLevel" },
          { "id": "i3", "name": "Previous Transactions", "field": "customer.previousTransactions" }
        ],
        "outputs": [
          { "id": "o1", "name": "Age Score", "field": "ageScore" },
          { "id": "o2", "name": "Verification Score", "field": "verifyScore" },
          { "id": "o3", "name": "History Score", "field": "historyScore" }
        ],
        "rules": [
          { "_id": "r1", "i1": "< 7", "i2": "", "i3": "", "o1": "25", "o2": "0", "o3": "0" },
          { "_id": "r2", "i1": "[7..30]", "i2": "", "i3": "", "o1": "15", "o2": "0", "o3": "0" },
          { "_id": "r3", "i1": "> 30", "i2": "", "i3": "", "o1": "5", "o2": "0", "o3": "0" },
          { "_id": "r4", "i1": "", "i2": "\"none\"", "i3": "", "o1": "0", "o2": "30", "o3": "0" },
          { "_id": "r5", "i1": "", "i2": "\"email_only\"", "i3": "", "o1": "0", "o2": "20", "o3": "0" },
          { "_id": "r6", "i1": "", "i2": "\"phone\"", "i3": "", "o1": "0", "o2": "10", "o3": "0" },
          { "_id": "r7", "i1": "", "i2": "\"id_verified\"", "i3": "", "o1": "0", "o2": "0", "o3": "0" },
          { "_id": "r8", "i1": "", "i2": "", "i3": "0", "o1": "0", "o2": "0", "o3": "20" },
          { "_id": "r9", "i1": "", "i2": "", "i3": "[1..5]", "o1": "0", "o2": "0", "o3": "10" },
          { "_id": "r10", "i1": "", "i2": "", "i3": "> 5", "o1": "0", "o2": "0", "o3": "0" }
        ],
        "passThrough": true
      }
    },
    {
      "type": "decisionTableNode",
      "id": "deviceRisk",
      "name": "DeviceRisk",
      "position": { "x": 400, "y": 320 },
      "content": {
        "hitPolicy": "first",
        "inputs": [
          { "id": "i1", "name": "Known Device", "field": "device.isKnown" },
          { "id": "i2", "name": "VPN Detected", "field": "device.vpnDetected" }
        ],
        "outputs": [
          { "id": "o1", "name": "Device Score", "field": "deviceScore" },
          { "id": "o2", "name": "VPN Score", "field": "vpnScore" }
        ],
        "rules": [
          { "_id": "r1", "i1": "false", "i2": "", "o1": "20", "o2": "0" },
          { "_id": "r2", "i1": "true", "i2": "", "o1": "0", "o2": "0" },
          { "_id": "r3", "i1": "", "i2": "true", "o1": "0", "o2": "15" },
          { "_id": "r4", "i1": "", "i2": "false", "o1": "0", "o2": "0" }
        ],
        "passThrough": true
      }
    },
    {
      "type": "expressionNode",
      "id": "calculateScore",
      "name": "CalculateScore",
      "position": { "x": 750, "y": 200 },
      "content": {
        "expressions": [
          { "id": "e1", "key": "transactionScore", "value": "$nodes.TransactionRisk.amountScore + $nodes.TransactionRisk.countryScore" },
          { "id": "e2", "key": "customerScore", "value": "$nodes.CustomerRisk.ageScore + $nodes.CustomerRisk.verifyScore + $nodes.CustomerRisk.historyScore" },
          { "id": "e3", "key": "deviceScore", "value": "$nodes.DeviceRisk.deviceScore + $nodes.DeviceRisk.vpnScore + (device.riskScore / 5)" },
          { "id": "e4", "key": "rawScore", "value": "$.transactionScore + $.customerScore + $.deviceScore" },
          { "id": "e5", "key": "normalizedScore", "value": "min([round($.rawScore), 100])" }
        ],
        "passThrough": true
      }
    },
    {
      "type": "decisionTableNode",
      "id": "riskClassification",
      "name": "RiskClassification",
      "position": { "x": 1100, "y": 200 },
      "content": {
        "hitPolicy": "first",
        "inputs": [
          { "id": "i1", "name": "Risk Score", "field": "normalizedScore" }
        ],
        "outputs": [
          { "id": "o1", "name": "Risk Level", "field": "riskLevel" },
          { "id": "o2", "name": "Action", "field": "action" }
        ],
        "rules": [
          { "_id": "r1", "i1": ">= 80", "o1": "\"critical\"", "o2": "\"block\"" },
          { "_id": "r2", "i1": "[60..79]", "o1": "\"high\"", "o2": "\"manual_review\"" },
          { "_id": "r3", "i1": "[40..59]", "o1": "\"medium\"", "o2": "\"step_up_auth\"" },
          { "_id": "r4", "i1": "[20..39]", "o1": "\"low\"", "o2": "\"monitor\"" },
          { "_id": "r5", "i1": "< 20", "o1": "\"minimal\"", "o2": "\"allow\"" }
        ],
        "passThrough": false
      }
    }
  ],
  "edges": [
    { "id": "e1", "sourceId": "input", "targetId": "transactionRisk", "type": "edge" },
    { "id": "e2", "sourceId": "input", "targetId": "customerRisk", "type": "edge" },
    { "id": "e3", "sourceId": "input", "targetId": "deviceRisk", "type": "edge" },
    { "id": "e4", "sourceId": "transactionRisk", "targetId": "calculateScore", "type": "edge" },
    { "id": "e5", "sourceId": "customerRisk", "targetId": "calculateScore", "type": "edge" },
    { "id": "e6", "sourceId": "deviceRisk", "targetId": "calculateScore", "type": "edge" },
    { "id": "e7", "sourceId": "calculateScore", "targetId": "riskClassification", "type": "edge" }
  ]
}
