{
  "name": "Vorlux AI | Discord Poll Creator",
  "active": false,
  "nodes": [
    {
      "parameters": { "httpMethod": "POST", "path": "discord-poll", "options": { "responseMode": "lastNode" } },
      "id": "webhook-trigger", "name": "Poll Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [220, 300]
    },
    {
      "parameters": { "mode": "runOnceForAllItems", "jsCode": "const data = $input.first().json.body || $input.first().json;\nreturn [{ json: { question: data.question || 'What do you think?', options: data.options || ['Option A', 'Option B'], duration: data.duration || 24, channel: data.channel || 'general' } }];" },
      "id": "format", "name": "Format Poll", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [460, 300]
    },
    {
      "parameters": { "url": "http://host.docker.internal:3010/api/games/polls", "method": "POST", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json) }}", "options": { "timeout": 15000 } },
      "id": "create-hub-poll", "name": "Create Hub Poll", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [700, 200]
    },
    {
      "parameters": { "url": "http://host.docker.internal:3010/api/discord/commands", "method": "POST", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ command: 'poll', channel: $json.channel, question: $json.question, options: $json.options, duration: $json.duration }) }}", "options": { "timeout": 15000 } },
      "id": "create-discord-poll", "name": "Create Discord Poll", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [700, 400]
    },
    {
      "parameters": { "method": "POST", "url": "={{$env.DISCORD_OPS_WEBHOOK}}", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ content: '📊 Poll created: ' + $('Format Poll').first().json.question }) }}" },
      "id": "discord-notify", "name": "Discord Notify", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [960, 300]
    }
  ],
  "connections": {
    "Poll Webhook": { "main": [[{ "node": "Format Poll", "type": "main", "index": 0 }]] },
    "Format Poll": { "main": [[{ "node": "Create Hub Poll", "type": "main", "index": 0 }, { "node": "Create Discord Poll", "type": "main", "index": 0 }]] },
    "Create Hub Poll": { "main": [[{ "node": "Discord Notify", "type": "main", "index": 0 }]] },
    "Create Discord Poll": { "main": [[{ "node": "Discord Notify", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}
