{
  "name": "ACF Post Video MVP",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "acf-post-video",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "acf-webhook",
      "name": "POST /webhook/acf-post-video",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [0, 0],
      "webhookId": "acf-post-video"
    },
    {
      "parameters": {
        "jsCode": "const headers = $json.headers || {};\nconst body = $json.body || $json;\nconst expected = $env.ACF_POST_TOKEN;\nconst provided = headers['x-acf-token'] || headers['X-ACF-Token'];\nif (!expected || provided !== expected) {\n  return [{ json: { status: 'failed', error: 'invalid_token' } }];\n}\nif (!body.video_path && !body.video_url) {\n  return [{ json: { status: 'failed', error: 'missing_video_path_or_video_url' } }];\n}\nif ((body.platform || 'youtube_shorts') !== 'youtube_shorts') {\n  return [{ json: { status: 'failed', error: 'unsupported_platform', platform: body.platform } }];\n}\nif (!$env.YOUTUBE_OAUTH_READY) {\n  return [{ json: { status: 'missing_credentials', missing: 'youtube_oauth', platform: 'youtube_shorts' } }];\n}\nreturn [{ json: { ...body, status: 'ready_to_post', platform: 'youtube_shorts' } }];"
      },
      "id": "validate-token-and-payload",
      "name": "Validate token and payload",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [260, 0]
    },
    {
      "parameters": {
        "jsCode": "if ($json.status !== 'ready_to_post') {\n  return [{ json: $json }];\n}\nreturn [{ json: { status: 'posted', post_url: 'https://youtube.com/shorts/REPLACE_AFTER_YOUTUBE_NODE', platform: 'youtube_shorts', platform_post_id: 'REPLACE_AFTER_YOUTUBE_NODE' } }];"
      },
      "id": "youtube-shorts-placeholder",
      "name": "YouTube Shorts upload placeholder",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [520, 0]
    }
  ],
  "connections": {
    "POST /webhook/acf-post-video": {
      "main": [[{ "node": "Validate token and payload", "type": "main", "index": 0 }]]
    },
    "Validate token and payload": {
      "main": [[{ "node": "YouTube Shorts upload placeholder", "type": "main", "index": 0 }]]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
