{
  "key": "timecampus-focus-dropped",
  "name": "Focus dropped: post to Slack and block an hour",
  "description": "When your TimeCampus focus trigger fires (focus % dropped below its threshold), post a note to Slack and block the next hour on your Google Calendar for deep work.",
  "data": {
    "nodes": [
      {
        "id": "focus-dropped",
        "type": "internal:timecampus-event",
        "position": { "x": 0, "y": 0 },
        "data": {
          "label": "Focus dropped",
          "operation_name": "onTimeCampusEvent",
          "args": {
            "state": {
              "timeCampusEvent": "timecampus.trigger.fired",
              "triggerIds": "",
              "metrics": "FOCUS_PERCENT",
              "comparators": "BELOW",
              "milestones": ""
            }
          },
          "nodeData": { "nodeType": "internal:timecampus-event", "kind": ["trigger"] }
        }
      },
      {
        "id": "post-to-slack",
        "type": "store/slack",
        "position": { "x": 300, "y": -80 },
        "data": {
          "label": "Post to Slack",
          "operation_name": "sendMessage",
          "version": "1.0.0",
          "args": {
            "state": {
              "channelId": "REPLACE_WITH_YOUR_CHANNEL_ID",
              "messageType": "text",
              "text": "Focus is at {{ $json.value }}% today (threshold {{ $json.threshold }}%). Blocking the next hour for deep work."
            }
          },
          "nodeData": { "nodeType": "store/slack", "version": "1.0.0" }
        }
      },
      {
        "id": "block-an-hour",
        "type": "store/google_calendar",
        "position": { "x": 300, "y": 80 },
        "data": {
          "label": "Block an hour",
          "operation_name": "createEvent",
          "version": "1.0.0",
          "args": {
            "state": {
              "calendarId": "primary",
              "summary": "Focus block",
              "description": "Booked by FluidGrids because TimeCampus saw focus drop to {{ $json.value }}% on {{ $json.day }}.",
              "startDateTime": "{{ $now.plus({ minutes: 5 }).startOf('minute').toISO() }}",
              "endDateTime": "{{ $now.plus({ minutes: 65 }).startOf('minute').toISO() }}",
              "timeZone": "UTC",
              "sendNotifications": false
            }
          },
          "nodeData": { "nodeType": "store/google_calendar", "version": "1.0.0" }
        }
      }
    ],
    "edges": [
      { "id": "focus-dropped-post-to-slack", "source": "focus-dropped", "target": "post-to-slack" },
      { "id": "focus-dropped-block-an-hour", "source": "focus-dropped", "target": "block-an-hour" }
    ]
  }
}
