{
  "name": "Audit Document Compliance",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "audit-document-compliance",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{$json.body.fileUrl}}",
        "responseFormat": "string",
        "options": {}
      },
      "name": "Download File",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gemini-1.5-flash",
          "mode": "list",
          "cachedResultName": "Gemini 1.5 Flash"
        },
        "prompt": "=Analyze the following real estate document text and determine if it is compliant. Look for signatures and dates. Return JSON with 'status' (Compliant/Review Needed) and 'reason'.\n\nDocument Context: {{$node[\"Webhook\"].json.body.fileName}}\n\nText Content: {{$json.data}}",
        "options": {}
      },
      "name": "Google Gemini",
      "type": "n8n-nodes-base.googleGeminiChat",
      "typeVersion": 1,
      "position": [
        650,
        300
      ],
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{$json.output}}",
        "options": {}
      },
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Google Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}