{
  "schema_version": "donotact_n8n_dispute_guard_template_v0",
  "name": "Do Not Act dispute guard before agent action",
  "not_advice": true,
  "requires": [
    "DONOTACT_API_KEY",
    "market_id",
    "venue"
  ],
  "boundary": "This workflow only checks Do Not Act diagnostics. It does not submit orders, sign payloads, custody funds, or route execution.",
  "nodes": [
    {
      "name": "Set market",
      "type": "n8n-nodes-base.set",
      "parameters": {
        "values": {
          "string": [
            {"name": "venue", "value": "polymarket"},
            {"name": "market_id", "value": "580810"}
          ]
        }
      }
    },
    {
      "name": "DoNotAct dispute check",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "method": "GET",
        "url": "={{'https://donotact.com/v1/dispute/' + $json.venue + '/' + $json.market_id}}",
        "headerParametersUi": {
          "parameter": [
            {"name": "X-API-Key", "value": "={{$env.DONOTACT_API_KEY}}"},
            {"name": "X-CE-Source", "value": "n8n/donotact-dispute-guard"}
          ]
        },
        "responseFormat": "json"
      }
    },
    {
      "name": "Continue only if READY",
      "type": "n8n-nodes-base.if",
      "parameters": {
        "conditions": {
          "string": [
            {"value1": "={{$json.verdict}}", "operation": "equal", "value2": "READY"}
          ]
        }
      }
    },
    {
      "name": "Stop and preserve evidence",
      "type": "n8n-nodes-base.noOp",
      "parameters": {
        "note": "If verdict is DO_NOT_ACT or INSUFFICIENT_EVIDENCE, stop automated action and preserve no_trade_reasons, what_would_change_this, receipt, and source_refs."
      }
    }
  ],
  "agent_policy": {
    "continue_when": "verdict == READY",
    "stop_when": ["DO_NOT_ACT", "INSUFFICIENT_EVIDENCE"],
    "preserve_fields": ["verdict", "no_trade_reasons", "what_would_change_this", "receipt", "source_refs", "not_advice"]
  }
}
