{
  "name": "ezgpt-if-routing-demo",
  "active": false,
  "nodes": [
    {
      "id": "7eb54156-a99e-46b8-b23b-cd920c9d9b42",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "f498419a-541b-4bc5-872b-629f2020f3e1",
      "name": "Test Requests",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        260,
        0
      ],
      "parameters": {
        "mode": "raw",
        "jsonOutput": "{\n  \"requests\": [\n    {\n      \"id\": \"A1\",\n      \"budget\": 15000,\n      \"consent\": true,\n      \"message\": \"Нужна консультация по автоматизации\"\n    },\n    {\n      \"id\": \"A2\",\n      \"budget\": 9000,\n      \"consent\": true,\n      \"message\": \"Хочу обсудить небольшой проект\"\n    },\n    {\n      \"id\": \"A3\",\n      \"budget\": 20000,\n      \"consent\": false,\n      \"message\": \"Проверяю варианты\"\n    },\n    {\n      \"id\": \"A4\",\n      \"budget\": 25000,\n      \"consent\": true,\n      \"message\": \"   \"\n    },\n    {\n      \"id\": \"A5\",\n      \"budget\": 10000,\n      \"consent\": true,\n      \"message\": \"Запрос на минимальный проект\"\n    }\n  ]\n}",
        "includeOtherFields": false,
        "options": {}
      }
    },
    {
      "id": "d44f2102-5fb4-4f5a-88c1-f10b611afa5e",
      "name": "Split Requests",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        520,
        0
      ],
      "parameters": {
        "fieldToSplitOut": "requests",
        "include": "noOtherFields",
        "options": {}
      }
    },
    {
      "id": "2e8b12ab-d9d3-417a-ada9-c34269f0b827",
      "name": "Check Request",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        780,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "253d61a4-6e5e-4e4b-8593-62cbd66d1275",
              "leftValue": "={{ typeof $json.budget === 'number' && Number.isFinite($json.budget) ? $json.budget : -1 }}",
              "rightValue": 10000,
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            },
            {
              "id": "319ee010-3c20-45c5-890a-4e1506019b3d",
              "leftValue": "={{ $json.consent === true }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            },
            {
              "id": "cdbd1a41-dd59-4037-bf06-4db5c040666c",
              "leftValue": "={{ typeof $json.message === 'string' && $json.message.trim().length > 0 }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "f8bfcc33-b611-4a30-ac5f-88a56d3b2221",
      "name": "Ready for Review",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1060,
        -120
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "1ef19341-c40c-48b6-80f4-afd02021e6ee",
              "name": "status",
              "type": "string",
              "value": "ready_for_review"
            },
            {
              "id": "1162754e-3c28-4e8f-ae1c-de60d2bbced2",
              "name": "routing_reason",
              "type": "string",
              "value": "all_demo_rules_passed"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "b7ad15d7-f02b-4315-8a31-7da52ba22e92",
      "name": "Needs Check",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1060,
        180
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "7913e481-8b12-4b69-aaed-1b3329ff5b45",
              "name": "status",
              "type": "string",
              "value": "needs_check"
            },
            {
              "id": "ffc58ff3-8e1b-4323-a82b-d60a821fad62",
              "name": "routing_reason",
              "type": "string",
              "value": "one_or_more_demo_rules_failed"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Test Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test Requests": {
      "main": [
        [
          {
            "node": "Split Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Requests": {
      "main": [
        [
          {
            "node": "Check Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Request": {
      "main": [
        [
          {
            "node": "Ready for Review",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Needs Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
