{
  "id": "ArkePdfLab1471v1",
  "name": "ArkePDF synthetic review-copy lab",
  "nodes": [
    {
      "id": "8c8eb273-ebf1-58ef-ac77-610d5766d78c",
      "name": "Manual fixture run",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "65a0ccf2-0229-5517-bd17-358b98f5200e",
      "name": "Read source PDF",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        0
      ],
      "parameters": {
        "url": "http://127.0.0.1:58147/source.pdf",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "input_pdf"
            }
          }
        }
      }
    },
    {
      "id": "15ce0c66-d989-5bba-9076-bcd21b081b20",
      "name": "Submit with stable job key",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        0
      ],
      "parameters": {
        "url": "http://127.0.0.1:58147/jobs",
        "options": {},
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Job-Key",
              "value": "SYN-DOC-01:r2:review-copy-v1:SYN-REVIEW-01"
            },
            {
              "name": "Content-Type",
              "value": "application/pdf"
            }
          ]
        },
        "sendBody": true,
        "contentType": "binaryData",
        "inputDataFieldName": "input_pdf"
      },
      "retryOnFail": true,
      "maxTries": 2,
      "waitBetweenTries": 1000
    },
    {
      "id": "26fca639-9174-5c84-8e0b-7120162258d6",
      "name": "Read job status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        0
      ],
      "parameters": {
        "url": "=http://127.0.0.1:58147/jobs/{{$json.job_id}}",
        "options": {}
      }
    },
    {
      "id": "8628718b-6c5f-5351-b922-cf0a60772c4c",
      "name": "Check terminal status",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        880,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "44ea1b1e-b108-5511-a9e0-f5581665b765",
              "leftValue": "={{ $json.state }}",
              "rightValue": "succeeded",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "27d1e43a-f0b9-5a1a-a7bf-d0facc22e6fd",
      "name": "Read result PDF",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1100,
        0
      ],
      "parameters": {
        "url": "=http://127.0.0.1:58147/jobs/{{$json.job_id}}/result.pdf",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "review_pdf"
            }
          }
        }
      }
    },
    {
      "id": "44f19f2a-e325-5cce-aa77-6a2f3e700256",
      "name": "Write review copy",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1320,
        0
      ],
      "parameters": {
        "url": "http://127.0.0.1:58147/destinations/SYN-REVIEW-01",
        "options": {},
        "method": "PUT",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Job-Key",
              "value": "SYN-DOC-01:r2:review-copy-v1:SYN-REVIEW-01"
            },
            {
              "name": "Content-Type",
              "value": "application/pdf"
            }
          ]
        },
        "sendBody": true,
        "contentType": "binaryData",
        "inputDataFieldName": "review_pdf"
      }
    },
    {
      "id": "ac301492-706b-56d0-9b0e-9be6634649e3",
      "name": "Read destination receipt",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1540,
        0
      ],
      "parameters": {
        "url": "http://127.0.0.1:58147/destinations/SYN-REVIEW-01",
        "options": {}
      }
    },
    {
      "id": "90176de2-06ed-5ac0-b020-b64051d8a9f5",
      "name": "Stop incomplete job",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        1100,
        260
      ],
      "parameters": {
        "errorMessage": "Fixture job has not reached a successful terminal state."
      }
    }
  ],
  "connections": {
    "Manual fixture run": {
      "main": [
        [
          {
            "node": "Read source PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read source PDF": {
      "main": [
        [
          {
            "node": "Submit with stable job key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submit with stable job key": {
      "main": [
        [
          {
            "node": "Read job status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read job status": {
      "main": [
        [
          {
            "node": "Check terminal status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check terminal status": {
      "main": [
        [
          {
            "node": "Read result PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Stop incomplete job",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read result PDF": {
      "main": [
        [
          {
            "node": "Write review copy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write review copy": {
      "main": [
        [
          {
            "node": "Read destination receipt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "versionId": "439321f4-c30f-4ae9-b8d9-a6774350f9e9"
}
