{
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        64,
        304
      ],
      "id": "3212b56b-7123-48f7-b3c6-f002efc42b8a",
      "name": "Start"
    },
    {
      "parameters": {
        "url": "={{ $('Settings').first().json.base }}/data",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "file",
              "value": "entrants"
            },
            {
              "name": "username",
              "value": "={{ $('Settings').first().json.username }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-participant-key",
              "value": "={{ $('Settings').first().json.key }}"
            }
          ]
        },
        "options": {
          "pagination": {
            "pagination": {
              "parameters": {
                "parameters": [
                  {
                    "name": "cursor",
                    "value": "={{ $response.body.next_cursor }}"
                  }
                ]
              },
              "paginationCompleteWhen": "other",
              "completeExpression": "={{ $response.body.next_cursor == null }}",
              "limitPagesFetched": true,
              "maxRequests": 20
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        560,
        240
      ],
      "id": "488cbb6c-710e-4259-a1dc-a98ec9204bfe",
      "name": "Get entrants"
    },
    {
      "parameters": {
        "url": "={{ $('Settings').first().json.base }}/data",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "file",
              "value": "reads"
            },
            {
              "name": "username",
              "value": "={{ $('Settings').first().json.username }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-participant-key",
              "value": "={{ $('Settings').first().json.key }}"
            }
          ]
        },
        "options": {
          "pagination": {
            "pagination": {
              "parameters": {
                "parameters": [
                  {
                    "name": "cursor",
                    "value": "={{ $response.body.next_cursor }}"
                  }
                ]
              },
              "paginationCompleteWhen": "other",
              "completeExpression": "={{ $response.body.next_cursor == null }}",
              "limitPagesFetched": true,
              "maxRequests": 20
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        560,
        448
      ],
      "id": "79d8b6b1-2f05-48de-b134-4bdba43af4fb",
      "name": "Get reads"
    },
    {
      "parameters": {
        "url": "={{ $('Settings').first().json.base }}/data",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "file",
              "value": "prizes"
            },
            {
              "name": "username",
              "value": "={{ $('Settings').first().json.username }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-participant-key",
              "value": "={{ $('Settings').first().json.key }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1696,
        256
      ],
      "id": "0e3021e0-c888-4734-923f-c4dd87da3afc",
      "name": "Get prizes"
    },
    {
      "parameters": {
        "url": "={{ $('Settings').first().json.base }}/data",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "file",
              "value": "rulings"
            },
            {
              "name": "username",
              "value": "={{ $('Settings').first().json.username }}"
            },
            {
              "name": "stage1",
              "value": "={{ $('Stage 1 answer').first().json.b1 }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-participant-key",
              "value": "={{ $('Settings').first().json.key }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1104,
        320
      ],
      "id": "da667aec-5fbd-4a31-9313-2a0a56f8374c",
      "name": "Get rulings",
      "executeOnce": true
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c02a0000-0000-4000-8000-000000000055",
              "name": "b2",
              "value": 0,
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1424,
        320
      ],
      "id": "c826bd58-9635-4ac1-9204-128d53f34eea",
      "name": "Stage 2 answer",
      "notesInFlow": true,
      "notes": "Connect your own processing nodes and replace this blank field with an expression from their output."
    },
    {
      "parameters": {
        "url": "={{ $('Settings').first().json.base }}/data",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "file",
              "value": "claims"
            },
            {
              "name": "username",
              "value": "={{ $('Settings').first().json.username }}"
            },
            {
              "name": "stage2",
              "value": "={{ $('Stage 2 answer').first().json.b2 }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-participant-key",
              "value": "={{ $('Settings').first().json.key }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1696,
        464
      ],
      "id": "74e8ba86-c6e0-457e-82db-04180f5ac94e",
      "name": "Get claims",
      "executeOnce": true
    },
    {
      "parameters": {
        "content": "# Stage 1\nFetch entrants and reads. Add your native-node logic in the space between the file outputs and Stage 1 answer. Set b1 from your result.",
        "height": 680,
        "width": 260,
        "color": 5
      },
      "name": "Stage 1 guide",
      "id": "0128bbb5-f584-4425-b4d5-908e4beda308",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        512,
        0
      ]
    },
    {
      "parameters": {
        "content": "# Stage 2\nConnect Stage 1 answer after your first solve. Combine the files with rulings, then set b2 from your result.",
        "height": 680,
        "width": 500,
        "color": 5
      },
      "name": "Stage 2 guide",
      "id": "fa199cac-ac3b-4c55-ae0b-14094542a231",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        800,
        0
      ]
    },
    {
      "parameters": {
        "content": "# Stage 3\nConnect Stage 2 answer after your second solve. Combine results, prizes and claims, then set b3 from your result.",
        "height": 680,
        "width": 628,
        "color": 5
      },
      "name": "Stage 3 guide",
      "id": "94e96f89-bfa3-4cf7-8d97-22a9572005bd",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1328,
        0
      ]
    },
    {
      "parameters": {
        "content": "# Photo Finish\nFill in Settings.username and Settings.key. Leave base unchanged. The first successful fetch starts your recorded time.\n\nThis is a starter, not a solution. Add native nodes between the file outputs and the three answer fields. Follow the full rules on the challenge page. Use /check separately only when you want a charged check.",
        "height": 680,
        "width": 480,
        "color": 4
      },
      "name": "Start here",
      "id": "4760b5d0-9595-4f68-87b0-ac94b9129bf5",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c02a0000-0000-4000-8000-000000000002",
              "name": "username",
              "value": "",
              "type": "string"
            },
            {
              "id": "c02a0000-0000-4000-8000-000000000003",
              "name": "key",
              "value": "",
              "type": "string"
            },
            {
              "id": "c02a0000-0000-4000-8000-000000000004",
              "name": "base",
              "value": "https://marketing.app.n8n.cloud/webhook/cwc/challenge-02",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        288,
        304
      ],
      "id": "1a4fff4c-e475-44d1-aa15-14d5cdd238d8",
      "name": "Settings"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c02a0000-0000-4000-8000-000000000019",
              "name": "b1",
              "value": "",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        832,
        320
      ],
      "id": "c524c54a-b0d7-49a5-93c5-115b5ac5e73d",
      "name": "Stage 1 answer",
      "notesInFlow": true,
      "notes": "Connect your own processing nodes and replace this blank field with an expression from their output."
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get entrants": {
      "main": [
        []
      ]
    },
    "Get reads": {
      "main": [
        []
      ]
    },
    "Get prizes": {
      "main": [
        []
      ]
    },
    "Get rulings": {
      "main": [
        []
      ]
    },
    "Stage 2 answer": {
      "main": [
        [
          {
            "node": "Get claims",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get prizes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get claims": {
      "main": [
        []
      ]
    },
    "Settings": {
      "main": [
        [
          {
            "node": "Get reads",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get entrants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stage 1 answer": {
      "main": [
        [
          {
            "node": "Get rulings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "instanceId": "00b2d13d8f7b8034e314e4f3f6121cb6c0d621e57115a7d6c2616cf7fb4955e4"
  }
}