{
  "name": "ezgpt-dedup-orders-demo",
  "active": false,
  "nodes": [
    {
      "id": "11ff5d86-6636-4624-83e7-a86f9e1a7ae2",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "e7a886c5-4699-4905-9136-d7f5d51e936d",
      "name": "Test Orders",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        0
      ],
      "parameters": {
        "mode": "raw",
        "jsonOutput": "{\n  \"orders\": [\n    {\n      \"order_id\": \"O1\",\n      \"email\": \"anna@example.invalid\",\n      \"amount\": 1500,\n      \"source\": \"A\"\n    },\n    {\n      \"order_id\": \"O1\",\n      \"email\": \"anna@example.invalid\",\n      \"amount\": 1500,\n      \"source\": \"B\"\n    },\n    {\n      \"order_id\": \"O2\",\n      \"email\": \"anna@example.invalid\",\n      \"amount\": 2400,\n      \"source\": \"A\"\n    },\n    {\n      \"order_id\": \"O3\",\n      \"email\": \"boris@example.invalid\",\n      \"amount\": 800,\n      \"source\": \"A\"\n    },\n    {\n      \"order_id\": \"O3\",\n      \"email\": \"boris@example.invalid\",\n      \"amount\": 800,\n      \"source\": \"A\"\n    }\n  ]\n}",
        "includeOtherFields": false,
        "options": {}
      }
    },
    {
      "id": "fcb5796d-39f9-4c38-8eff-7d41ec0030ef",
      "name": "Split Orders",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        440,
        0
      ],
      "parameters": {
        "fieldToSplitOut": "orders",
        "include": "noOtherFields",
        "options": {}
      }
    },
    {
      "id": "b1b5cd5f-79ce-4475-ba1c-96b79b8c0a59",
      "name": "Check ID",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        660,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "73702fb5-a25f-474b-8e60-da796f69b7a0",
              "leftValue": "={{ typeof $json.order_id === 'string' && $json.order_id.trim().length > 0 && $json.order_id === $json.order_id.trim() }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "ca8b7b5a-cfaf-4fcb-9316-372d901672c8",
      "name": "Deduplicate Orders",
      "type": "n8n-nodes-base.removeDuplicates",
      "typeVersion": 2,
      "position": [
        880,
        -120
      ],
      "parameters": {
        "operation": "removeDuplicateInputItems",
        "compare": "selectedFields",
        "fieldsToCompare": "order_id",
        "options": {
          "disableDotNotation": false,
          "removeOtherFields": false
        }
      }
    },
    {
      "id": "a126ccbb-7ca5-4aa9-b4c6-761878ec4c92",
      "name": "Ready",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1100,
        -120
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "057a03db-761d-4b9d-8cc9-a6b7785cdc08",
              "name": "processing_status",
              "type": "string",
              "value": "deduplicated_in_current_input"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "7fd51ce8-b709-4523-a40d-a06b046e1872",
      "name": "Review",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        880,
        140
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6fc609aa-486a-450d-834e-940527c90ff5",
              "name": "processing_status",
              "type": "string",
              "value": "invalid_order_id"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Test Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test Orders": {
      "main": [
        [
          {
            "node": "Split Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Orders": {
      "main": [
        [
          {
            "node": "Check ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deduplicate Orders": {
      "main": [
        [
          {
            "node": "Ready",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check ID": {
      "main": [
        [
          {
            "node": "Deduplicate Orders",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}
