{
  "name": "Vorlux AI | VTuber Scene Manager",
  "active": false,
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "vtuber-scene",
        "options": { "responseMode": "lastNode" }
      },
      "id": "webhook-trigger",
      "name": "Scene Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [220, 300]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const data = $input.first().json.body || $input.first().json;\nconst sceneType = data.scene || data.sceneType || 'default';\nconst characters = data.characters || ['myla'];\n\nconst sceneConfigs = {\n  intro: { obsScene: 'Intro', layout: 'center', bgMusic: 'intro_theme', duration: 15 },\n  chat: { obsScene: 'Just Chatting', layout: 'side-by-side', bgMusic: 'chill_lo-fi', duration: null },\n  gaming: { obsScene: 'Gaming', layout: 'corner', bgMusic: null, duration: null },\n  brb: { obsScene: 'BRB', layout: 'center', bgMusic: 'elevator_music', duration: 300 },\n  outro: { obsScene: 'Outro', layout: 'center', bgMusic: 'outro_theme', duration: 20 },\n  podcast: { obsScene: 'Podcast', layout: 'split-screen', bgMusic: 'soft_ambient', duration: null },\n  default: { obsScene: 'Main', layout: 'default', bgMusic: null, duration: null }\n};\n\nconst config = sceneConfigs[sceneType] || sceneConfigs.default;\nreturn [{ json: { sceneType, config, characters, timestamp: new Date().toISOString() } }];"
      },
      "id": "resolve-scene",
      "name": "Resolve Scene Config",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [460, 300]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3010/api/integrations/obs/scenes",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ scene: $json.config.obsScene }) }}",
        "options": { "timeout": 10000 }
      },
      "id": "switch-obs-scene",
      "name": "Switch OBS Scene",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [700, 200]
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:3010/api/animations/control",
        "method": "POST",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ characters: $json.characters, layout: $json.config.layout, scene: $json.sceneType }) }}",
        "options": { "timeout": 10000 }
      },
      "id": "position-vtubers",
      "name": "Position VTuber Models",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [700, 400]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const scene = $('Resolve Scene Config').first().json;\nreturn [{ json: { success: true, scene: scene.sceneType, obsScene: scene.config.obsScene, characters: scene.characters } }];"
      },
      "id": "response",
      "name": "Build Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [960, 300]
    }
  ],
  "connections": {
    "Scene Webhook": { "main": [[{ "node": "Resolve Scene Config", "type": "main", "index": 0 }]] },
    "Resolve Scene Config": { "main": [[{ "node": "Switch OBS Scene", "type": "main", "index": 0 }, { "node": "Position VTuber Models", "type": "main", "index": 0 }]] },
    "Switch OBS Scene": { "main": [[{ "node": "Build Response", "type": "main", "index": 0 }]] },
    "Position VTuber Models": { "main": [[{ "node": "Build Response", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" }
}
