{
  "$schema": "./.schemas/page.schema.json",
  "title": "Calendar",
  "icon": "calendar",
  "sources": {
    "calendar": {
      "kind": "calendar",
      "window": "month",
      "every": "5m"
    }
  },
  "cards": [
    {
      "id": "up",
      "type": "countdown",
      "label": "Next up",
      "at": "2026-01-01T00:00:00Z",
      "source": {
        "ref": "calendar",
        "map": {
          "label": "up.title",
          "at": "up.at",
          "detail": "up.detail"
        },
        "empty": {
          "when": {
            "path": "has_up",
            "equals": false
          },
          "text": "No timed events coming up"
        }
      },
      "actions": [
        {
          "kind": "open",
          "label": "Join",
          "icon": "video.fill",
          "url": "{up.join}",
          "prominent": true,
          "when": {
            "path": "up.has_join",
            "equals": true
          }
        }
      ]
    },
    {
      "id": "month",
      "type": "month",
      "days": 7,
      "hide_empty_days": true,
      "max_events": 7,
      "items": [],
      "source": {
        "ref": "calendar",
        "map": {
          "items": {
            "each": "agenda",
            "limit": 300,
            "fields": {
              "title": "title",
              "start": {
                "if": {
                  "path": "all_day",
                  "equals": true
                },
                "then": "start_date",
                "else": "start"
              },
              "end": {
                "if": {
                  "path": "all_day",
                  "equals": true
                },
                "then": "end_date",
                "else": "end"
              },
              "detail": "location",
              "url": "join",
              "color": "color"
            }
          }
        }
      },
      "actions": [
        {
          "kind": "add-event",
          "label": "New Event",
          "icon": "calendar.badge.plus"
        }
      ],
      "actions_placement": "corner"
    }
  ]
}
