{
  "name": "\uce60\uce60\uae30\uc5c5 \ubc95\uc778\uce74\ub4dc \uc790\ub3d9\ubd84\ub958",
  "nodes": [
    {
      "parameters": {},
      "id": "trigger",
      "name": "\uc218\ub3d9 \uc2e4\ud589",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "command": "cd /home/tlswk/77corp && source venv/bin/activate && python scripts/main.py \"/home/tlswk/77corp/\uce74\ub4dc/\" --json-output --sync-sheets 2>&1"
      },
      "id": "execute",
      "name": "\uce74\ub4dc \ubd84\ub958 \uc2e4\ud589",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// JSON \ucd9c\ub825 \ud30c\uc2f1\nconst output = $input.first().json.stdout;\nconst jsonMatch = output.match(/--- JSON OUTPUT ---\\n([\\s\\S]*?)$/m);\n\nif (jsonMatch) {\n  const result = JSON.parse(jsonMatch[1]);\n  return [{\n    json: {\n      success: result.success,\n      processed: result.stats.processed,\n      duplicates: result.stats.duplicates,\n      manual_count: result.manual_count,\n      pending_file: result.pending_file,\n      message: `\ucc98\ub9ac: ${result.stats.processed}\uac74, \uc911\ubcf5: ${result.stats.duplicates}\uac74, \ubbf8\ubd84\ub958: ${result.manual_count}\uac74`\n    }\n  }];\n}\n\nreturn [{ json: { success: false, error: 'JSON \ud30c\uc2f1 \uc2e4\ud328' } }];"
      },
      "id": "parse",
      "name": "\uacb0\uacfc \ud30c\uc2f1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.manual_count }}",
              "operation": "larger",
              "value2": 0
            }
          ]
        }
      },
      "id": "check_manual",
      "name": "\ubbf8\ubd84\ub958 \uccb4\ud06c",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "message": "=### \ubc95\uc778\uce74\ub4dc \uc790\ub3d9\ubd84\ub958 \uc644\ub8cc\n\n{{ $json.message }}\n\n\u2705 \uad6c\uae00 \uc2dc\ud2b8 \ub3d9\uae30\ud654 \uc644\ub8cc"
      },
      "id": "notify_success",
      "name": "\uc644\ub8cc \uc54c\ub9bc",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        1050,
        200
      ]
    },
    {
      "parameters": {
        "message": "=### \u26a0\ufe0f \ubbf8\ubd84\ub958 \ud56d\ubaa9 \ubc1c\uc0dd\n\n{{ $json.message }}\n\n\ud83d\udccb \ubbf8\ubd84\ub958 \ud30c\uc77c: {{ $json.pending_file }}\n\n'\ucd5c\uc885_\uc0ac\uc6a9\uc6a9\ub3c4' \uceec\ub7fc\uc5d0 \uc785\ub825 \ud6c4 learn_patterns.py \uc2e4\ud589 \ud544\uc694"
      },
      "id": "notify_manual",
      "name": "\ubbf8\ubd84\ub958 \uc54c\ub9bc",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        1050,
        400
      ]
    }
  ],
  "connections": {
    "\uc218\ub3d9 \uc2e4\ud589": {
      "main": [
        [
          {
            "node": "\uce74\ub4dc \ubd84\ub958 \uc2e4\ud589",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uce74\ub4dc \ubd84\ub958 \uc2e4\ud589": {
      "main": [
        [
          {
            "node": "\uacb0\uacfc \ud30c\uc2f1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uacb0\uacfc \ud30c\uc2f1": {
      "main": [
        [
          {
            "node": "\ubbf8\ubd84\ub958 \uccb4\ud06c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ubbf8\ubd84\ub958 \uccb4\ud06c": {
      "main": [
        [
          {
            "node": "\uc644\ub8cc \uc54c\ub9bc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\ubbf8\ubd84\ub958 \uc54c\ub9bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}