{
  "name": "Muzik Platformu Uretim Otomasyonu v4",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9 * * 1-5"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        0
      ],
      "id": "46f6ba28-e7dc-4433-a043-0fdc30d4ea46",
      "name": "Sabah 09:00 Basla",
      "notes": "Her hafta ici sabah 09:00da otomatik baslatir. Degistirmek icin 'expression' degerini degistir."
    },
    {
      "parameters": {
        "method": "GET",
        "url": "={{ $vars.ADMIN_PANEL_URL }}/api/tasks?status=pending&limit=10",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.ADMIN_API_KEY }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        220,
        0
      ],
      "id": "bed22a55-80fb-4d5f-a09a-edecd593b8b4",
      "name": "Bekleyen Gorevleri Al",
      "notes": "Admin panelinden pending gorevleri ceker. Variables: ADMIN_PANEL_URL, ADMIN_API_KEY"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "0ab557d0-77a6-4296-9c37-48a59d93df38",
              "leftValue": "={{ Array.isArray($json) ? $json.length : ($json.tasks ? $json.tasks.length : 1) }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "gt"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        440,
        0
      ],
      "id": "428ca58f-abce-47ae-9ea1-a232dc6b9a12",
      "name": "Gorev Var Mi",
      "notes": "Gorev varsa TRUE (ust yol), yoksa FALSE (alt yol - bildirim gonder)"
    },
    {
      "parameters": {
        "sendTo": "={{ $vars.SENIN_EMAILIN }}",
        "subject": "Muzik Sistemi \u2014 Bekleyen gorev kalmadi",
        "emailType": "text",
        "message": "Bugun uretilecek tum gorevler tamamlandi."
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        660,
        160
      ],
      "id": "1752679b-dee7-49fa-8ec6-12f84250fc21",
      "name": "Gorev Yok Bildirimi",
      "notes": "Gorev yoksa email gonderir. Credentials menusunden Gmail OAuth2 ekle.",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        660,
        -80
      ],
      "id": "ea196b93-f3cb-4178-8a72-c2a51a6af0e8",
      "name": "Her Gorev Icin Dongu",
      "notes": "Gorevleri teker teker isler. Her seferinde 1 sarki uretir."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.anthropic.com/v1/messages",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $vars.ANTHROPIC_API_KEY }}"
            },
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"model\":\"claude-sonnet-4-6\",\"max_tokens\":120,\"messages\":[{\"role\":\"user\",\"content\":\"Write a music AI prompt. Rules: max 7 params, 15-40 tokens, English only, NO real artist/brand names. Output ONLY the prompt text.\\nGenre: {{ $json.genre }} {{ $json.sub_genre }}\\nVenue: {{ $json.sector }}\\nMood: {{ $json.mood_primary }}\\nVocal: {{ $json.vocal }} {{ $json.language }}\\nInstruments (pick max 2): {{ $json.instruments_hint }}\\nExample: Smooth jazz cafe background, female vocal, piano and bass, warm morning feel\"}]}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        880,
        -80
      ],
      "id": "c9b51bbb-7492-423e-9f93-de946bea766c",
      "name": "Claude ile Prompt Yaz",
      "notes": "Claude AI prompt yazdirir. Variables: ANTHROPIC_API_KEY (console.anthropic.com)"
    },
    {
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "6f73940b-1ffc-4b9f-aae8-3edb0c2d2e3c",
              "name": "clean_prompt",
              "value": "={{ $json.content[0].text.trim() }}",
              "type": "string"
            },
            {
              "id": "eedcdf71-6859-46bd-86f8-0585ec1e06b4",
              "name": "task_id",
              "value": "={{ $('Her Gorev Icin Dongu').item.json.task_id }}",
              "type": "string"
            },
            {
              "id": "4e380cb9-dfbd-498b-870e-3c88bf5816f8",
              "name": "genre",
              "value": "={{ $('Her Gorev Icin Dongu').item.json.genre }}",
              "type": "string"
            },
            {
              "id": "526a7a64-b68e-4fa9-85ab-7ef9d42b879d",
              "name": "sub_genre",
              "value": "={{ $('Her Gorev Icin Dongu').item.json.sub_genre }}",
              "type": "string"
            },
            {
              "id": "710080f1-4d72-4c15-a7e3-03dfbdbc0d11",
              "name": "ai_tool",
              "value": "={{ $('Her Gorev Icin Dongu').item.json.ai_tool }}",
              "type": "string"
            },
            {
              "id": "0afbf9a3-40e5-4648-9a0a-d9661ef24337",
              "name": "sector",
              "value": "={{ $('Her Gorev Icin Dongu').item.json.sector }}",
              "type": "string"
            },
            {
              "id": "4c36c074-4511-4a83-b1a9-1980fee5f9a0",
              "name": "mood",
              "value": "={{ $('Her Gorev Icin Dongu').item.json.mood_primary }}",
              "type": "string"
            },
            {
              "id": "c1ac5f72-9103-4319-ad79-d83a1f439487",
              "name": "vocal",
              "value": "={{ $('Her Gorev Icin Dongu').item.json.vocal }}",
              "type": "string"
            },
            {
              "id": "fbc115db-cb75-45bd-a419-3e9c27a5422b",
              "name": "language",
              "value": "={{ $('Her Gorev Icin Dongu').item.json.language }}",
              "type": "string"
            },
            {
              "id": "6b382391-b2a3-4494-a93a-dc238172d4ec",
              "name": "tier",
              "value": "={{ $('Her Gorev Icin Dongu').item.json.tier }}",
              "type": "string"
            },
            {
              "id": "b7d2e6b6-5c35-4510-985d-1b12a3b67f35",
              "name": "prompt_id",
              "value": "=PROMPT-{{ $now.format('YYYYMMDDHHmmss') }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1100,
        -80
      ],
      "id": "89e48b89-ccbf-436e-aed8-44a52c001eb5",
      "name": "Prompt Temizle",
      "notes": "Claude cevabindan promptu alir, gorev bilgilerini duzenler."
    },
    {
      "parameters": {
        "mode": "rules",
        "rules": {
          "rules": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "loose"
                },
                "conditions": [
                  {
                    "id": "ba00625c-c337-461b-86be-6620d84bbe25",
                    "leftValue": "={{ $json.ai_tool }}",
                    "rightValue": "Suno",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Suno"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "loose"
                },
                "conditions": [
                  {
                    "id": "23c1c524-0104-4c09-8736-7396185e6786",
                    "leftValue": "={{ $json.ai_tool }}",
                    "rightValue": "MusicGen",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "MusicGen"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "loose"
                },
                "conditions": [
                  {
                    "id": "e52605c8-a0dd-4ef9-84f7-c5aae2a458c1",
                    "leftValue": "={{ $json.ai_tool }}",
                    "rightValue": "Stable Audio",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "StableAudio"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "loose"
                },
                "conditions": [
                  {
                    "id": "2c04a93c-3d5d-4a81-82fc-b1bb6c024bff",
                    "leftValue": "={{ $json.ai_tool }}",
                    "rightValue": "Replicate",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Replicate"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "loose"
                },
                "conditions": [
                  {
                    "id": "b418eb52-2cd3-406e-8acc-60e1f5150d0c",
                    "leftValue": "={{ $json.ai_tool }}",
                    "rightValue": "Riffusion",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Riffusion"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        1320,
        -80
      ],
      "id": "3bb37efd-fb7e-4f6f-8aa0-3896f25ade10",
      "name": "AI Arac Secici",
      "notes": "Hangi AI araci secildiyse o kola yonlendirir."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.suno.ai/v1/generate",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.SUNO_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"prompt\":\"{{ $json.clean_prompt }}\",\"make_instrumental\":{{ $json.vocal === 'false' }},\"mv\":\"chirp-v3-5\",\"wait_audio\":true}",
        "options": {
          "timeout": 120000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        1560,
        -280
      ],
      "id": "883ac730-4306-4388-ab4c-43020b0055b9",
      "name": "Suno API",
      "notes": "SUNO_API_KEY: suno.ai/api"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.replicate.com/v1/models/meta/musicgen/predictions",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.REPLICATE_API_TOKEN }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Prefer",
              "value": "wait"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"input\":{\"prompt\":\"{{ $json.clean_prompt }}\",\"model_version\":\"stereo-large\",\"output_format\":\"mp3\",\"duration\":180}}",
        "options": {
          "timeout": 120000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        1560,
        -140
      ],
      "id": "f1537708-5d23-4d40-ab5f-83a8fd6f82e2",
      "name": "MusicGen Replicate",
      "notes": "REPLICATE_API_TOKEN: replicate.com/account/api-tokens"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.stability.ai/v2beta/audio/stable-audio-open/generate",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.STABLE_AUDIO_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"prompt\":\"{{ $json.clean_prompt }}\",\"seconds_total\":180,\"steps\":100}",
        "options": {
          "timeout": 120000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        1560,
        0
      ],
      "id": "0da0ff8b-343f-4a70-929b-a09610276e35",
      "name": "Stable Audio",
      "notes": "STABLE_AUDIO_KEY: stability.ai/account/keys"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.replicate.com/v1/models/meta/musicgen/predictions",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.REPLICATE_API_TOKEN }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Prefer",
              "value": "wait"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"input\":{\"prompt\":\"{{ $json.clean_prompt }}\",\"model_version\":\"stereo-melody-large\",\"output_format\":\"mp3\",\"duration\":165}}",
        "options": {
          "timeout": 120000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        1560,
        140
      ],
      "id": "e860e392-e484-43b1-9e0a-d2047f058311",
      "name": "Replicate Genel",
      "notes": "Acoustic, World, Country turler icin."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api-inference.huggingface.co/models/riffusion/riffusion-model-v1",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.HUGGINGFACE_TOKEN }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"inputs\":\"{{ $json.clean_prompt }}\"}",
        "options": {
          "timeout": 120000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        1560,
        280
      ],
      "id": "71054e58-f26f-451b-9e58-78d1911bb10f",
      "name": "Riffusion HuggingFace",
      "notes": "HUGGINGFACE_TOKEN: huggingface.co/settings/tokens"
    },
    {
      "parameters": {
        "resume": "timeInterval",
        "unit": "seconds",
        "amount": 60
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1800,
        0
      ],
      "id": "ca9a4b30-0b0c-4a98-a1f1-543714f30e5a",
      "name": "Uretim Bekleme 60sn",
      "notes": "Sarki uretimi 30-120sn surer. 60sn bekler."
    },
    {
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "1299afdd-14aa-4802-846a-680cbf0187af",
              "name": "audio_url",
              "value": "={{ $json.audio_url ?? $json.output ?? $json.url ?? $json.audio ?? '' }}",
              "type": "string"
            },
            {
              "id": "419209c2-3d04-435d-8e3b-2c364911b100",
              "name": "clean_prompt",
              "value": "={{ $('Prompt Temizle').item.json.clean_prompt }}",
              "type": "string"
            },
            {
              "id": "f44fe4a1-a167-46f9-a8a0-b615da0ccfde",
              "name": "task_id",
              "value": "={{ $('Prompt Temizle').item.json.task_id }}",
              "type": "string"
            },
            {
              "id": "f0a5591d-fe44-47ab-bdcb-fd3f61e0091b",
              "name": "genre",
              "value": "={{ $('Prompt Temizle').item.json.genre }}",
              "type": "string"
            },
            {
              "id": "c267bc10-57ca-4ba1-b7fc-989a6059e8f2",
              "name": "sub_genre",
              "value": "={{ $('Prompt Temizle').item.json.sub_genre }}",
              "type": "string"
            },
            {
              "id": "cdfa8201-7c51-44d3-b9d4-7900e1ee6984",
              "name": "sector",
              "value": "={{ $('Prompt Temizle').item.json.sector }}",
              "type": "string"
            },
            {
              "id": "a30610f2-99c1-4fab-80ad-0314c18539a8",
              "name": "mood",
              "value": "={{ $('Prompt Temizle').item.json.mood }}",
              "type": "string"
            },
            {
              "id": "57872290-90a4-4511-af06-2dbe7ff10f98",
              "name": "vocal",
              "value": "={{ $('Prompt Temizle').item.json.vocal }}",
              "type": "string"
            },
            {
              "id": "f24441b3-4d1b-4df1-a4a1-a3bb59d53b0c",
              "name": "language",
              "value": "={{ $('Prompt Temizle').item.json.language }}",
              "type": "string"
            },
            {
              "id": "302ba512-48f0-469f-b97d-e80f44c14736",
              "name": "ai_tool",
              "value": "={{ $('Prompt Temizle').item.json.ai_tool }}",
              "type": "string"
            },
            {
              "id": "246e8c24-635a-47ea-83fa-44c9d68936cf",
              "name": "prompt_id",
              "value": "={{ $('Prompt Temizle').item.json.prompt_id }}",
              "type": "string"
            },
            {
              "id": "4da882de-bbb2-487c-be5a-58b1d50018e2",
              "name": "tier",
              "value": "={{ $('Prompt Temizle').item.json.tier }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2020,
        0
      ],
      "id": "d5c5e779-7755-4676-ad5d-fc0873d6ebf8",
      "name": "Ses URL Hazirla",
      "notes": "Farkli AI araclari farkli URL alanlari dondurur. Hepsini audio_url alaninda toplar."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://localhost:8000/quality-check",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"audio_url\":\"{{ $json.audio_url }}\",\"task_id\":\"{{ $json.task_id }}\",\"genre\":\"{{ $json.genre }}\",\"target_lufs\":-14,\"min_duration\":90,\"max_duration\":250}",
        "options": {
          "timeout": 60000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        2240,
        0
      ],
      "id": "1cf742bf-fd5c-4ab3-a2c3-bd3f5dc66b63",
      "name": "Kalite Kontrol",
      "notes": "Kalite kontrol servisi. Kurulana kadar URL'yi https://httpbin.org/post yap \u2014 her sarki gecilir."
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "51c30961-5fbb-41ef-829a-2cb68288d8c6",
              "leftValue": "={{ $json.quality_score ?? 100 }}",
              "rightValue": 60,
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        2460,
        0
      ],
      "id": "f05af548-9e5a-4bef-b26a-ddf4e8f00ecc",
      "name": "Kalite 60 Ustu Mu",
      "notes": "60+ ise kabul (TRUE), altindaysa red (FALSE). Servis yoksa ?? 100 ile her zaman gecilir."
    },
    {
      "parameters": {
        "method": "PATCH",
        "url": "={{ $vars.ADMIN_PANEL_URL }}/api/tasks/{{ $('Ses URL Hazirla').item.json.task_id }}/status",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.ADMIN_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"status\":\"qc_fail\",\"notes\":\"QC Fail: {{ $now.format('DD/MM/YYYY HH:mm') }}\"}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        2680,
        160
      ],
      "id": "fbd341cc-a817-409a-ae78-6c171e641dda",
      "name": "Kalite Basarisiz Kaydet",
      "notes": "Kalite ge\u00e7emeyen gorevi qc_fail olarak isaretler."
    },
    {
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "738a1f8c-4f1c-4d98-901a-27fbacef28f9",
              "name": "song_id",
              "value": "={{ $('Ses URL Hazirla').item.json.task_id }}",
              "type": "string"
            },
            {
              "id": "4231241f-e742-496b-9b3c-3d7994f82622",
              "name": "genre",
              "value": "={{ $('Ses URL Hazirla').item.json.genre }}",
              "type": "string"
            },
            {
              "id": "da1381dd-5667-476e-bdf7-87be962444b9",
              "name": "sub_genre",
              "value": "={{ $('Ses URL Hazirla').item.json.sub_genre }}",
              "type": "string"
            },
            {
              "id": "8d2e18d4-cc85-4e66-908b-50cc5c77b593",
              "name": "sector",
              "value": "={{ $('Ses URL Hazirla').item.json.sector }}",
              "type": "string"
            },
            {
              "id": "40f567d5-1035-4135-a1d5-af6ca8fc9efa",
              "name": "mood",
              "value": "={{ $('Ses URL Hazirla').item.json.mood }}",
              "type": "string"
            },
            {
              "id": "6a04db8d-8cb6-4b6b-9714-db7cfc6f605d",
              "name": "vocal",
              "value": "={{ $('Ses URL Hazirla').item.json.vocal }}",
              "type": "string"
            },
            {
              "id": "25b0fdb2-9a6b-4e72-ab4b-1d422ebf1b82",
              "name": "language",
              "value": "={{ $('Ses URL Hazirla').item.json.language }}",
              "type": "string"
            },
            {
              "id": "6946324d-51c9-4951-b5a8-5a0e3c9725d3",
              "name": "ai_tool",
              "value": "={{ $('Ses URL Hazirla').item.json.ai_tool }}",
              "type": "string"
            },
            {
              "id": "9fd33fe5-c71a-4580-a4d8-988c04d6c22c",
              "name": "prompt_id",
              "value": "={{ $('Ses URL Hazirla').item.json.prompt_id }}",
              "type": "string"
            },
            {
              "id": "2b404cd7-7d4c-4d0a-9380-7435e6689b08",
              "name": "ai_prompt",
              "value": "={{ $('Ses URL Hazirla').item.json.clean_prompt }}",
              "type": "string"
            },
            {
              "id": "420154b3-b5a6-4e59-8670-9e8cdc37262e",
              "name": "quality_score",
              "value": "={{ $json.quality_score ?? 100 }}",
              "type": "number"
            },
            {
              "id": "f788fef8-d8de-4324-9b60-45862414ac2b",
              "name": "audio_url",
              "value": "={{ $('Ses URL Hazirla').item.json.audio_url }}",
              "type": "string"
            },
            {
              "id": "d9d0ed60-8264-47ac-838e-28083c8cc739",
              "name": "license_type",
              "value": "commercial",
              "type": "string"
            },
            {
              "id": "576b35d7-946d-42de-b610-e46e81d875ab",
              "name": "explicit",
              "value": false,
              "type": "boolean"
            },
            {
              "id": "c59dc3ce-fb84-427d-b0ea-8d9140c0a4d6",
              "name": "version",
              "value": "original",
              "type": "string"
            },
            {
              "id": "b5471291-cc5a-4d7a-bfd2-d57416733ed6",
              "name": "status",
              "value": "qc_pass",
              "type": "string"
            },
            {
              "id": "c9705f0c-7407-41d1-b0ee-0e69634d0330",
              "name": "generation_datetime",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            },
            {
              "id": "d3b64148-b6df-4003-b719-b1abb9b254db",
              "name": "task_id",
              "value": "={{ $('Ses URL Hazirla').item.json.task_id }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2680,
        -80
      ],
      "id": "4cee1453-10df-4145-8e16-bf4f1ba93287",
      "name": "Metadata Olustur",
      "notes": "Sarki icin tam metadata paketini olusturur."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $vars.ADMIN_PANEL_URL }}/api/tracks/upload",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.ADMIN_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"song_id\":\"{{ $json.song_id }}\",\"genre\":\"{{ $json.genre }}\",\"sub_genre\":\"{{ $json.sub_genre }}\",\"sector\":\"{{ $json.sector }}\",\"mood\":\"{{ $json.mood }}\",\"vocal\":\"{{ $json.vocal }}\",\"language\":\"{{ $json.language }}\",\"ai_tool\":\"{{ $json.ai_tool }}\",\"ai_prompt\":\"{{ $json.ai_prompt }}\",\"prompt_id\":\"{{ $json.prompt_id }}\",\"quality_score\":{{ $json.quality_score }},\"audio_url\":\"{{ $json.audio_url }}\",\"license_type\":\"commercial\",\"explicit\":false,\"version\":\"original\",\"status\":\"published\",\"generation_datetime\":\"{{ $json.generation_datetime }}\"}",
        "options": {
          "timeout": 30000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        2900,
        -80
      ],
      "id": "d9d6526f-ccff-4152-a124-c9467f5dda46",
      "name": "Admin Panele Yukle",
      "notes": "Sarkiyi ve metadatayi platformuna yukler."
    },
    {
      "parameters": {
        "method": "PATCH",
        "url": "={{ $vars.ADMIN_PANEL_URL }}/api/tasks/{{ $('Metadata Olustur').item.json.task_id }}/status",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.ADMIN_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"status\":\"done\",\"notes\":\"Yuklendi: {{ $now.format('DD/MM/YYYY HH:mm') }}\"}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        3120,
        -160
      ],
      "id": "af6739e7-d4ee-45df-8287-3fb52c7eebfe",
      "name": "Gorev Done Yap",
      "notes": "Gorevi done olarak isaretler. Ayni gorev tekrar islenmez."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $vars.ADMIN_PANEL_URL }}/api/prompt-log",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.ADMIN_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "={\"prompt_id\":\"{{ $('Metadata Olustur').item.json.prompt_id }}\",\"song_id\":\"{{ $('Metadata Olustur').item.json.song_id }}\",\"genre\":\"{{ $('Metadata Olustur').item.json.genre }}\",\"ai_tool\":\"{{ $('Metadata Olustur').item.json.ai_tool }}\",\"prompt_text\":\"{{ $('Metadata Olustur').item.json.ai_prompt }}\",\"quality_score\":{{ $('Metadata Olustur').item.json.quality_score }},\"created_at\":\"{{ $now.toISO() }}\"}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        3120,
        0
      ],
      "id": "05792944-1ed4-4992-9f79-7dab51ab79ac",
      "name": "Prompt Log Kaydet",
      "notes": "Kullanilan promptu log'a kaydeder. Sistem kendini bu veriyle ogrenir."
    },
    {
      "parameters": {
        "resume": "timeInterval",
        "unit": "seconds",
        "amount": 45
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        3340,
        0
      ],
      "id": "8dd03b58-fc37-4a63-9e4a-e48efe108137",
      "name": "Rate Limit 45sn",
      "notes": "API ban korumas\u0131: 45sn bekle. Cok hizli istek = hesap bloke."
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        3560,
        0
      ],
      "id": "8c10947b-63aa-4c47-b96c-7112b9a3fe73",
      "name": "Sonraki Sarki",
      "notes": "Dongude bir sonraki goreve gecer."
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 17 * * 1-5"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        500
      ],
      "id": "403b303b-f5d9-4a2e-9078-7590ed698ecc",
      "name": "Gunluk Rapor 17:00",
      "notes": "Her gun 17:00da gunluk rapor gonderir."
    },
    {
      "parameters": {
        "method": "GET",
        "url": "={{ $vars.ADMIN_PANEL_URL }}/api/tasks/stats",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $vars.ADMIN_API_KEY }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        220,
        500
      ],
      "id": "6f45145b-c19a-409f-9dec-edda69d2c763",
      "name": "Gunluk Istatistik Al",
      "notes": "Admin panelinden istatistikleri ceker."
    },
    {
      "parameters": {
        "language": "javaScript",
        "jsCode": "const d=$input.first().json;\nconst done=d.done_count||0,pending=d.pending_count||0,failed=d.qc_fail_count||0;\nconst total=done+pending+failed,rate=total>0?Math.round(done/total*100):0;\nreturn [{json:{done,pending,failed,total,rate,today:new Date().toLocaleDateString('tr-TR')}}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        500
      ],
      "id": "4cc2f2a8-93f1-4360-92e7-f82d7c4e6005",
      "name": "Istatistikleri Hesapla",
      "notes": "Istatistikleri hesaplar."
    },
    {
      "parameters": {
        "sendTo": "={{ $vars.SENIN_EMAILIN }}",
        "subject": "=Muzik Raporu {{ $json.today }}",
        "emailType": "text",
        "message": "=Tamamlanan: {{ $json.done }}\nBekleyen: {{ $json.pending }}\nBasarisiz: {{ $json.failed }}\nOran: %{{ $json.rate }}"
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        660,
        500
      ],
      "id": "36e06a3e-c688-4ce0-b542-a7d02c79d5cb",
      "name": "Gunluk Rapor Emaili",
      "notes": "Gunluk ozet maili gonderir.",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        0,
        900
      ],
      "id": "e44569f1-c81c-497c-bdd7-1f1d66c619c1",
      "name": "Hata Yakalayici",
      "notes": "Herhangi bir dugumde hata olursa devreye girer ve bildirim gonderir."
    },
    {
      "parameters": {
        "sendTo": "={{ $vars.SENIN_EMAILIN }}",
        "subject": "=Hata: {{ $json.error.message }}",
        "emailType": "text",
        "message": "=Hata: {{ $json.error.message }}\nDugum: {{ $json.error.node.name }}\nZaman: {{ $now.format('DD/MM/YYYY HH:mm') }}"
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        220,
        900
      ],
      "id": "2169de13-a0d2-44ae-9d86-b0b199c0a06d",
      "name": "Hata Bildirimi",
      "notes": "Hata detayini email ile gonderir.",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Sabah 09:00 Basla": {
      "main": [
        [
          {
            "node": "Bekleyen Gorevleri Al",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bekleyen Gorevleri Al": {
      "main": [
        [
          {
            "node": "Gorev Var Mi",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gorev Var Mi": {
      "main": [
        [
          {
            "node": "Her Gorev Icin Dongu",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gorev Yok Bildirimi",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Her Gorev Icin Dongu": {
      "main": [
        [
          {
            "node": "Claude ile Prompt Yaz",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude ile Prompt Yaz": {
      "main": [
        [
          {
            "node": "Prompt Temizle",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prompt Temizle": {
      "main": [
        [
          {
            "node": "AI Arac Secici",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Arac Secici": {
      "main": [
        [
          {
            "node": "Suno API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "MusicGen Replicate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Stable Audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Replicate Genel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Riffusion HuggingFace",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Suno API": {
      "main": [
        [
          {
            "node": "Uretim Bekleme 60sn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MusicGen Replicate": {
      "main": [
        [
          {
            "node": "Uretim Bekleme 60sn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stable Audio": {
      "main": [
        [
          {
            "node": "Uretim Bekleme 60sn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Replicate Genel": {
      "main": [
        [
          {
            "node": "Uretim Bekleme 60sn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Riffusion HuggingFace": {
      "main": [
        [
          {
            "node": "Uretim Bekleme 60sn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Uretim Bekleme 60sn": {
      "main": [
        [
          {
            "node": "Ses URL Hazirla",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ses URL Hazirla": {
      "main": [
        [
          {
            "node": "Kalite Kontrol",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Kalite Kontrol": {
      "main": [
        [
          {
            "node": "Kalite 60 Ustu Mu",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Kalite 60 Ustu Mu": {
      "main": [
        [
          {
            "node": "Metadata Olustur",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Kalite Basarisiz Kaydet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Metadata Olustur": {
      "main": [
        [
          {
            "node": "Admin Panele Yukle",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Admin Panele Yukle": {
      "main": [
        [
          {
            "node": "Gorev Done Yap",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gorev Done Yap": {
      "main": [
        [
          {
            "node": "Prompt Log Kaydet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prompt Log Kaydet": {
      "main": [
        [
          {
            "node": "Rate Limit 45sn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rate Limit 45sn": {
      "main": [
        [
          {
            "node": "Sonraki Sarki",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sonraki Sarki": {
      "main": [
        [
          {
            "node": "Her Gorev Icin Dongu",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gunluk Rapor 17:00": {
      "main": [
        [
          {
            "node": "Gunluk Istatistik Al",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gunluk Istatistik Al": {
      "main": [
        [
          {
            "node": "Istatistikleri Hesapla",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Istatistikleri Hesapla": {
      "main": [
        [
          {
            "node": "Gunluk Rapor Emaili",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hata Yakalayici": {
      "main": [
        [
          {
            "node": "Hata Bildirimi",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "494d3fe2-4979-4fca-a499-486ce2870bbe",
  "id": "",
  "tags": []
}