{
  "name": "acs-daily-revenue-report",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 0 0 * * *"
            }
          ]
        }
      },
      "id": "trigger-daily-09jst",
      "name": "\u6bce\u65e5 09:00 JST (=00:00 UTC)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{$env.ACS_API_BASE}}/api/kpi/revenue/daily",
        "options": {
          "timeout": 10000
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{$env.ACS_API_TOKEN}}"
            }
          ]
        }
      },
      "id": "fetch-daily-revenue",
      "name": "acs-platform \u304b\u3089\u65e5\u6b21\u53ce\u76ca\u53d6\u5f97",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const d = $json;\nconst total = d.total_jpy ?? 0;\nconst breakdown = d.breakdown ?? {};\nconst lines = Object.entries(breakdown).map(([k,v])=>`\u2022 ${k}: \u00a5${v.toLocaleString('ja-JP')}`).join('\\n');\nconst date = new Date().toISOString().slice(0,10);\nreturn [{ json: { date, total, lines, breakdown }}];"
      },
      "id": "format-message",
      "name": "Slack \u7528\u30d5\u30a9\u30fc\u30de\u30c3\u30c8",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        720,
        300
      ]
    },
    {
      "parameters": {
        "resource": "message",
        "select": "channel",
        "channelId": "={{$env.SLACK_CHANNEL_REVENUE_DAILY}}",
        "blocksUi": "={{ JSON.stringify([\n  {type:'header', text:{type:'plain_text', text:`\ud83d\udcb0 ${$json.date} acs-platform \u65e5\u6b21\u53ce\u76ca`}},\n  {type:'section', text:{type:'mrkdwn', text:`*\u5408\u8a08*: \u00a5${$json.total.toLocaleString('ja-JP')}`}},\n  {type:'section', text:{type:'mrkdwn', text: $json.lines || '_(\u5185\u8a33\u306a\u3057)_'}},\n  {type:'context', elements:[{type:'mrkdwn', text:'source: acs-platform /api/kpi/revenue/daily | n8n cron'}]}\n]) }}",
        "otherOptions": {}
      },
      "id": "post-to-slack",
      "name": "#ai-fukugyo-revenue-daily \u306b\u6295\u7a3f",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        960,
        300
      ]
    }
  ],
  "connections": {
    "\u6bce\u65e5 09:00 JST (=00:00 UTC)": {
      "main": [
        [
          {
            "node": "acs-platform \u304b\u3089\u65e5\u6b21\u53ce\u76ca\u53d6\u5f97",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "acs-platform \u304b\u3089\u65e5\u6b21\u53ce\u76ca\u53d6\u5f97": {
      "main": [
        [
          {
            "node": "Slack \u7528\u30d5\u30a9\u30fc\u30de\u30c3\u30c8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack \u7528\u30d5\u30a9\u30fc\u30de\u30c3\u30c8": {
      "main": [
        [
          {
            "node": "#ai-fukugyo-revenue-daily \u306b\u6295\u7a3f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "timezone": "Asia/Tokyo"
  },
  "_meta": {
    "project": "acs-platform",
    "version": "v0.1",
    "note": "AI_Fukugyo Slack\u57fa\u76e4 Phase 1 (v7.38.0)\u3002/proj-acs \u5c02\u7528 Bot \u3068\u306f\u5225\u7d4c\u8def\u3067 n8n \u304c cron \u6295\u7a3f\u3002\u6708\u6b21\u7248\u306f\u5225\u30ef\u30fc\u30af\u30d5\u30ed\u30fc (acs-monthly-revenue-report) \u3068\u3057\u3066\u8907\u88fd\u4e88\u5b9a\u3002"
  }
}