{
  "nodes": [
    {
      "parameters": {
        "public": true,
        "initialMessages": "Merhaba! 👋 FikoYT Üretim Yönetim Sistemi'ne hoş geldiniz.\n\n✨ YAPABILECEĞIM İŞLEMLER:\n• 📋 Proje ve sipariş yönetimi\n• 📦 Stok takibi (Strafor malzeme)\n• ⚙️ Üretim aşamaları planlaması\n• 🔧 CNC kuyruk yönetimi\n• 👥 Müşteri yönetimi\n• 📊 Kapasite ve kota takibi\n\n⚙️ KOMUTLAR: EKLE | GÜNCELLE | SIL | SORGULA\nℹ️ YARDIM: Komut yazarken 'pipe' (|) ile alanları ayırın.\n\nSizin için 7/24 buradayız! 🚀",
        "options": {
          "allowedOrigins": "*",
          "allowFileUploads": false,
          "inputPlaceholder": "Örn: EKLE sipariş | müşteri: M001 | ürün: Model",
          "showWelcomeScreen": true,
          "getStarted": "Başlayalım",
          "subtitle": "Akıllı Üretim Yönetim Asistanı",
          "title": "FikoYT Üretim Yönetim",
          "responseMode": "responseNodes"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        -784,
        -80
      ],
      "id": "756b2c2e-10f3-4871-a97a-8802b5540168",
      "name": "Chat Trigger",
      "webhookId": "b95e4bc4-159d-4eea-98a8-944843f71ae7"
    },
    {
      "parameters": {
        "modelId": "claude-3-5-sonnet-20241022",
        "messages": {
          "values": [
            {
              "content": "Sen FikoYT Üretim/Modelhane Yönetim Sistemi'nin AI asistanısın.\n\n📋 KOLEKSIYONLAR:\n- uyar_taslak_isler: Proje taslakları, planlama\n- uyar_siparisler: Müşteri siparişleri\n- uyar_stok_strafor: Malzeme stok (Strafor)\n- uyar_uretim_adimlari: Üretim süreçleri\n- uyar_cnc_kuyruk: CNC makine sırası\n- uyar_musteriler: Müşteri verisi\n- uyar_kota_bilgileri: Kapasite/kota takibi\n- uyar_dosyalar: Dosya yönetimi\n\n⚡ KOMUT FORMATLARI:\n1. EKLE [collection_type] | field1: value1 | field2: value2\n2. GÜNCELLE [collection_type] | id_field: id_value | field: new_value\n3. SIL [collection_type] | id_field: id_value (Soft delete: status='silindi')\n4. SORGULA [collection_type] | filter_field: filter_value\n5. RAPORLA [collection_type] | type: aggregation_type\n\n✅ YANIT FORMATI (KESIN JSON - Başında ve sonunda):\n{\n  \"action\": \"insert|update|delete|find|aggregate\",\n  \"collection\": \"tam_koleksiyon_adi\",\n  \"query\": {\"search_field\": \"value\"},\n  \"data\": {\"field\": \"value\"},\n  \"message\": \"Türkçe kullanıcı mesajı\"\n}\n\n🚨 KURALLAR:\n- Silme işlemi YALNIz soft delete (status='silindi')\n- Yanlış/eksik veri varsa UYARI don, işlem yapma\n- Tüm çıktı KESIN JSON formatında olmalı\n- Collection adını tam ve doğru yaz\n\nKullanıcı komutu: {{ $json.chatInput }}"
            }
          ]
        },
        "simplify": "",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.anthropic",
      "typeVersion": 1,
      "position": [
        -176,
        -80
      ],
      "id": "16d7cede-f40f-4917-a32d-97c88906ba83",
      "name": "Claude AI - Komut İşleyici",
      "credentials": {
        "anthropicApi": {
          "id": "ZK13BlRtHBAO0eqz",
          "name": "Z.Ai Antrophic"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "MongoDB - Yeni kayıt ekleme (INSERT)",
        "operation": "insert",
        "collection": "={{ $json.collection }}",
        "options": {}
      },
      "type": "n8n-nodes-base.mongoDbTool",
      "typeVersion": 1.2,
      "position": [
        -720,
        304
      ],
      "id": "a2a22783-3762-4416-86f9-da6e2e5d034b",
      "name": "MongoDB - INSERT",
      "credentials": {
        "mongoDb": {
          "id": "WG6KsyXksE9VYndz",
          "name": "MongoDB account"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "MongoDB - Kayıt güncelleme (UPDATE)",
        "operation": "update",
        "collection": "={{ $json.collection }}",
        "updateKey": "={{ Object.keys($json.query || {})[0] || '_id' }}",
        "options": {}
      },
      "type": "n8n-nodes-base.mongoDbTool",
      "typeVersion": 1.2,
      "position": [
        -512,
        288
      ],
      "id": "5a2ea42d-a9fe-4e61-a809-b28f4f608eb3",
      "name": "MongoDB - UPDATE",
      "credentials": {
        "mongoDb": {
          "id": "WG6KsyXksE9VYndz",
          "name": "MongoDB account"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "MongoDB - Kayıt silme (DELETE - Soft delete)",
        "operation": "delete",
        "collection": "={{ $json.collection }}"
      },
      "type": "n8n-nodes-base.mongoDbTool",
      "typeVersion": 1.2,
      "position": [
        -288,
        288
      ],
      "id": "e5f3a366-3d3f-4a54-8b1d-cdc20fae7544",
      "name": "MongoDB - DELETE",
      "credentials": {
        "mongoDb": {
          "id": "WG6KsyXksE9VYndz",
          "name": "MongoDB account"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "MongoDB - Veri sorgulama (FIND/QUERY)",
        "collection": "={{ $json.collection }}",
        "options": {},
        "query": "={{ $json.query || {} }}"
      },
      "type": "n8n-nodes-base.mongoDbTool",
      "typeVersion": 1.2,
      "position": [
        -112,
        288
      ],
      "id": "ea50517a-14c4-4365-a624-095c4c6b7593",
      "name": "MongoDB - FIND",
      "credentials": {
        "mongoDb": {
          "id": "WG6KsyXksE9VYndz",
          "name": "MongoDB account"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "MongoDB - Aggregation (Raporlama)",
        "operation": "aggregate",
        "collection": "={{ $json.collection }}"
      },
      "type": "n8n-nodes-base.mongoDbTool",
      "typeVersion": 1.2,
      "position": [
        80,
        288
      ],
      "id": "52b1174a-25f8-4284-b1c5-274807da0068",
      "name": "MongoDB - AGGREGATE",
      "credentials": {
        "mongoDb": {
          "id": "WG6KsyXksE9VYndz",
          "name": "MongoDB account"
        }
      }
    },
    {
      "parameters": {
        "functionCode": "const result = $json;\nlet formatted = '';\n\nif (!result || !result.action) {\n  return {\n    message: '❌ Sistem hatası: Geçersiz yanıt',\n    status: 'error'\n  };\n}\n\nconst action = result.action;\nconst msg = result.message || '';\n\nif (action === 'insert') {\n  formatted = `✅ ${msg}\\n📌 Yeni kayıt başarıyla eklendi.`;\n  if (result.insertedId) formatted += `\\nID: ${result.insertedId}`;\n} else if (action === 'update') {\n  const count = result.modifiedCount || 0;\n  formatted = `✅ ${msg}\\n📊 ${count} kayıt güncellendi.`;\n} else if (action === 'delete') {\n  const count = result.deletedCount || 0;\n  formatted = `✅ ${msg}\\n🗑️ ${count} kayıt silindi (soft delete).`;\n} else if (action === 'find') {\n  let count = 0;\n  if (Array.isArray($json)) count = $json.length;\n  else if (Array.isArray(result.data)) count = result.data.length;\n  formatted = `✅ ${msg}\\n📋 Bulunan: ${count} kayıt`;\n} else if (action === 'aggregate') {\n  formatted = `✅ ${msg}\\n📊 Rapor hazırlandı.`;\n} else {\n  formatted = `ℹ️ ${msg}`;\n}\n\nreturn { message: formatted, status: 'success' };"
      },
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        304,
        -64
      ],
      "id": "9b302349-bc92-41d6-80ac-6a5bd531f50d",
      "name": "Yanıt Formatla"
    },
    {
      "parameters": {
        "message": "={{ $json.message || 'İşlem tamamlandı' }}",
        "waitUserReply": false,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chat",
      "typeVersion": 1,
      "position": [
        688,
        -128
      ],
      "id": "47007e62-5727-494a-8809-d2bcba1e8517",
      "name": "Yanıt Gönder"
    }
  ],
  "connections": {
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "Claude AI - Komut İşleyici",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude AI - Komut İşleyici": {
      "main": [
        [
          {
            "node": "Yanıt Formatla",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB - INSERT": {
      "ai_tool": [
        [
          {
            "node": "Claude AI - Komut İşleyici",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB - UPDATE": {
      "ai_tool": [
        [
          {
            "node": "Claude AI - Komut İşleyici",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB - DELETE": {
      "ai_tool": [
        [
          {
            "node": "Claude AI - Komut İşleyici",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB - FIND": {
      "ai_tool": [
        [
          {
            "node": "Claude AI - Komut İşleyici",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB - AGGREGATE": {
      "ai_tool": [
        [
          {
            "node": "Claude AI - Komut İşleyici",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Yanıt Formatla": {
      "main": [
        [
          {
            "node": "Yanıt Gönder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "cf59b2e3a13e7cbbe4124cf8b1e8a4d09040d532706ee4198e7e3501e8cc3a79"
  }
}