{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Legato local page",
  "description": "A local page for Legato on macOS. Define each API once under sources, then use ref and map on cards. This schema is self-contained and works offline. The Mac also checks source references, duplicate IDs, the 120-card ceiling counting cards in tabs, JSON paths, and the final mapped card values.",
  "$comment": "Generated by mac/scripts/build-local-page-schema.mjs from mac/scripts/card-catalog.json plus the source contract. Run that script after catalog changes. JSON Schema cannot execute mappings, verify live API responses, require distinct card IDs, compare gauge bounds, or check ref names against sibling source keys. Use the Mac preview to check parsed configuration and mapped data; verify API-specific meaning and cross-field numeric relationships separately.",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "Editor schema location. In the Legato Pages folder, use ./.schemas/page.schema.json (./.schemas/local-page.schema.json also works)."
    },
    "schema_version": {
      "const": 1,
      "default": 1
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60,
      "description": "The page’s name: in the sidebar, Settings, Spotlight and to agents. With title_from, the panel’s title row shows a name from a source instead, and this is the fallback."
    },
    "title_from": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "ref",
        "value"
      ],
      "description": "Optional. A name for the panel’s title row from a source’s answer, such as the item a page with params shows. value is a rule read against the named source’s answer, like a card’s map. Until it answers, and whenever the rule gives nothing (a template missing any of its values included), the title shows. One line of plain text, cut to 60 characters with “…”. The Back trail and notifications use it too; the sidebar, Settings, Spotlight, legato list and list_pages keep title. On a page with a period, the source is read for the default choice. Not a dataset source.",
      "properties": {
        "ref": {
          "type": "string",
          "pattern": "^[a-z0-9_-]+$",
          "description": "The name of a source in this page’s sources object."
        },
        "value": {
          "$ref": "#/definitions/rule"
        }
      },
      "examples": [
        {
          "ref": "kuma",
          "value": {
            "first": "monitor_name",
            "of": "monitors",
            "where": {
              "path": "monitor_id",
              "equals": "{param.id}"
            }
          }
        }
      ]
    },
    "icon": {
      "type": "string",
      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}|(?:(?:si|di|mdi):)?\\{param\\.[a-z][a-z0-9_]*\\})$",
      "maxLength": 64,
      "description": "An SF Symbol name, or a logo (si:, di:, mdi:, site:). A page with params can take it from one: {param.icon}, or si:{param.brand}."
    },
    "notify": {
      "type": "object",
      "description": "Optional, Legato Pro. A macOS notification from this page, shown once per id: change the id to notify again. Status changes notify on their own; use this for messages of your own. Skipped when the file was last changed more than 24 hours ago.",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
          "description": "Names this notification, e.g. \"deploy-142\". Up to 64 letters, digits, ., _, : and -, starting with a letter or digit."
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 60,
          "description": "Optional. Shown under the page's name."
        },
        "body": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "required": [
        "id",
        "body"
      ],
      "additionalProperties": false
    },
    "sources": {
      "type": "object",
      "propertyNames": {
        "pattern": "^[a-z0-9_-]+$"
      },
      "additionalProperties": {
        "$ref": "#/definitions/source"
      },
      "description": "Named shared sources. Names use lowercase letters, digits, underscores or hyphens."
    },
    "cards": {
      "type": "array",
      "minItems": 1,
      "maxItems": 24,
      "items": {
        "$ref": "#/definitions/card"
      }
    },
    "period": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "choices"
      ],
      "description": "Optional. A row under the page’s title for choosing the span of time its cards show, such as Week, Month and Year. A card follows it when its source asks for {period.start}, {period.end}, {period.start_at} or {period.end_at}; status, gauge and fleet cards stay on the first choice, the default, as it is now, so looking at another period never changes the page’s light or notifications. Each Mac remembers its choice.",
      "if": {
        "properties": {
          "step": {
            "const": true
          }
        },
        "required": [
          "step"
        ]
      },
      "then": {
        "properties": {
          "choices": {
            "minItems": 1
          }
        },
        "anyOf": [
          {
            "properties": {
              "choices": {
                "contains": {
                  "required": [
                    "span"
                  ]
                }
              }
            }
          },
          {
            "properties": {
              "choices": {
                "contains": {
                  "required": [
                    "last_hours"
                  ]
                }
              }
            }
          }
        ]
      },
      "else": {
        "properties": {
          "choices": {
            "minItems": 2
          },
          "future": {
            "const": false
          }
        }
      },
      "properties": {
        "step": {
          "type": "boolean",
          "default": false,
          "description": "true adds arrows at the ends of the period capsule that step a calendar choice (span) back, and a calendar in it to pick any day, week, month or year: up to a year of days, or 59 weeks, months or years, with a way back to now. A window of hours (last_hours) steps back that many hours at a time, and one of 24 takes the calendar too. A page that steps can have a single choice. Rolling days (last_days) don’t step."
        },
        "compare": {
          "const": "previous",
          "description": "Adds {compare.start}, {compare.end}, {compare.start_at} and {compare.end_at}: the stretch before the period, like for like. While a span is still going, as many days of the one before (Sep 1–21 against Oct 1–21); a whole span, the whole one before; the last N days, the N days before them. A card’s own text can say {period.dates} and {compare.dates}, like “8% less than {compare.dates}”."
        },
        "future": {
          "type": "boolean",
          "default": false,
          "description": "With step, the arrows and the calendar also go forward as far: for a page about plans or forecasts."
        },
        "marks": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "ref",
            "value"
          ],
          "description": "Dots on the calendar’s days: ref names one of the page’s sources, and value is a rule giving rows of { at, value }, at as Unix seconds, an ISO 8601 moment or a YYYY-MM-DD day, value a number (1 without). A day with a bigger total gets a bigger dot. The source can’t use {period.…}: the calendar shows months outside the period, so it reads a window of its own.",
          "properties": {
            "ref": {
              "type": "string",
              "minLength": 1
            },
            "value": {}
          }
        },
        "choices": {
          "type": "array",
          "minItems": 1,
          "maxItems": 6,
          "description": "The choices, in order; the first is the default. They show as pills at the top of the period capsule’s calendar. Two at least, or one with step.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "label"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "What the row shows, like “Month” or “Last 30 days”."
              },
              "span": {
                "enum": [
                  "day",
                  "week",
                  "month",
                  "year"
                ],
                "description": "This calendar day, week, month or year. Weeks start on the Mac’s first day of the week."
              },
              "last_days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 3660,
                "description": "Today and the days before it: 30 is today and the 29 days before."
              },
              "last_hours": {
                "type": "integer",
                "minimum": 1,
                "maximum": 168,
                "description": "The last N whole hours, this one included: 24 is a day that ends with the current hour, so a chart of its hours is always full and its last column is Now. {period.start_at} and {period.end_at} are the hours it starts and ends on."
              },
              "values": {
                "type": "object",
                "minProperties": 1,
                "maxProperties": 4,
                "propertyNames": {
                  "pattern": "^[a-z][a-z0-9_]{0,31}$",
                  "not": {
                    "enum": [
                      "start",
                      "end",
                      "start_at",
                      "end_at",
                      "through",
                      "through_at",
                      "start_unix",
                      "end_unix",
                      "through_unix",
                      "id",
                      "dates"
                    ]
                  }
                },
                "additionalProperties": {
                  "type": "string",
                  "pattern": "^(?!\\.{1,2}$)[A-Za-z0-9._~-]{1,64}$"
                },
                "description": "Short words this choice fills into the page's requests as {period.<name>}: { \"interval\": \"5m\" } for Today and { \"interval\": \"1h\" } for 30 days, read at /v1/isp-metrics/{period.interval}. Every choice names the same ones. Sources only, not card text."
              }
            },
            "oneOf": [
              {
                "required": [
                  "span"
                ]
              },
              {
                "required": [
                  "last_days"
                ]
              },
              {
                "required": [
                  "last_hours"
                ]
              }
            ]
          }
        }
      }
    },
    "params": {
      "type": "object",
      "minProperties": 1,
      "maxProperties": 4,
      "description": "One page for every item of a fleet: the values come from the link that opens it (legato://page/proxmox-vm?vmid=109), and {param.vmid} anywhere in the page becomes 109. A string or integer value is 1 to 64 letters, digits, . _ ~ and -, digits only for an integer, and must match the pattern when there is one. A string param with its own pattern may take 1 to 128 of those and : (a console id like 900A…:123), encoded as %3A in a URL and sent as written in a body. Opened without acceptable values, the page says it opens from a link. Such a page sets no light, posts no notification and offers no buttons to Spotlight or Shortcuts. Without defaults, give it \"sidebar\": false. With a default on every param, the default item behaves like a page without params and may stay in the sidebar.",
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9_]{0,31}$"
      },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "example"
        ],
        "allOf": [
          {
            "if": {
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "const": "text"
                }
              }
            },
            "then": {
              "properties": {
                "example": {
                  "minLength": 1,
                  "maxLength": 40,
                  "pattern": "^(?! )(?!.* $)(?!\\.{1,2}$)[\\p{L}\\p{M}\\p{Nd} .,'()&-]+$"
                },
                "default": {
                  "minLength": 1,
                  "maxLength": 40,
                  "pattern": "^(?! )(?!.* $)(?!\\.{1,2}$)[\\p{L}\\p{M}\\p{Nd} .,'()&-]+$"
                }
              }
            },
            "else": {
              "if": {
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "const": "query"
                  }
                }
              },
              "then": {
                "properties": {
                  "example": {
                    "pattern": "^(?!\\s)(?![\\s\\S]*\\s$)(?!\\.{1,2}$)[^{}\\p{Cc}\\u2028\\u2029\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069]{1,200}$"
                  },
                  "default": {
                    "pattern": "^(?!\\s)(?![\\s\\S]*\\s$)(?!\\.{1,2}$)[^{}\\p{Cc}\\u2028\\u2029\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069]{1,200}$"
                  }
                }
              },
              "else": {
                "if": {
                  "required": [
                    "pattern"
                  ],
                  "not": {
                    "anyOf": [
                      {
                        "required": [
                          "list_key"
                        ]
                      },
                      {
                        "required": [
                          "type"
                        ],
                        "properties": {
                          "type": {
                            "const": "integer"
                          }
                        }
                      }
                    ]
                  }
                },
                "then": {
                  "properties": {
                    "example": {
                      "pattern": "^(?!\\.{1,2}$)[A-Za-z0-9._~:-]{1,128}$"
                    },
                    "default": {
                      "pattern": "^(?!\\.{1,2}$)[A-Za-z0-9._~:-]{1,128}$"
                    }
                  }
                },
                "else": {
                  "properties": {
                    "example": {
                      "pattern": "^(?!\\.{1,2}$)[A-Za-z0-9._~-]{1,64}$"
                    },
                    "default": {
                      "pattern": "^(?:\\{period\\.(?:start|end|through)_unix\\}|(?!\\.{1,2}$)[A-Za-z0-9._~-]{1,64})$"
                    }
                  }
                }
              }
            }
          }
        ],
        "properties": {
          "type": {
            "enum": [
              "string",
              "integer",
              "text",
              "query"
            ],
            "default": "string",
            "description": "text: 1 to 40 trimmed characters, Unicode letters and digits, spaces and . , apostrophe - ( ) &. Encoded in request URLs. query: what someone typed to search for, 1 to 200 trimmed characters on one line, any but { }, control characters and bidi controls (tag:bills \"late fee\"); encoded in request URLs and filled as text elsewhere, for a page a search form opens. integer: digits only, and a string that is the token alone, such as a request body's \"{param.vmid}\", becomes the number."
          },
          "pattern": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "A regular expression the whole value must match, such as ^[0-9]{3}$."
          },
          "default": {
            "type": "string",
            "description": "The item to show without link values. Must pass the same type and pattern checks as a value. Give every param a default, or none. The default item keeps fetching, lighting and notifying while another item is open. On a page with a period, an integer param’s default can instead be the period’s end or start in Unix seconds, {period.end_unix} or {period.start_unix}: a link’s value then counts only while it falls inside the period shown, so stepping the period goes back to the default (Drives: the drive on the map follows the week). Such a param can only be used in sources."
          },
          "example": {
            "type": "string",
            "description": "A value the page is checked with when no link gives one: by legato set, --validate-page and the Source Preview window."
          },
          "selects": {
            "type": "boolean",
            "default": false,
            "description": "true when the value picks something on the page (a row of its list) rather than another item: while the page reads again for a new value, cards that don't read what it changes draw at once and the rest show their last shape in grey. Not with list_key."
          },
          "list_key": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
            "description": "The value is a host’s key on this list (a host-list source’s row key, h and 16 hex digits), for a page about one host: a source with hosts { list, only: \"{param.name}\" }. Link to it from a row with ?name={key}. No type, pattern or default."
          }
        }
      }
    },
    "look": {
      "enum": [
        "cards",
        "sheet"
      ],
      "description": "How the window draws a page without its own layout: cards, each card on its own surface, or sheet, one plain sheet in Things 3’s manner. Without it, a page that’s mostly lists (lists, checklists, agendas, timelines, tables) is a sheet and any other is cards. A layout’s own look wins."
    },
    "views": {
      "type": "array",
      "minItems": 2,
      "maxItems": 8,
      "description": "This page and its siblings shown as tabs under one title (Tesla: Overview, Drives, Charges), this page among them. Each view stays its own page (file, sources, layout, period, links); the sidebar shows this page alone, kept selected on any view, and the title row keeps this page’s name, icon and controls. Tabs show on sheet pages in the window.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "page",
          "label"
        ],
        "properties": {
          "page": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 24
          }
        }
      }
    },
    "sidebar_count": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
      "description": "The id of one of the page’s cards whose rows the sidebar counts beside the page’s name, as Things 3 counts a list: a list’s or checklist’s items, a table’s rows, an agenda’s or timeline’s items, a fleet’s items. Grey, in the page’s light colour while it lights, and not shown at 0 or while the card isn’t showing."
    },
    "layout": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "rows"
      ],
      "description": "Where the page’s cards sit in a wide window: rows of cells, each cell one card or a few stacked, each with a weight for its share of the row. The cards list stays the reading order, used when the window is too narrow for two cells side by side; a row whose cells can’t each have their least width (about 300 pt; a chart 420, a table 600) breaks into pairs, then one cell to a line. Every card drawn on the page is placed once (not cards in tabs or in Page Info, and a grid page has no headings). A card that isn’t showing leaves its cell, and the cells left share the row. Without layout, cards flow down columns.",
      "properties": {
        "type": {
          "const": "grid"
        },
        "max_width": {
          "type": "number",
          "minimum": 600,
          "maximum": 4000,
          "default": 1600,
          "description": "The widest the cards may be, in points; a wider window centres them."
        },
        "look": {
          "enum": [
            "cards",
            "sheet"
          ],
          "default": "cards",
          "description": "cards: each card on its own surface. sheet: one plain sheet with no card surfaces; the page’s name large at the top, each card’s name bold over a thin rule, money in with its + sign instead of green, red only for what’s over, more room between groups, and a list’s rows with buttons open where they are."
        },
        "rows": {
          "type": "array",
          "minItems": 1,
          "maxItems": 12,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "cells"
            ],
            "properties": {
              "cells": {
                "type": "array",
                "minItems": 1,
                "maxItems": 4,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "cards"
                  ],
                  "properties": {
                    "cards": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 6,
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                      },
                      "description": "Card ids, stacked in this order."
                    },
                    "weight": {
                      "type": "number",
                      "minimum": 1,
                      "maximum": 4,
                      "default": 1,
                      "description": "This cell’s share of the row: 2 beside 1 is two thirds."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "sidebar": {
      "type": "boolean",
      "default": true,
      "description": "false makes this a detail page: not listed in the sidebar, reached from another page’s card links (legato://page/ID), Spotlight and Shortcuts. It still fetches, notifies and lights the menu bar icon as any page does, and a link that leads to it shows “‹ Name” in the title row to go back."
    }
  },
  "required": [
    "title",
    "cards"
  ],
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "required": [
          "params"
        ]
      },
      "then": {
        "properties": {
          "sources": {
            "additionalProperties": {
              "not": {
                "required": [
                  "collect"
                ]
              }
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "period"
        ]
      },
      "then": {},
      "else": {
        "properties": {
          "cards": {
            "items": {
              "allOf": [
                {
                  "not": {
                    "anyOf": [
                      {
                        "required": [
                          "daily"
                        ]
                      },
                      {
                        "required": [
                          "periods"
                        ]
                      }
                    ]
                  }
                },
                {
                  "properties": {
                    "tabs": {
                      "items": {
                        "properties": {
                          "cards": {
                            "items": {
                              "not": {
                                "anyOf": [
                                  {
                                    "required": [
                                      "daily"
                                    ]
                                  },
                                  {
                                    "required": [
                                      "periods"
                                    ]
                                  }
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "period"
        ],
        "properties": {
          "period": {
            "required": [
              "compare"
            ],
            "properties": {
              "compare": {
                "const": "previous"
              }
            }
          }
        }
      },
      "then": {},
      "else": {
        "properties": {
          "cards": {
            "items": {
              "allOf": [
                {
                  "properties": {
                    "daily": {
                      "properties": {
                        "compare": {
                          "const": false
                        }
                      }
                    }
                  }
                },
                {
                  "properties": {
                    "tabs": {
                      "items": {
                        "properties": {
                          "cards": {
                            "items": {
                              "properties": {
                                "daily": {
                                  "properties": {
                                    "compare": {
                                      "const": false
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      }
    }
  ],
  "definitions": {
    "path": {
      "type": "string",
      "pattern": "^[ \\t]*(?:\\$|(?:[A-Za-z0-9_\\-\\u0080-\\uFFFF]+(?:\\[[0-9]+\\]|\\[\"[^\"\\\\{}|\\u0000-\\u001F]+\"\\])*|(?:\\[[0-9]+\\]|\\[\"[^\"\\\\{}|\\u0000-\\u001F]+\"\\])+)(?:\\.(?:[A-Za-z0-9_\\-\\u0080-\\uFFFF]+(?:\\[[0-9]+\\]|\\[\"[^\"\\\\{}|\\u0000-\\u001F]+\"\\])*|(?:\\[[0-9]+\\]|\\[\"[^\"\\\\{}|\\u0000-\\u001F]+\"\\])+))*)?[ \\t]*$",
      "description": "A dotted JSON path, optionally with array indices. A key with spaces or punctuation goes in quotes and brackets, like list[0][\"Resting HR\"]. Use $ or an empty path for the whole value.",
      "examples": [
        "stargazers_count",
        "summary.clients.active",
        "items[0].value",
        "list[0][\"Sleep (h)\"]",
        "$"
      ]
    },
    "fieldPath": {
      "type": "string",
      "pattern": "^(?:[A-Za-z0-9_\\-\\u0080-\\uFFFF]+(?:\\[[0-9]+\\])*|(?:\\[[0-9]+\\])+)(?:\\.(?:[A-Za-z0-9_\\-\\u0080-\\uFFFF]+(?:\\[[0-9]+\\])*|(?:\\[[0-9]+\\])+))*$",
      "description": "A card field or nested field to fill, such as value or items[0].value."
    },
    "template": {
      "type": "string",
      "pattern": "^(?:[^{}]|\\{[ \\t]*(?:\\$|(?:[A-Za-z0-9_\\-\\u0080-\\uFFFF]+(?:\\[[0-9]+\\]|\\[\"[^\"\\\\{}|\\u0000-\\u001F]+\"\\])*|(?:\\[[0-9]+\\]|\\[\"[^\"\\\\{}|\\u0000-\\u001F]+\"\\])+)(?:\\.(?:[A-Za-z0-9_\\-\\u0080-\\uFFFF]+(?:\\[[0-9]+\\]|\\[\"[^\"\\\\{}|\\u0000-\\u001F]+\"\\])*|(?:\\[[0-9]+\\]|\\[\"[^\"\\\\{}|\\u0000-\\u001F]+\"\\])+))*)[ \\t]*(?:\\|[ \\t]*(?:title|upper|lower|(?:duration|timecode)(?::(?:ticks|ms|s|min))?|pad:[1-4]|clip:(?:[1-9]|[1-9][0-9]|[1-4][0-9]{2}|500)|until|from_now|ago|in|month_year|month|date|day|weekday|compass|hour(?::plain)?|time|clock|clock_hour|first_word|rest_words|origin|host|file|raw|ceil|ms|bytes|plain|(?:round|percent)(?::[0-6])?)[ \\t]*)*(?:\\|[ \\t]*verbatim[ \\t]*)?\\})*$",
      "description": "Text with {path} placeholders. Within a source on a page with a period, {period.id} is replaced by the selected choice id before this template is read; it can select daily versus period cards without counting readings. Filters: title, upper, lower, duration (seconds as \"4m 59s\"; duration:ticks, duration:ms, duration:min read other units, a tick being 100 ns), timecode (a player’s clock, \"1:42:10\", \"42:05\", \"0:07\", rounded down; takes the same units), pad:1–4 (a whole number zero-padded: {IndexNumber|pad:2} is \"05\"; anything else unchanged), clip:1 to 500 (shorten text at a word boundary and append …), until, from_now (a number of seconds as the moment that far from now in ISO 8601 UTC, for a button’s request: {choice|from_now} is a silence’s end), in (a future moment as \"in 2h\"), ago (an ISO 8601 date or Unix seconds as \"2h ago\"), month (a date as \"Oct\"), month_year (a date as \"Nov 2026\"), date (a date as \"Oct 31\", for a chart’s columns by day), day (a date as \"Today\", \"Tomorrow\" or \"Sat, Oct 31\"), weekday (\"Today\", then \"Thu\"), hour (\"Now\", then \"11P\", \"1A\", with a zone for a repeated DST hour; hour:plain never says Now, for a chart whose last column is this hour), time (24-hour clock with seconds), clock (a moment’s time of day as this Mac shows it: \"6:12 PM\"), clock_hour (its hour: \"6 PM\"), first_word (the first whitespace-separated word), rest_words (all text after that word, trimmed), compass (degrees as \"N\", \"SE\" or \"NW\"), origin (an address cut to its scheme and host), raw (a number exactly as sent, with no thousands separators, for an id in a link), ceil (a number rounded up to a whole one, such as a query’s time with fractions of a second as the Unix second a link names), bytes (a count of bytes in the unit that suits it, 1,024 to the next: \"14.2 MB\", \"431 GB\", \"4.2 TB\"), plain (an HTML snippet as words, such as a search hit’s excerpt: tags dropped, entities decoded once, spaces and line breaks run together), verbatim (last: text exactly as sent where a card reads inline formatting, such as a list item’s text, so __init__ keeps its underscores and [x](…) stays words; each ASCII punctuation mark gets a backslash, which shows anywhere else), round[:0–6], percent[:0–6]. Dates for in, ago, month, month_year, date, day, weekday, clock and clock_hour can be Unix seconds (or milliseconds, as Tesla sends them), ISO 8601, a plain date or a date and time with no zone (2026-10-31 14:30:00), the last two read as this Mac’s time. Use {$} for a whole scalar. Braces must belong to placeholders.",
      "examples": [
        "{name}: {count}",
        "{ratio|percent:1}",
        "{seconds|duration}",
        "{published|ago}"
      ]
    },
    "headers": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "HTTP headers. Put credentials in Settings → Secrets, not here."
    },
    "relativeURL": {
      "type": "string",
      "pattern": "^/(?!/)(?!.*://)",
      "description": "An origin-relative path on the source’s scheme, host and port, optionally with a query. For example /api/summary?limit=5. A data request’s path can carry dates, filled in the Mac’s time zone each time it goes out: {date.today}, {date.yesterday}, {date.tomorrow}, {date.week_start}, {date.week_end}, {date.month_start}, {date.month_end}, {date.last_month_start}, {date.last_month_end}, {date.year_start}, {date.year_end}, {date.days_ago_7}, {date.days_ago_30}, {date.days_ago_90}, {date.days_ahead_7}, {date.days_ahead_30}, {date.now}. Days are YYYY-MM-DD; {date.days_ahead_N} supports 0 to 3660 calendar days ahead. {date.hours_ago_N_at} (N 1–720) is a moment so many hours back. Any day or moment with _unix after it, such as {date.month_start_unix}, {date.hours_ago_24_unix} or {date.now_unix}, is the same moment in Unix seconds, for services that take those. On a page with a period, {period.start} and {period.end} (days, the end included), {period.through} (the last day so far: today while the period is going) and {period.start_at}, {period.end_at} and {period.through_at} (moments with an offset, the end being the moment after; {period.start_unix}, {period.end_unix} and {period.through_unix} in Unix seconds) are the period chosen in the page’s period row, as stepped; with compare, {compare.start}, {compare.end}, {compare.start_at}, {compare.end_at}, {compare.start_unix} and {compare.end_unix} are the stretch before it.",
      "examples": [
        "/v2/summary?start_date={date.month_start}&end_date={date.month_end}"
      ]
    },
    "interval": {
      "type": "string",
      "pattern": "^(?:[1-9][0-9]*[mhd]|(?:[6-9][0-9]|[1-9][0-9]{2,})s)$",
      "default": "5m",
      "description": "Polling interval: an integer and s, m, h or d. Minimum one minute. The Mac also rejects intervals beyond its supported date range.",
      "examples": [
        "1m",
        "5m",
        "1h",
        "1d"
      ]
    },
    "precision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 6,
      "description": "Decimal places, from 0 to 6."
    },
    "limit": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9223372036854775000,
      "description": "Maximum number of matching rows. A nonnegative whole number representable by the Mac."
    },
    "resolvedValue": {
      "description": "A literal JSON value, or exactly {\"template\":\"…\"}. Other rule objects are not evaluated here.",
      "if": {
        "type": "object",
        "required": [
          "template"
        ],
        "maxProperties": 1
      },
      "then": {
        "type": "object",
        "properties": {
          "template": {
            "$ref": "#/definitions/template"
          }
        },
        "required": [
          "template"
        ],
        "additionalProperties": false
      }
    },
    "lookup": {
      "type": "object",
      "properties": {
        "from": {
          "$ref": "#/definitions/path"
        },
        "by": {
          "$ref": "#/definitions/path"
        },
        "on": {
          "$ref": "#/definitions/path"
        },
        "as": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]+$",
          "description": "The field the match is attached as, replacing any field of that name."
        }
      },
      "required": [
        "from",
        "by",
        "on",
        "as"
      ],
      "additionalProperties": false,
      "description": "Attaches to each element, before where, sort and limit, the first element of the array at from whose by field equals the element’s on field, as the field named in as; an element with no match goes without it. For a service that sends ids in one answer and their names in another. from is read from the same place as the array itself, and one object there is the only candidate (Mealie’s /api/groups/self, matched on each row’s groupId); by and on match as values, so 12 and \"12\" are the same.",
      "examples": [
        {
          "from": "cats.categories",
          "by": "id",
          "on": "category_id",
          "as": "category"
        }
      ]
    },
    "sort": {
      "anyOf": [
        {
          "$ref": "#/definitions/path"
        },
        {
          "type": "array",
          "minItems": 2,
          "maxItems": 4,
          "items": {
            "$ref": "#/definitions/path"
          }
        },
        {
          "type": "object",
          "properties": {
            "by": {
              "anyOf": [
                {
                  "$ref": "#/definitions/path"
                },
                {
                  "type": "array",
                  "minItems": 2,
                  "maxItems": 4,
                  "items": {
                    "$ref": "#/definitions/path"
                  }
                }
              ]
            },
            "order": {
              "enum": [
                "asc",
                "desc"
              ],
              "default": "asc"
            },
            "as": {
              "const": "date",
              "description": "Compare the values as dates, read as the date rule reads them (carriers’ own words included): days and wall times by their printed date and time, moments by their instant. Values that aren’t dates sort after those that are, in either order."
            }
          },
          "required": [
            "by"
          ],
          "additionalProperties": false
        }
      ],
      "description": "Order matching rows by a path, or by 2 to 4 paths where each next one breaks the ties of those before it (a section’s place, then a task’s own). Numbers sort before other values; other values sort by their displayed text, unless as is date. Rows that tie keep their order.",
      "examples": [
        [
          "section.order_key",
          "order_key"
        ]
      ]
    },
    "rule": {
      "description": "Read a JSON path, fill a template, map an array, aggregate rows, select a conditional result, add, subtract, multiply or divide other rules, or say how near something is to expiring. A plain string is a path, not literal text.",
      "anyOf": [
        {
          "$ref": "#/definitions/path"
        },
        {
          "$ref": "#/definitions/pathRule"
        },
        {
          "$ref": "#/definitions/templateRule"
        },
        {
          "$ref": "#/definitions/listRule"
        },
        {
          "$ref": "#/definitions/conditionalRule"
        },
        {
          "$ref": "#/definitions/aggregateRule"
        },
        {
          "$ref": "#/definitions/arithmeticRule"
        },
        {
          "$ref": "#/definitions/dateRule"
        },
        {
          "$ref": "#/definitions/sinceRule"
        },
        {
          "$ref": "#/definitions/monthElapsedRule"
        },
        {
          "$ref": "#/definitions/daysBetweenRule"
        },
        {
          "$ref": "#/definitions/expiresRule"
        }
      ]
    },
    "pathRule": {
      "type": "object",
      "properties": {
        "path": {
          "$ref": "#/definitions/path"
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/resolvedValue"
          },
          "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
        },
        "default": {
          "$ref": "#/definitions/resolvedValue"
        },
        "clock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
        },
        "scale": {
          "type": "number",
          "description": "Multiply a numeric result by this factor."
        },
        "offset": {
          "type": "number",
          "description": "Add this after scale, before round."
        },
        "round": {
          "$ref": "#/definitions/precision"
        },
        "match": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
        }
      },
      "required": [
        "path"
      ],
      "additionalProperties": false
    },
    "templateRule": {
      "type": "object",
      "properties": {
        "template": {
          "$ref": "#/definitions/template"
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/resolvedValue"
          },
          "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
        },
        "default": {
          "$ref": "#/definitions/resolvedValue"
        },
        "clock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
        },
        "scale": {
          "type": "number",
          "description": "Multiply a numeric result by this factor."
        },
        "offset": {
          "type": "number",
          "description": "Add this after scale, before round."
        },
        "round": {
          "$ref": "#/definitions/precision"
        },
        "match": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
        }
      },
      "required": [
        "template"
      ],
      "additionalProperties": false
    },
    "listRule": {
      "type": "object",
      "properties": {
        "each": {
          "anyOf": [
            {
              "$ref": "#/definitions/path"
            },
            {
              "type": "array",
              "minItems": 2,
              "maxItems": 4,
              "items": {
                "$ref": "#/definitions/path"
              }
            }
          ],
          "description": "The array to list, or 2 to 4 arrays joined in order before where, sort and limit, such as a service’s linked and manual accounts."
        },
        "entries": {
          "type": "boolean",
          "description": "First of all: each object row’s fields as rows of their own, {key, value}, for a service that sends names as keys, like AdGuard Home’s [{\"apple.com\": 3}, …]. each can then name an object too. Rows that aren’t objects are left out; a row’s fields come in key order."
        },
        "lookup": {
          "$ref": "#/definitions/lookup"
        },
        "where": {
          "$ref": "#/definitions/condition"
        },
        "flatten": {
          "$ref": "#/definitions/path",
          "description": "After where: each row’s own list at this path in its place, each element with the row it came from as parent (elements that aren’t objects are left out). An object there gives its fields as {key, value} rows. For a service that nests one list in another, like months inside each budget category, or sends each slot’s counts by name."
        },
        "group": {
          "$ref": "#/definitions/path",
          "description": "After flatten: one row per value at this path, in the order each first appears, as {key, count, rows}; sort, limit and fields then work on the groups, and an aggregate with of: rows totals each. Values match as values, so 12 and \"12\" are one group."
        },
        "sort": {
          "$ref": "#/definitions/sort"
        },
        "collapse": {
          "$ref": "#/definitions/path",
          "description": "After sort: a row whose value at this path is the same as the row kept before it (trimmed, ignoring case and runs of spaces) is left out, and so is a row with no value there. Only neighbours count, so A, B, A keeps all three. For a parcel’s scans, one stop per place: \"collapse\": \"location\"."
        },
        "limit": {
          "$ref": "#/definitions/limit"
        },
        "last": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9223372036854775000,
          "description": "After sort and collapse: keep the last this many rows, where limit keeps the first. Not with limit. For the newest stops of a route sorted oldest first."
        },
        "zip": {
          "type": "boolean",
          "description": "Turn parallel arrays in one object into rows in index order. Nulls omit the field. Non-array fields are ignored. Unequal arrays stop at the shortest. Requires a single each path and cannot be combined with entries."
        },
        "template": {
          "$ref": "#/definitions/template"
        },
        "fields": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/rule"
          },
          "description": "The output fields for each matching row, evaluated against that row. A name can be a path into a list the card takes, like values[0] and values[1] for a columns card."
        },
        "cells": {
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "items": {
            "$ref": "#/definitions/rule"
          },
          "description": "One list per matching row, one rule per cell, each evaluated against that row: a table's rows. A cell is the rule's text or number, or \"—\" when it gives neither. For a table filled from the answer: { \"each\": \"systems\", \"limit\": 5, \"cells\": [\"name\", \"cpu\"] }."
        },
        "value": {
          "$ref": "#/definitions/rule",
          "description": "One value per matching row, as this rule gives it from that row: a list of numbers, such as a sparkline's points. A row without a value is left out, so give a sparkline's labels the same where."
        },
        "buckets": {
          "type": "integer",
          "minimum": 2,
          "maximum": 240,
          "description": "After limit: at most this many rows, gathering neighbours into runs of near-equal length. A value list averages each run (at the value rule's round); a template or fields list reads its last row. For a long series drawn as a sparkline, like a day of one-minute readings in 144 points. With by_time, how many slices of time (144 by default)."
        },
        "keep": {
          "anyOf": [
            {
              "enum": [
                "max",
                "min",
                "sum",
                "average",
                "last"
              ]
            },
            {
              "type": "object",
              "properties": {
                "max": {
                  "$ref": "#/definitions/path"
                }
              },
              "required": [
                "max"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "min": {
                  "$ref": "#/definitions/path"
                }
              },
              "required": [
                "min"
              ],
              "additionalProperties": false
            }
          ],
          "description": "With buckets. A value list uses max, min, sum, average or last. Default is average. A template or fields list uses {\"max\":\"path\"} or {\"min\":\"path\"} to keep the row with the highest or lowest number. Ties keep the earlier row. Missing or nonnumeric values lose to numbers. Default is the last row."
        },
        "by_month": {
          "type": "object",
          "properties": {
            "at": {
              "$ref": "#/definitions/path"
            },
            "months": {
              "type": "integer",
              "minimum": 1,
              "maximum": 36,
              "description": "How many calendar months, ending with this one."
            }
          },
          "required": [
            "at",
            "months"
          ],
          "additionalProperties": false,
          "description": "Makes one slice per calendar month: the last months months to this one, oldest first, every one made, empty or not, each row in the month its at falls in (a plain date or month, or a time with no zone, such as 2026-11-01, 2026-11 or 2026-11-06T16:46:00, is the month it's written in; a moment with a zone or Unix seconds is read in this Mac's zone). A month is {from, until, count, rows}, from its first day and until the next month's, as plain dates; fields and template read it, and value reduces its rows (keep). For a service that leaves out months with nothing in them: { \"each\": \"buckets\", \"by_month\": { \"at\": \"timeBucket\", \"months\": 12 }, \"fields\": { \"label\": { \"template\": \"{from|month}\" }, \"values[0]\": { \"sum\": \"count\", \"of\": \"rows\" } } }. Not with by_time, buckets, group, sort, limit, last, collapse, flatten, entries or lookup."
        },
        "running": {
          "type": "boolean",
          "description": "With value: each number becomes a running total, itself plus every number before it, at the value rule's round. For a month-to-date line from one total a day: derive the days with by_day and fields, then list their totals with value and running."
        },
        "by_day": {
          "type": "object",
          "properties": {
            "at": {
              "$ref": "#/definitions/path"
            },
            "from": {
              "type": "string",
              "pattern": "^(?:[0-9]{4}-[0-9]{2}-[0-9]{2}|\\{(?:date|period|compare)\\.[a-z0-9_]+\\})$",
              "description": "The first day: a plain date, or one token such as {period.start} or {date.days_ago_29}, filled as the rule runs."
            },
            "through": {
              "type": "string",
              "pattern": "^(?:[0-9]{4}-[0-9]{2}-[0-9]{2}|\\{(?:date|period|compare)\\.[a-z0-9_]+\\})$",
              "description": "The last day, included: a plain date, or one token such as {period.end} or {date.today}."
            }
          },
          "required": [
            "at",
            "from",
            "through"
          ],
          "additionalProperties": false,
          "description": "Makes one slice per calendar day from from through through (at most 400), oldest first, every one made, empty or not, each row in the day its at falls in (a plain date, or a time with no zone, is the day it's written in; a moment with a zone or Unix seconds is read in this Mac's zone). A day is {from, until, count, rows}, from the day and until the next, as plain dates; fields and template read it, and value reduces its rows. For a chart with a column for each day of a page's period: { \"each\": \"moves.data\", \"by_day\": { \"at\": \"created\", \"from\": \"{period.start}\", \"through\": \"{period.end}\" }, \"fields\": { \"label\": { \"template\": \"{from|date}\" }, \"values[0]\": { \"sum\": \"amount\", \"of\": \"rows\" } } }. Not with by_time, by_month, buckets, group, sort, limit, last, collapse, flatten, entries or lookup."
        },
        "by_time": {
          "type": "object",
          "properties": {
            "at": {
              "$ref": "#/definitions/path"
            },
            "span": {
              "anyOf": [
                {
                  "$ref": "#/definitions/path"
                },
                {
                  "type": "object",
                  "properties": {
                    "from": {},
                    "until": {}
                  },
                  "required": [
                    "from",
                    "until"
                  ],
                  "additionalProperties": false
                }
              ],
              "description": "Where the answer has the span, an object with from and until (kept.span for a dataset source of samples), or the span written out as { from, until }: Unix seconds or instants, such as the page's period, {period.start_unix} and {period.end_unix}."
            },
            "last_hours": {
              "type": "integer",
              "minimum": 1,
              "maximum": 168,
              "description": "In place of span: the last this many whole hours, ending with this one, one slice an hour unless buckets says. For an hourly strip of a log's rows over 24 hours."
            }
          },
          "required": [
            "at"
          ],
          "additionalProperties": false,
          "oneOf": [
            {
              "required": [
                "span"
              ]
            },
            {
              "required": [
                "last_hours"
              ]
            }
          ],
          "description": "Makes buckets slices of time instead of runs of rows: span is cut into buckets equal slices (144 unless buckets says), each row goes in the slice its at falls in, and every slice is made, empty or not, oldest first. A slice is {from, until, count, rows}; fields and template read the slice, and value averages its rows (an empty slice gives nothing). For a strip: { \"each\": \"kept.rows\", \"by_time\": { \"at\": \"at\", \"span\": \"kept.span\" }, \"fields\": { \"state\": { \"worst\": \"row.state\", \"of\": \"rows\" } } }. Not with group, sort, limit, last, collapse, flatten, entries or lookup."
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/resolvedValue"
          },
          "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
        },
        "default": {
          "$ref": "#/definitions/resolvedValue"
        },
        "clock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
        },
        "scale": {
          "type": "number",
          "description": "Multiply a numeric result by this factor."
        },
        "offset": {
          "type": "number",
          "description": "Add this after scale, before round."
        },
        "round": {
          "$ref": "#/definitions/precision"
        },
        "match": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
        }
      },
      "required": [
        "each"
      ],
      "additionalProperties": false,
      "oneOf": [
        {
          "required": [
            "template"
          ]
        },
        {
          "required": [
            "fields"
          ]
        },
        {
          "required": [
            "cells"
          ]
        },
        {
          "required": [
            "value"
          ]
        }
      ],
      "not": {
        "required": [
          "limit",
          "last"
        ]
      },
      "allOf": [
        {
          "if": {
            "required": [
              "zip"
            ]
          },
          "then": {
            "properties": {
              "each": {
                "$ref": "#/definitions/path"
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "zip"
            ],
            "properties": {
              "zip": {
                "const": true
              }
            }
          },
          "then": {
            "properties": {
              "entries": {
                "const": false
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "keep"
            ]
          },
          "then": {
            "required": [
              "buckets"
            ]
          }
        },
        {
          "if": {
            "required": [
              "running"
            ]
          },
          "then": {
            "required": [
              "value"
            ]
          }
        },
        {
          "if": {
            "required": [
              "value"
            ]
          },
          "then": {
            "properties": {
              "keep": {
                "type": "string"
              }
            }
          },
          "else": {
            "properties": {
              "keep": {
                "type": "object"
              }
            }
          }
        }
      ]
    },
    "conditionalRule": {
      "type": "object",
      "properties": {
        "if": {
          "$ref": "#/definitions/condition"
        },
        "then": {
          "$ref": "#/definitions/rule"
        },
        "else": {
          "$ref": "#/definitions/rule"
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/resolvedValue"
          },
          "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
        },
        "default": {
          "$ref": "#/definitions/resolvedValue"
        },
        "clock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
        },
        "scale": {
          "type": "number",
          "description": "Multiply a numeric result by this factor."
        },
        "offset": {
          "type": "number",
          "description": "Add this after scale, before round."
        },
        "round": {
          "$ref": "#/definitions/precision"
        },
        "match": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
        }
      },
      "required": [
        "if",
        "then"
      ],
      "additionalProperties": false
    },
    "aggregateRule": {
      "anyOf": [
        {
          "not": {
            "required": [
              "limit",
              "last"
            ]
          },
          "type": "object",
          "properties": {
            "count": {
              "$ref": "#/definitions/path"
            },
            "of": {
              "$ref": "#/definitions/path"
            },
            "entries": {
              "type": "boolean",
              "description": "First of all: each object row’s fields as rows of their own, {key, value}, for a service that sends names as keys, like AdGuard Home’s [{\"apple.com\": 3}, …]. each can then name an object too. Rows that aren’t objects are left out; a row’s fields come in key order."
            },
            "lookup": {
              "$ref": "#/definitions/lookup"
            },
            "where": {
              "$ref": "#/definitions/condition"
            },
            "flatten": {
              "$ref": "#/definitions/path",
              "description": "After where: each row’s own list at this path in its place, each element with the row it came from as parent (elements that aren’t objects are left out). An object there gives its fields as {key, value} rows. For a service that nests one list in another, like months inside each budget category, or sends each slot’s counts by name."
            },
            "group": {
              "$ref": "#/definitions/path",
              "description": "After flatten: one row per value at this path, in the order each first appears, as {key, count, rows}; sort, limit and fields then work on the groups, and an aggregate with of: rows totals each. Values match as values, so 12 and \"12\" are one group."
            },
            "sort": {
              "$ref": "#/definitions/sort"
            },
            "collapse": {
              "$ref": "#/definitions/path",
              "description": "After sort: a row whose value at this path is the same as the row kept before it (trimmed, ignoring case and runs of spaces) is left out, and so is a row with no value there. Only neighbours count, so A, B, A keeps all three. For a parcel’s scans, one stop per place: \"collapse\": \"location\"."
            },
            "limit": {
              "$ref": "#/definitions/limit"
            },
            "last": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854775000,
              "description": "After sort and collapse: keep the last this many rows, where limit keeps the first. Not with limit. For the newest stops of a route sorted oldest first."
            },
            "zip": {
              "type": "boolean",
              "description": "Turn parallel arrays into rows before filtering and aggregation; stops at the shortest array, omits null fields. Cannot be combined with entries."
            },
            "rank": {
              "type": "array",
              "description": "Explicit value order for min/max, from best to worst. Values absent from the rank precede ranked values."
            },
            "separator": {
              "type": "string",
              "default": ", ",
              "description": "Text placed between joined values."
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "count"
          ],
          "additionalProperties": false,
          "allOf": [
            {
              "if": {
                "required": [
                  "zip"
                ],
                "properties": {
                  "zip": {
                    "const": true
                  }
                }
              },
              "then": {
                "properties": {
                  "entries": {
                    "const": false
                  }
                }
              }
            }
          ]
        },
        {
          "not": {
            "required": [
              "limit",
              "last"
            ]
          },
          "type": "object",
          "properties": {
            "sum": {
              "$ref": "#/definitions/path"
            },
            "of": {
              "$ref": "#/definitions/path"
            },
            "entries": {
              "type": "boolean",
              "description": "First of all: each object row’s fields as rows of their own, {key, value}, for a service that sends names as keys, like AdGuard Home’s [{\"apple.com\": 3}, …]. each can then name an object too. Rows that aren’t objects are left out; a row’s fields come in key order."
            },
            "lookup": {
              "$ref": "#/definitions/lookup"
            },
            "where": {
              "$ref": "#/definitions/condition"
            },
            "flatten": {
              "$ref": "#/definitions/path",
              "description": "After where: each row’s own list at this path in its place, each element with the row it came from as parent (elements that aren’t objects are left out). An object there gives its fields as {key, value} rows. For a service that nests one list in another, like months inside each budget category, or sends each slot’s counts by name."
            },
            "group": {
              "$ref": "#/definitions/path",
              "description": "After flatten: one row per value at this path, in the order each first appears, as {key, count, rows}; sort, limit and fields then work on the groups, and an aggregate with of: rows totals each. Values match as values, so 12 and \"12\" are one group."
            },
            "sort": {
              "$ref": "#/definitions/sort"
            },
            "collapse": {
              "$ref": "#/definitions/path",
              "description": "After sort: a row whose value at this path is the same as the row kept before it (trimmed, ignoring case and runs of spaces) is left out, and so is a row with no value there. Only neighbours count, so A, B, A keeps all three. For a parcel’s scans, one stop per place: \"collapse\": \"location\"."
            },
            "limit": {
              "$ref": "#/definitions/limit"
            },
            "last": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854775000,
              "description": "After sort and collapse: keep the last this many rows, where limit keeps the first. Not with limit. For the newest stops of a route sorted oldest first."
            },
            "zip": {
              "type": "boolean",
              "description": "Turn parallel arrays into rows before filtering and aggregation; stops at the shortest array, omits null fields. Cannot be combined with entries."
            },
            "rank": {
              "type": "array",
              "description": "Explicit value order for min/max, from best to worst. Values absent from the rank precede ranked values."
            },
            "separator": {
              "type": "string",
              "default": ", ",
              "description": "Text placed between joined values."
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "sum",
            "of"
          ],
          "additionalProperties": false,
          "allOf": [
            {
              "if": {
                "required": [
                  "zip"
                ],
                "properties": {
                  "zip": {
                    "const": true
                  }
                }
              },
              "then": {
                "properties": {
                  "entries": {
                    "const": false
                  }
                }
              }
            }
          ]
        },
        {
          "not": {
            "required": [
              "limit",
              "last"
            ]
          },
          "type": "object",
          "properties": {
            "avg": {
              "$ref": "#/definitions/path"
            },
            "of": {
              "$ref": "#/definitions/path"
            },
            "entries": {
              "type": "boolean",
              "description": "First of all: each object row’s fields as rows of their own, {key, value}, for a service that sends names as keys, like AdGuard Home’s [{\"apple.com\": 3}, …]. each can then name an object too. Rows that aren’t objects are left out; a row’s fields come in key order."
            },
            "lookup": {
              "$ref": "#/definitions/lookup"
            },
            "where": {
              "$ref": "#/definitions/condition"
            },
            "flatten": {
              "$ref": "#/definitions/path",
              "description": "After where: each row’s own list at this path in its place, each element with the row it came from as parent (elements that aren’t objects are left out). An object there gives its fields as {key, value} rows. For a service that nests one list in another, like months inside each budget category, or sends each slot’s counts by name."
            },
            "group": {
              "$ref": "#/definitions/path",
              "description": "After flatten: one row per value at this path, in the order each first appears, as {key, count, rows}; sort, limit and fields then work on the groups, and an aggregate with of: rows totals each. Values match as values, so 12 and \"12\" are one group."
            },
            "sort": {
              "$ref": "#/definitions/sort"
            },
            "collapse": {
              "$ref": "#/definitions/path",
              "description": "After sort: a row whose value at this path is the same as the row kept before it (trimmed, ignoring case and runs of spaces) is left out, and so is a row with no value there. Only neighbours count, so A, B, A keeps all three. For a parcel’s scans, one stop per place: \"collapse\": \"location\"."
            },
            "limit": {
              "$ref": "#/definitions/limit"
            },
            "last": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854775000,
              "description": "After sort and collapse: keep the last this many rows, where limit keeps the first. Not with limit. For the newest stops of a route sorted oldest first."
            },
            "zip": {
              "type": "boolean",
              "description": "Turn parallel arrays into rows before filtering and aggregation; stops at the shortest array, omits null fields. Cannot be combined with entries."
            },
            "rank": {
              "type": "array",
              "description": "Explicit value order for min/max, from best to worst. Values absent from the rank precede ranked values."
            },
            "separator": {
              "type": "string",
              "default": ", ",
              "description": "Text placed between joined values."
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "avg",
            "of"
          ],
          "additionalProperties": false,
          "allOf": [
            {
              "if": {
                "required": [
                  "zip"
                ],
                "properties": {
                  "zip": {
                    "const": true
                  }
                }
              },
              "then": {
                "properties": {
                  "entries": {
                    "const": false
                  }
                }
              }
            }
          ]
        },
        {
          "not": {
            "required": [
              "limit",
              "last"
            ]
          },
          "type": "object",
          "properties": {
            "min": {
              "$ref": "#/definitions/path"
            },
            "of": {
              "$ref": "#/definitions/path"
            },
            "entries": {
              "type": "boolean",
              "description": "First of all: each object row’s fields as rows of their own, {key, value}, for a service that sends names as keys, like AdGuard Home’s [{\"apple.com\": 3}, …]. each can then name an object too. Rows that aren’t objects are left out; a row’s fields come in key order."
            },
            "lookup": {
              "$ref": "#/definitions/lookup"
            },
            "where": {
              "$ref": "#/definitions/condition"
            },
            "flatten": {
              "$ref": "#/definitions/path",
              "description": "After where: each row’s own list at this path in its place, each element with the row it came from as parent (elements that aren’t objects are left out). An object there gives its fields as {key, value} rows. For a service that nests one list in another, like months inside each budget category, or sends each slot’s counts by name."
            },
            "group": {
              "$ref": "#/definitions/path",
              "description": "After flatten: one row per value at this path, in the order each first appears, as {key, count, rows}; sort, limit and fields then work on the groups, and an aggregate with of: rows totals each. Values match as values, so 12 and \"12\" are one group."
            },
            "sort": {
              "$ref": "#/definitions/sort"
            },
            "collapse": {
              "$ref": "#/definitions/path",
              "description": "After sort: a row whose value at this path is the same as the row kept before it (trimmed, ignoring case and runs of spaces) is left out, and so is a row with no value there. Only neighbours count, so A, B, A keeps all three. For a parcel’s scans, one stop per place: \"collapse\": \"location\"."
            },
            "limit": {
              "$ref": "#/definitions/limit"
            },
            "last": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854775000,
              "description": "After sort and collapse: keep the last this many rows, where limit keeps the first. Not with limit. For the newest stops of a route sorted oldest first."
            },
            "zip": {
              "type": "boolean",
              "description": "Turn parallel arrays into rows before filtering and aggregation; stops at the shortest array, omits null fields. Cannot be combined with entries."
            },
            "rank": {
              "type": "array",
              "description": "Explicit value order for min/max, from best to worst. Values absent from the rank precede ranked values."
            },
            "separator": {
              "type": "string",
              "default": ", ",
              "description": "Text placed between joined values."
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "min",
            "of"
          ],
          "additionalProperties": false,
          "allOf": [
            {
              "if": {
                "required": [
                  "zip"
                ],
                "properties": {
                  "zip": {
                    "const": true
                  }
                }
              },
              "then": {
                "properties": {
                  "entries": {
                    "const": false
                  }
                }
              }
            }
          ]
        },
        {
          "not": {
            "required": [
              "limit",
              "last"
            ]
          },
          "type": "object",
          "properties": {
            "max": {
              "$ref": "#/definitions/path"
            },
            "of": {
              "$ref": "#/definitions/path"
            },
            "entries": {
              "type": "boolean",
              "description": "First of all: each object row’s fields as rows of their own, {key, value}, for a service that sends names as keys, like AdGuard Home’s [{\"apple.com\": 3}, …]. each can then name an object too. Rows that aren’t objects are left out; a row’s fields come in key order."
            },
            "lookup": {
              "$ref": "#/definitions/lookup"
            },
            "where": {
              "$ref": "#/definitions/condition"
            },
            "flatten": {
              "$ref": "#/definitions/path",
              "description": "After where: each row’s own list at this path in its place, each element with the row it came from as parent (elements that aren’t objects are left out). An object there gives its fields as {key, value} rows. For a service that nests one list in another, like months inside each budget category, or sends each slot’s counts by name."
            },
            "group": {
              "$ref": "#/definitions/path",
              "description": "After flatten: one row per value at this path, in the order each first appears, as {key, count, rows}; sort, limit and fields then work on the groups, and an aggregate with of: rows totals each. Values match as values, so 12 and \"12\" are one group."
            },
            "sort": {
              "$ref": "#/definitions/sort"
            },
            "collapse": {
              "$ref": "#/definitions/path",
              "description": "After sort: a row whose value at this path is the same as the row kept before it (trimmed, ignoring case and runs of spaces) is left out, and so is a row with no value there. Only neighbours count, so A, B, A keeps all three. For a parcel’s scans, one stop per place: \"collapse\": \"location\"."
            },
            "limit": {
              "$ref": "#/definitions/limit"
            },
            "last": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854775000,
              "description": "After sort and collapse: keep the last this many rows, where limit keeps the first. Not with limit. For the newest stops of a route sorted oldest first."
            },
            "zip": {
              "type": "boolean",
              "description": "Turn parallel arrays into rows before filtering and aggregation; stops at the shortest array, omits null fields. Cannot be combined with entries."
            },
            "rank": {
              "type": "array",
              "description": "Explicit value order for min/max, from best to worst. Values absent from the rank precede ranked values."
            },
            "separator": {
              "type": "string",
              "default": ", ",
              "description": "Text placed between joined values."
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "max",
            "of"
          ],
          "additionalProperties": false,
          "allOf": [
            {
              "if": {
                "required": [
                  "zip"
                ],
                "properties": {
                  "zip": {
                    "const": true
                  }
                }
              },
              "then": {
                "properties": {
                  "entries": {
                    "const": false
                  }
                }
              }
            }
          ]
        },
        {
          "not": {
            "required": [
              "limit",
              "last"
            ]
          },
          "type": "object",
          "properties": {
            "first": {
              "$ref": "#/definitions/path"
            },
            "of": {
              "$ref": "#/definitions/path"
            },
            "entries": {
              "type": "boolean",
              "description": "First of all: each object row’s fields as rows of their own, {key, value}, for a service that sends names as keys, like AdGuard Home’s [{\"apple.com\": 3}, …]. each can then name an object too. Rows that aren’t objects are left out; a row’s fields come in key order."
            },
            "lookup": {
              "$ref": "#/definitions/lookup"
            },
            "where": {
              "$ref": "#/definitions/condition"
            },
            "flatten": {
              "$ref": "#/definitions/path",
              "description": "After where: each row’s own list at this path in its place, each element with the row it came from as parent (elements that aren’t objects are left out). An object there gives its fields as {key, value} rows. For a service that nests one list in another, like months inside each budget category, or sends each slot’s counts by name."
            },
            "group": {
              "$ref": "#/definitions/path",
              "description": "After flatten: one row per value at this path, in the order each first appears, as {key, count, rows}; sort, limit and fields then work on the groups, and an aggregate with of: rows totals each. Values match as values, so 12 and \"12\" are one group."
            },
            "sort": {
              "$ref": "#/definitions/sort"
            },
            "collapse": {
              "$ref": "#/definitions/path",
              "description": "After sort: a row whose value at this path is the same as the row kept before it (trimmed, ignoring case and runs of spaces) is left out, and so is a row with no value there. Only neighbours count, so A, B, A keeps all three. For a parcel’s scans, one stop per place: \"collapse\": \"location\"."
            },
            "limit": {
              "$ref": "#/definitions/limit"
            },
            "last": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854775000,
              "description": "After sort and collapse: keep the last this many rows, where limit keeps the first. Not with limit. For the newest stops of a route sorted oldest first."
            },
            "zip": {
              "type": "boolean",
              "description": "Turn parallel arrays into rows before filtering and aggregation; stops at the shortest array, omits null fields. Cannot be combined with entries."
            },
            "rank": {
              "type": "array",
              "description": "Explicit value order for min/max, from best to worst. Values absent from the rank precede ranked values."
            },
            "separator": {
              "type": "string",
              "default": ", ",
              "description": "Text placed between joined values."
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "first",
            "of"
          ],
          "additionalProperties": false,
          "allOf": [
            {
              "if": {
                "required": [
                  "zip"
                ],
                "properties": {
                  "zip": {
                    "const": true
                  }
                }
              },
              "then": {
                "properties": {
                  "entries": {
                    "const": false
                  }
                }
              }
            }
          ]
        },
        {
          "not": {
            "required": [
              "limit",
              "last"
            ]
          },
          "type": "object",
          "properties": {
            "join": {
              "$ref": "#/definitions/path"
            },
            "of": {
              "$ref": "#/definitions/path"
            },
            "entries": {
              "type": "boolean",
              "description": "First of all: each object row’s fields as rows of their own, {key, value}, for a service that sends names as keys, like AdGuard Home’s [{\"apple.com\": 3}, …]. each can then name an object too. Rows that aren’t objects are left out; a row’s fields come in key order."
            },
            "lookup": {
              "$ref": "#/definitions/lookup"
            },
            "where": {
              "$ref": "#/definitions/condition"
            },
            "flatten": {
              "$ref": "#/definitions/path",
              "description": "After where: each row’s own list at this path in its place, each element with the row it came from as parent (elements that aren’t objects are left out). An object there gives its fields as {key, value} rows. For a service that nests one list in another, like months inside each budget category, or sends each slot’s counts by name."
            },
            "group": {
              "$ref": "#/definitions/path",
              "description": "After flatten: one row per value at this path, in the order each first appears, as {key, count, rows}; sort, limit and fields then work on the groups, and an aggregate with of: rows totals each. Values match as values, so 12 and \"12\" are one group."
            },
            "sort": {
              "$ref": "#/definitions/sort"
            },
            "collapse": {
              "$ref": "#/definitions/path",
              "description": "After sort: a row whose value at this path is the same as the row kept before it (trimmed, ignoring case and runs of spaces) is left out, and so is a row with no value there. Only neighbours count, so A, B, A keeps all three. For a parcel’s scans, one stop per place: \"collapse\": \"location\"."
            },
            "limit": {
              "$ref": "#/definitions/limit"
            },
            "last": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854775000,
              "description": "After sort and collapse: keep the last this many rows, where limit keeps the first. Not with limit. For the newest stops of a route sorted oldest first."
            },
            "zip": {
              "type": "boolean",
              "description": "Turn parallel arrays into rows before filtering and aggregation; stops at the shortest array, omits null fields. Cannot be combined with entries."
            },
            "rank": {
              "type": "array",
              "description": "Explicit value order for min/max, from best to worst. Values absent from the rank precede ranked values."
            },
            "separator": {
              "type": "string",
              "default": ", ",
              "description": "Text placed between joined values."
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "join",
            "of"
          ],
          "additionalProperties": false,
          "allOf": [
            {
              "if": {
                "required": [
                  "zip"
                ],
                "properties": {
                  "zip": {
                    "const": true
                  }
                }
              },
              "then": {
                "properties": {
                  "entries": {
                    "const": false
                  }
                }
              }
            }
          ]
        },
        {
          "not": {
            "required": [
              "limit",
              "last"
            ]
          },
          "type": "object",
          "properties": {
            "worst": {
              "$ref": "#/definitions/path"
            },
            "of": {
              "$ref": "#/definitions/path"
            },
            "entries": {
              "type": "boolean",
              "description": "First of all: each object row’s fields as rows of their own, {key, value}, for a service that sends names as keys, like AdGuard Home’s [{\"apple.com\": 3}, …]. each can then name an object too. Rows that aren’t objects are left out; a row’s fields come in key order."
            },
            "lookup": {
              "$ref": "#/definitions/lookup"
            },
            "where": {
              "$ref": "#/definitions/condition"
            },
            "flatten": {
              "$ref": "#/definitions/path",
              "description": "After where: each row’s own list at this path in its place, each element with the row it came from as parent (elements that aren’t objects are left out). An object there gives its fields as {key, value} rows. For a service that nests one list in another, like months inside each budget category, or sends each slot’s counts by name."
            },
            "group": {
              "$ref": "#/definitions/path",
              "description": "After flatten: one row per value at this path, in the order each first appears, as {key, count, rows}; sort, limit and fields then work on the groups, and an aggregate with of: rows totals each. Values match as values, so 12 and \"12\" are one group."
            },
            "sort": {
              "$ref": "#/definitions/sort"
            },
            "collapse": {
              "$ref": "#/definitions/path",
              "description": "After sort: a row whose value at this path is the same as the row kept before it (trimmed, ignoring case and runs of spaces) is left out, and so is a row with no value there. Only neighbours count, so A, B, A keeps all three. For a parcel’s scans, one stop per place: \"collapse\": \"location\"."
            },
            "limit": {
              "$ref": "#/definitions/limit"
            },
            "last": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854775000,
              "description": "After sort and collapse: keep the last this many rows, where limit keeps the first. Not with limit. For the newest stops of a route sorted oldest first."
            },
            "zip": {
              "type": "boolean",
              "description": "Turn parallel arrays into rows before filtering and aggregation; stops at the shortest array, omits null fields. Cannot be combined with entries."
            },
            "rank": {
              "type": "array",
              "description": "Explicit value order for min/max, from best to worst. Values absent from the rank precede ranked values."
            },
            "separator": {
              "type": "string",
              "default": ", ",
              "description": "Text placed between joined values."
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "worst",
            "of"
          ],
          "additionalProperties": false,
          "allOf": [
            {
              "if": {
                "required": [
                  "zip"
                ],
                "properties": {
                  "zip": {
                    "const": true
                  }
                }
              },
              "then": {
                "properties": {
                  "entries": {
                    "const": false
                  }
                }
              }
            }
          ]
        }
      ],
      "description": "count can name its array directly; other aggregates name a field and use of for the array. For min/max, rank can define the value order. worst gives the worst state of every row, ranked ok, off, unknown, warning, critical: a missing value or one that isn’t a state counts as unknown, and no rows gives none."
    },
    "arithmeticRule": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "add": {
              "type": "array",
              "minItems": 2,
              "maxItems": 8,
              "items": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "$ref": "#/definitions/rule"
                  }
                ]
              }
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "add"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "subtract": {
              "type": "array",
              "minItems": 2,
              "maxItems": 8,
              "items": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "$ref": "#/definitions/rule"
                  }
                ]
              }
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "subtract"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "multiply": {
              "type": "array",
              "minItems": 2,
              "maxItems": 8,
              "items": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "$ref": "#/definitions/rule"
                  }
                ]
              }
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "multiply"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "divide": {
              "type": "array",
              "minItems": 2,
              "maxItems": 8,
              "items": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "$ref": "#/definitions/rule"
                  }
                ]
              }
            },
            "values": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/resolvedValue"
              },
              "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
            },
            "default": {
              "$ref": "#/definitions/resolvedValue"
            },
            "clock": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23,
              "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
            },
            "scale": {
              "type": "number",
              "description": "Multiply a numeric result by this factor."
            },
            "offset": {
              "type": "number",
              "description": "Add this after scale, before round."
            },
            "round": {
              "$ref": "#/definitions/precision"
            },
            "match": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
            }
          },
          "required": [
            "divide"
          ],
          "additionalProperties": false
        }
      ],
      "description": "Combine numbers from anywhere in the answer, such as two lists’ totals: each side is a rule or a number. subtract and divide go left to right. A missing or non-numeric side, or dividing by zero, leaves the result missing, so default applies."
    },
    "sinceRule": {
      "type": "object",
      "properties": {
        "since": {
          "$ref": "#/definitions/rule"
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/resolvedValue"
          },
          "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
        },
        "default": {
          "$ref": "#/definitions/resolvedValue"
        },
        "clock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
        },
        "scale": {
          "type": "number",
          "description": "Multiply a numeric result by this factor."
        },
        "offset": {
          "type": "number",
          "description": "Add this after scale, before round."
        },
        "round": {
          "$ref": "#/definitions/precision"
        },
        "match": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
        }
      },
      "required": [
        "since"
      ],
      "additionalProperties": false,
      "description": "Seconds from the input moment to now, negative for a future moment. Reads a path or rule as ISO 8601, Unix seconds or milliseconds. Missing or unreadable moments and years before 1970 give no value, so default applies."
    },
    "monthElapsedRule": {
      "type": "object",
      "properties": {
        "month_elapsed": {
          "const": true
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/resolvedValue"
          },
          "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
        },
        "default": {
          "$ref": "#/definitions/resolvedValue"
        },
        "clock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
        },
        "scale": {
          "type": "number",
          "description": "Multiply a numeric result by this factor."
        },
        "offset": {
          "type": "number",
          "description": "Add this after scale, before round."
        },
        "round": {
          "$ref": "#/definitions/precision"
        },
        "match": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
        }
      },
      "required": [
        "month_elapsed"
      ],
      "additionalProperties": false,
      "description": "How far through this calendar month now is, 0 to 1 (the 24th of a 30-day month is about 0.78), for a pacing card’s elapsed on a page with no period, such as a budget’s pace on a home page.",
      "examples": [
        {
          "month_elapsed": true
        }
      ]
    },
    "dateRule": {
      "type": "object",
      "properties": {
        "date": {
          "$ref": "#/definitions/rule"
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/resolvedValue"
          },
          "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
        },
        "default": {
          "$ref": "#/definitions/resolvedValue"
        },
        "clock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
        },
        "scale": {
          "type": "number",
          "description": "Multiply a numeric result by this factor."
        },
        "offset": {
          "type": "number",
          "description": "Add this after scale, before round."
        },
        "round": {
          "$ref": "#/definitions/precision"
        },
        "match": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
        }
      },
      "required": [
        "date"
      ],
      "additionalProperties": false,
      "description": "The value another rule gives, read as a date and written one way: 2026-11-04 for a day; 2026-11-06T16:46:00, with no zone, for a date and time with none (a wall time, kept as printed and never moved to this Mac’s zone); 2026-11-07T00:46:00Z for a moment (ISO 8601 with a zone or Z, a zone the words name like EST, or Unix seconds). Reads carriers’ own words too: “Friday, November 6, 2026 10:05 AM”, “November 2, 2026 03:14 PM EST”, “02.11.2026 14:30” (day first) and “11/02/2026 4:40 PM” (month first). Words it can’t read leave the result missing, so default applies.",
      "examples": [
        {
          "date": {
            "first": "date",
            "of": "events",
            "where": {
              "path": "event",
              "contains": "Delivered"
            }
          }
        }
      ]
    },
    "daysBetweenRule": {
      "type": "object",
      "properties": {
        "days_between": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "items": {
            "$ref": "#/definitions/rule"
          }
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/resolvedValue"
          },
          "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
        },
        "default": {
          "$ref": "#/definitions/resolvedValue"
        },
        "clock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
        },
        "scale": {
          "type": "number",
          "description": "Multiply a numeric result by this factor."
        },
        "offset": {
          "type": "number",
          "description": "Add this after scale, before round."
        },
        "round": {
          "$ref": "#/definitions/precision"
        },
        "match": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
        }
      },
      "required": [
        "days_between"
      ],
      "additionalProperties": false,
      "description": "Whole calendar days from the first date to the second, read as the date rule reads them: negative when the second is earlier. Days and wall times count by their printed date, moments by their day on this Mac. Either side missing or unreadable leaves the result missing.",
      "examples": [
        {
          "days_between": [
            {
              "date": {
                "first": "date",
                "of": "row.events",
                "where": {
                  "path": "event",
                  "contains": "Accepted"
                }
              }
            },
            "date"
          ]
        }
      ]
    },
    "expiresRule": {
      "type": "object",
      "properties": {
        "expires": {
          "type": "object",
          "properties": {
            "days": {
              "$ref": "#/definitions/rule",
              "description": "Days left, as the service counts them: a number, or text that reads as one (\"12\"). Fractions count toward zero: 13.9 is 13, and -0.4 expired today."
            },
            "date": {
              "$ref": "#/definitions/rule",
              "description": "When it expires, read as the date rule reads it (impossible dates like 2026-02-30 aren’t read), or a feed’s RFC 822 date. A date with no time is good through that day; a moment has gone once it’s now."
            }
          },
          "required": [],
          "additionalProperties": false,
          "oneOf": [
            {
              "required": [
                "days"
              ]
            },
            {
              "required": [
                "date"
              ]
            }
          ],
          "description": "What it reads: days left, or the date it expires. Days are calendar days on this Mac, from today to the day it expires."
        },
        "as": {
          "enum": [
            "state",
            "text",
            "days"
          ],
          "description": "state: ok, warning (from warning days left), critical (from critical days left, and once expired), or unknown with no input unless default says otherwise. text: \"Expires today\", \"Expires tomorrow\", \"9 days left\", \"Expired today\", \"Expired yesterday\", \"Expired 3 days ago\". days: whole days left, 0 today (expired earlier today too), negative from the day after."
        },
        "warning": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3650,
          "default": 14,
          "description": "Days left from which the state is warning. At least critical."
        },
        "critical": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3650,
          "default": 0,
          "description": "Days left from which the state is critical: 0 is due today. Expired is always critical. No more than warning."
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/resolvedValue"
          },
          "description": "Map exact result values to literals or templates; numeric and boolean keys use their plain text forms."
        },
        "default": {
          "$ref": "#/definitions/resolvedValue"
        },
        "clock": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23,
          "description": "Read a moment (ISO 8601, Unix seconds, or a date and time with a numeric zone) as hours of the day on this Mac, 22.5 for 10:30 PM; times before this hour count from 24 as the next day’s, so a night stays in order. Applied before scale."
        },
        "scale": {
          "type": "number",
          "description": "Multiply a numeric result by this factor."
        },
        "offset": {
          "type": "number",
          "description": "Add this after scale, before round."
        },
        "round": {
          "$ref": "#/definitions/precision"
        },
        "match": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression the value’s text is searched with, before values, scale and round: the first capture group, or the whole match without one, as a number when it reads as one. \"ctime=([0-9]+)\" takes 1793983411 out of \"creation-qemu=11.1.3,ctime=1793983411\". No match is no value, so default applies."
        }
      },
      "required": [
        "expires",
        "as"
      ],
      "additionalProperties": false,
      "description": "A state, words or whole days for something that expires: a certificate, a domain, a renewal, a key. A missing input, or one that isn’t a number or a real date, gives nothing, so default applies. Worked out when the page draws (map) or the source answers (derive). Not in a dataset source’s row: use it in derive or the card’s map.",
      "examples": [
        {
          "expires": {
            "days": "monitor_cert_days_remaining"
          },
          "warning": 14,
          "as": "state",
          "default": "ok"
        },
        {
          "expires": {
            "date": "renews_at"
          },
          "as": "text"
        }
      ]
    },
    "otherValue": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "path": {
              "$ref": "#/definitions/path"
            }
          },
          "required": [
            "path"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "answer": {
              "$ref": "#/definitions/path"
            }
          },
          "required": [
            "answer"
          ],
          "additionalProperties": false
        }
      ],
      "description": "Another value to compare with, instead of one written here: {\"path\": \"OldVersion\"} in the same answer (or, in where, the same row), or {\"answer\": \"created\"} in the whole answer, even in where."
    },
    "singleCondition": {
      "type": "object",
      "properties": {
        "path": {
          "$ref": "#/definitions/path"
        },
        "value": {
          "$ref": "#/definitions/rule"
        },
        "equals": {
          "if": {
            "type": "object",
            "anyOf": [
              {
                "required": [
                  "path"
                ]
              },
              {
                "required": [
                  "answer"
                ]
              }
            ]
          },
          "then": {
            "$ref": "#/definitions/otherValue"
          }
        },
        "in": {
          "type": "array"
        },
        "not": {
          "if": {
            "type": "object",
            "anyOf": [
              {
                "required": [
                  "path"
                ]
              },
              {
                "required": [
                  "answer"
                ]
              }
            ]
          },
          "then": {
            "$ref": "#/definitions/otherValue"
          }
        },
        "not_in": {
          "type": "array"
        },
        "gt": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "$ref": "#/definitions/otherValue"
            }
          ]
        },
        "gte": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "$ref": "#/definitions/otherValue"
            }
          ]
        },
        "lt": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "$ref": "#/definitions/otherValue"
            }
          ]
        },
        "lte": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "$ref": "#/definitions/otherValue"
            }
          ]
        },
        "contains": {
          "anyOf": [
            {
              "type": [
                "string",
                "number",
                "boolean"
              ]
            },
            {
              "$ref": "#/definitions/otherValue"
            }
          ],
          "description": "Text that holds this as part of it (case matters), or a list with an item equal to it: tags \"docker;homelab\" contains \"homelab\"."
        },
        "exists": {
          "type": "boolean",
          "description": "true holds when there’s a value, false when there’s none. Null counts as none (GitHub’s \"latestRelease\": null); \"\", 0, false and an empty list are values. Unlike the other tests it always has an answer, so a card’s when never shows the missing-value note for it."
        },
        "in_list": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
          "description": "The name of a list in Legato’s Settings → Lists, kept on each Mac and never in the page, such as a delivery area: holds when the value, as text, contains any entry of that list as whole words. Case, accents and punctuation don’t matter, so \"FERNHOLLOW KS 66000\" contains \"Fernhollow, KS\", and \"Hill\" doesn’t match \"Hillside\". Entries are plain text, not patterns. Reads false while the list is missing or empty unless if_missing is true, and cards that check it say to add it in Settings → Lists. Not in a dataset source’s row: use it in derive or the card’s map."
        },
        "if_missing": {
          "type": "boolean",
          "description": "With in_list only: true holds when the list is missing or empty; false or absent keeps the usual behavior."
        },
        "optional": {
          "type": "boolean",
          "description": "With in_list only: true means the page works without the list, so its cards don’t ask you to add it while it’s missing or empty."
        }
      },
      "required": [],
      "additionalProperties": false,
      "allOf": [
        {
          "oneOf": [
            {
              "required": [
                "path"
              ]
            },
            {
              "required": [
                "value"
              ]
            }
          ]
        },
        {
          "oneOf": [
            {
              "required": [
                "equals"
              ]
            },
            {
              "required": [
                "in"
              ]
            },
            {
              "required": [
                "not"
              ]
            },
            {
              "required": [
                "not_in"
              ]
            },
            {
              "required": [
                "gt"
              ]
            },
            {
              "required": [
                "gte"
              ]
            },
            {
              "required": [
                "lt"
              ]
            },
            {
              "required": [
                "lte"
              ]
            },
            {
              "required": [
                "contains"
              ]
            },
            {
              "required": [
                "exists"
              ]
            },
            {
              "required": [
                "in_list"
              ]
            }
          ]
        },
        {
          "if": {
            "required": [
              "if_missing"
            ]
          },
          "then": {
            "required": [
              "in_list"
            ]
          }
        },
        {
          "if": {
            "required": [
              "optional"
            ]
          },
          "then": {
            "required": [
              "in_list"
            ]
          }
        }
      ],
      "description": "Select exactly one operand (path or value) and one comparison. Equality compares plain text keys, so 1 also matches \"1\". equals, not, gt, gte, lt, lte and contains can compare with another value in the answer: {\"path\": \"Version\", \"not\": {\"path\": \"OldVersion\"}}. in_list checks a list on this Mac by name: {\"path\": \"location\", \"in_list\": \"delivery-area\"}. exists asks whether there’s a value at all: {\"path\": \"latestRelease\", \"exists\": true}."
    },
    "condition": {
      "anyOf": [
        {
          "$ref": "#/definitions/singleCondition"
        },
        {
          "type": "object",
          "properties": {
            "all": {
              "type": "array",
              "minItems": 2,
              "maxItems": 8,
              "items": {
                "$ref": "#/definitions/condition"
              },
              "description": "Holds when every condition in it does."
            }
          },
          "required": [
            "all"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "any": {
              "type": "array",
              "minItems": 2,
              "maxItems": 8,
              "items": {
                "$ref": "#/definitions/condition"
              },
              "description": "Holds when at least one condition in it does."
            }
          },
          "required": [
            "any"
          ],
          "additionalProperties": false
        }
      ],
      "description": "One test of a path or value, or all or any of 2 to 8 conditions, which can nest: {\"all\": [{\"path\": \"type\", \"equals\": \"credit\"}, {\"path\": \"to_base\", \"not\": 0}]}."
    },
    "httpsRequestURL": {
      "type": "string",
      "pattern": "^https://[^/@?#\\s{}]+(?:[/?][^#]*)?$",
      "description": "Full HTTPS URL, for a source with no secret and no auth, or a request with auth none. No URL login, method or body. Params in its path/query are percent-encoded."
    },
    "eachEntry": {
      "type": "object",
      "properties": {
        "list": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
          "description": "The name of a list in Settings → Lists. The page names the list, never its entries; Settings → Lists shows which services each list is sent to. Nothing is sent while the list is missing or empty, and cards using the source say where to add it."
        },
        "max": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50,
          "default": 20,
          "description": "How many entries are sent: the first in the list that can be sent (1–50, default 20). Later ones are rows saying they were not sent. A source makes at most 64 calls a fetch, counting each each_entry as its max."
        },
        "type": {
          "enum": [
            "string",
            "text"
          ],
          "default": "string",
          "description": "string takes 1–64 of A–Z a–z 0–9 . _ ~ - (never . or ..); text takes a short name of up to 40 letters, digits, spaces and . , ' - ( ) &, encoded. As page params."
        },
        "pattern": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression each whole entry must match as well."
        }
      },
      "required": [
        "list"
      ],
      "additionalProperties": false,
      "description": "Sends the request once for each entry of the list, {entry} in its path filled with the entry, percent-encoded. The answer is a list in the list’s order: { entry, answer } or { entry, error }. One entry failing fails only its row; a refused secret, a rate limit or an unreachable host fails the source, as does every entry failing. Entries are sent once each, at most 4 at a time, 0.1 s apart. GET only.",
      "examples": [
        {
          "list": "stock-watchlist",
          "max": 30
        }
      ]
    },
    "allEntries": {
      "type": "object",
      "properties": {
        "list": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
          "description": "The name of a list in Settings → Lists. The page names the list, never its entries; Settings → Lists shows which services each list is sent to. Nothing is sent while the list is missing or empty, and cards using the source say where to add it."
        },
        "max": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 50,
          "description": "The most entries the list may hold (1–100, default 50). With more, or with an entry that can’t be sent, nothing is sent and cards say why."
        },
        "type": {
          "enum": [
            "string",
            "text"
          ],
          "default": "string",
          "description": "string takes 1–64 of A–Z a–z 0–9 . _ ~ - (never . or ..); text takes a short name of up to 40 letters, digits, spaces and . , ' - ( ) &, encoded. As page params."
        },
        "pattern": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "A regular expression each whole entry must match as well."
        }
      },
      "required": [
        "list"
      ],
      "additionalProperties": false,
      "description": "Sends the request once, {entries} in its path filled with every entry of the list, each percent-encoded, joined with commas. Entries are sent once each; an entry holding a comma can’t be sent. The answer is the service’s. GET only.",
      "examples": [
        {
          "list": "coins",
          "max": 50
        }
      ]
    },
    "eachRow": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string",
          "pattern": "^[a-z0-9_]+(?:\\..+)?$",
          "description": "Another named request of this source, then where its rows are in its answer: \"pending.results\" (an object there is one row). That request must be an ordinary one (no each_row, each_entry, all_entries, with or auth none) answering JSON, or one taking values with with (its answer's rows, as for an ordinary one), or one sent for each row of an ordinary one: then its rows are those inside each of its answers, at the path after its name (\"devices.data\"; an object there is one row, so \"prs\" reads each pull request's own answer), each with parent_key, the key of the row it came from. Its answer is read as it came, before derive."
        },
        "key": {
          "type": "string",
          "minLength": 1,
          "description": "The field naming each row, a string or number, sent back as each answer row's key for a card's lookup (\"by\": \"key\"). A row without one, or with one an earlier row has, is not sent."
        },
        "max": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50,
          "default": 20,
          "description": "How many rows are sent: the first that can be (1–50, default 20). Later ones are rows saying they were not sent. Counts toward a source's 64 calls a fetch."
        },
        "pick": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "description": "Top-level fields to keep from each answer; the rest is dropped. Keeps answers small and kept answers free of fields that change."
        },
        "keep": {
          "type": "string",
          "pattern": "^[0-9]{1,5}[smhd]$",
          "description": "How long to reuse an answer before asking again, from 1m to 24h, like \"6h\". Kept in memory only, for this address and secret; a failed answer is never kept. For answers that rarely change, such as a film's title, so a button press's follow-up refreshes don't ask again for every row."
        }
      },
      "required": [
        "from",
        "key"
      ],
      "additionalProperties": false,
      "description": "Sends the request once for each row of another request's answer, after the source's other requests, each {field} in its path (a path in the row, like {media.tmdbId}) filled with that row's string or whole number, checked as a page param is and percent-encoded as one segment. Path only, on the source's own address; GET only; never in a host list. The answer is a list in the rows' order: { key, answer } or { key, error }. A row failing, even every row, fails only its own row; a refused secret, a rate limit or an unreachable host fails the source. At most 4 at a time, 0.1 s apart.",
      "examples": [
        {
          "from": "pending.results",
          "key": "id",
          "max": 20,
          "pick": [
            "title",
            "posterPath"
          ],
          "keep": "6h"
        }
      ]
    },
    "followPages": {
      "type": "object",
      "properties": {
        "items": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_\\-\\u0080-\\uFFFF]+(?:\\.[A-Za-z0-9_\\-\\u0080-\\uFFFF]+)*$",
          "description": "Where each page's list is, a field of the answer (not inside a list): \"data\". The joined answer holds every page's items here, in order."
        },
        "while": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_\\-\\u0080-\\uFFFF]+(?:\\.[A-Za-z0-9_\\-\\u0080-\\uFFFF]+)*$",
          "description": "The field that says whether there's another page, true or false: \"has_more\". The joined answer takes it from the last page read, so a list still cut short after max pages says true. Leave it out, with from, for a service whose cursor is there only while more pages remain (Site Manager's nextToken): the list ends at a page with no cursor, null or empty text."
        },
        "param": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_.\\-\\[\\]]{1,64}$",
          "description": "The query parameter the next page's cursor goes in: \"starting_after\". An earlier value of it in the path is replaced; every other parameter stays as written."
        },
        "from_last": {
          "type": "string",
          "minLength": 1,
          "description": "The field of a page's last item that is the next page's cursor: \"id\"."
        },
        "from": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_\\-\\u0080-\\uFFFF]+(?:\\.[A-Za-z0-9_\\-\\u0080-\\uFFFF]+)*$",
          "description": "The field of a page (not inside a list) that is the next page's cursor: \"next_page\". The joined answer takes it from the last page read."
        },
        "max": {
          "type": "integer",
          "minimum": 1,
          "maximum": 20,
          "default": 10,
          "description": "Pages read at most, the first included (1–20, default 10). Counts toward a source's 64 calls a fetch."
        }
      },
      "required": [
        "items",
        "param"
      ],
      "additionalProperties": false,
      "oneOf": [
        {
          "required": [
            "from_last",
            "while"
          ],
          "not": {
            "required": [
              "from"
            ]
          }
        },
        {
          "required": [
            "from"
          ],
          "not": {
            "required": [
              "from_last"
            ]
          }
        }
      ],
      "description": "Follows a list across pages: while the answer's while field is true (or, without while, while the page's cursor at from is there), sends the request again with the next page's cursor in param, up to max pages. The answer is the first page with every page's items at items. A page that fails, has no list, has no true or false at while, or gives no new cursor when it says there's more, fails the whole request. GET and JSON only; at most 10,000 items and 8 MB joined.",
      "examples": [
        {
          "items": "data",
          "while": "has_more",
          "param": "starting_after",
          "from_last": "id",
          "max": 10
        },
        {
          "items": "data",
          "while": "has_more",
          "param": "page",
          "from": "next_page",
          "max": 5
        },
        {
          "items": "data",
          "param": "nextToken",
          "from": "nextToken",
          "max": 4
        }
      ]
    },
    "requestWith": {
      "type": "object",
      "minProperties": 1,
      "maxProperties": 4,
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9_]{0,31}$",
        "not": {
          "enum": [
            "param",
            "date",
            "period",
            "compare",
            "entry",
            "entries",
            "secret",
            "answer",
            "input",
            "action",
            "choice"
          ]
        }
      },
      "additionalProperties": {
        "anyOf": [
          {
            "type": "string",
            "pattern": "^[a-z0-9_]+(?:[.\\[].*)?$"
          },
          {
            "type": "array",
            "minItems": 1,
            "maxItems": 3,
            "items": {
              "type": "string",
              "pattern": "^[a-z0-9_]+(?:[.\\[].*)?$"
            },
            "description": "Places tried in order: the first with a value is sent."
          }
        ]
      },
      "description": "Values this request takes from another named request's answer: each name fills {name} in the path (percent-encoded as one segment) or in a JSON body string, and its value is another request's name and where the value is in its answer, like \"zones.result[0].account.id\" or \"nodes[0].node\". The request goes after the others, reading that answer as it came, before derive. The value must be a string or whole number of 1–64 A–Z a–z 0–9 . _ ~ - (never . or ..); when it is missing or can't be sent, this request isn't sent and the source fails, naming where the value was looked for. That request must be an ordinary one answering JSON (no with, each_row, each_entry, all_entries or auth none). Never in a header or the host; not with each_row, each_entry or all_entries.",
      "examples": [
        {
          "account": "zones.result[0].account.id"
        }
      ]
    },
    "publicKeep": {
      "type": "string",
      "pattern": "^[0-9]{1,5}[smhd]$",
      "description": "With auth none only: how long to reuse this request's last good answer before asking the public address again, from 1m to 24h, like \"6h\". Kept in memory only, for this address (with its own headers and format), never for a request with a secret. Whether or not keep is set, a failure there (an error status, an unreachable host, a wait, an answer too large or unreadable) never fails the source: the request answers with its last good answer from the past day, or its key is left out of the answer."
    },
    "requestAuthNone": {
      "type": "object",
      "properties": {
        "type": {
          "const": "none"
        }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false,
      "description": "This request reads a public https address with no sign-in: none of the source's secret, sign-in, token, headers or base go with it, and its own headers hold no Authorization, Proxy-Authorization, Cookie or Host. Its path is a full https URL, even in a source with a secret, and Page Info lists its host. A GET of one answer: no method, body, with, each_row, each_entry, all_entries or follow, and its answer can't give values to another request. Its failure never fails the source or makes the source wait (see keep)."
    },
    "requestOptional": {
      "type": "boolean",
      "default": false,
      "description": "Detail the cards can do without, such as changedetection.io's report of the week's changes, which a big install can take too long to answer. When it fails (an error status, no answer in time, an answer too large or unreadable), its name is left out of the answer and the source's other requests still fill the cards. A refused secret, a 403 or a request to wait still fails the source. Test it with exists: false. One request to the service: not with each_row, each_entry, all_entries, follow or auth none."
    },
    "requestMissing": {
      "type": "array",
      "minItems": 1,
      "maxItems": 2,
      "uniqueItems": true,
      "items": {
        "enum": [
          404,
          410
        ]
      },
      "description": "The statuses that mean nothing is there yet, such as changedetection.io's latest difference before a watch has changed: [404], [410] or both. An answer with one of them leaves this request's name out of the answer (test it with exists: false, or give the card empty) instead of failing the source. One request to the service: not with each_row, each_entry, all_entries, follow or auth none.",
      "examples": [
        [
          404
        ]
      ]
    },
    "requestObject": {
      "type": "object",
      "properties": {
        "method": {
          "enum": [
            "GET",
            "POST"
          ],
          "default": "GET"
        },
        "path": {
          "anyOf": [
            {
              "$ref": "#/definitions/relativeURL"
            },
            {
              "$ref": "#/definitions/httpsRequestURL"
            }
          ]
        },
        "body": {},
        "headers": {
          "$ref": "#/definitions/headers"
        },
        "format": {
          "enum": [
            "json",
            "text",
            "feed",
            "prometheus",
            "docker-logs"
          ],
          "default": "json",
          "description": "How the Mac reads the response body. docker-logs reads Docker frames or plain TTY text as { lines: [{ stream, time, text }], count }, keeping the last 200 lines and at most 500 characters per text, without ANSI colour codes. time is present only for a leading RFC 3339 timestamp. feed reads RSS, Atom or JSON Feed as { title, url, count, items: [{ title, url, published, author, summary, id }] }, published in ISO 8601 (UTC)."
        },
        "group_by": {
          "type": "string",
          "minLength": 1,
          "description": "For Prometheus, group samples by this label."
        },
        "split_by": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          },
          "description": "For Prometheus, append these label values to metric field names."
        },
        "each_entry": {
          "$ref": "#/definitions/eachEntry"
        },
        "all_entries": {
          "$ref": "#/definitions/allEntries"
        },
        "each_row": {
          "$ref": "#/definitions/eachRow"
        },
        "follow": {
          "$ref": "#/definitions/followPages"
        },
        "with": {
          "$ref": "#/definitions/requestWith"
        },
        "auth": {
          "$ref": "#/definitions/requestAuthNone"
        },
        "keep": {
          "$ref": "#/definitions/publicKeep"
        },
        "missing": {
          "$ref": "#/definitions/requestMissing"
        },
        "optional": {
          "$ref": "#/definitions/requestOptional"
        }
      },
      "required": [
        "path"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "group_by"
                ]
              },
              {
                "required": [
                  "split_by"
                ]
              }
            ]
          },
          "then": {
            "required": [
              "format"
            ],
            "properties": {
              "format": {
                "const": "prometheus"
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "missing"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "each_row"
                  ]
                },
                {
                  "required": [
                    "each_entry"
                  ]
                },
                {
                  "required": [
                    "all_entries"
                  ]
                },
                {
                  "required": [
                    "follow"
                  ]
                },
                {
                  "required": [
                    "auth"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "optional"
            ],
            "properties": {
              "optional": {
                "const": true
              }
            }
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "each_row"
                  ]
                },
                {
                  "required": [
                    "each_entry"
                  ]
                },
                {
                  "required": [
                    "all_entries"
                  ]
                },
                {
                  "required": [
                    "follow"
                  ]
                },
                {
                  "required": [
                    "auth"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "keep"
            ]
          },
          "then": {
            "required": [
              "auth"
            ]
          }
        },
        {
          "if": {
            "required": [
              "with"
            ]
          },
          "then": {
            "properties": {
              "path": {
                "allOf": [
                  {
                    "$ref": "#/definitions/relativeURL"
                  },
                  {
                    "not": {
                      "pattern": "#"
                    }
                  }
                ]
              },
              "headers": {
                "additionalProperties": {
                  "not": {
                    "pattern": "\\{[a-z][a-z0-9_]*\\}"
                  }
                }
              }
            },
            "not": {
              "anyOf": [
                {
                  "required": [
                    "each_row"
                  ]
                },
                {
                  "required": [
                    "each_entry"
                  ]
                },
                {
                  "required": [
                    "all_entries"
                  ]
                },
                {
                  "required": [
                    "auth"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "auth"
            ]
          },
          "then": {
            "properties": {
              "path": {
                "$ref": "#/definitions/httpsRequestURL"
              },
              "headers": {
                "propertyNames": {
                  "not": {
                    "pattern": "^(?:[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|[Pp][Rr][Oo][Xx][Yy]-[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|[Cc][Oo][Oo][Kk][Ii][Ee]|[Hh][Oo][Ss][Tt])$"
                  }
                },
                "additionalProperties": {
                  "not": {
                    "pattern": "[{}]"
                  }
                }
              }
            },
            "not": {
              "anyOf": [
                {
                  "required": [
                    "method"
                  ]
                },
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "each_row"
                  ]
                },
                {
                  "required": [
                    "each_entry"
                  ]
                },
                {
                  "required": [
                    "all_entries"
                  ]
                },
                {
                  "required": [
                    "follow"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "path"
            ],
            "properties": {
              "path": {
                "$ref": "#/definitions/httpsRequestURL"
              }
            }
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "method"
                  ]
                },
                {
                  "required": [
                    "body"
                  ]
                }
              ]
            }
          }
        },
        {
          "not": {
            "required": [
              "each_entry",
              "all_entries"
            ]
          }
        },
        {
          "not": {
            "anyOf": [
              {
                "required": [
                  "each_row",
                  "each_entry"
                ]
              },
              {
                "required": [
                  "each_row",
                  "all_entries"
                ]
              }
            ]
          }
        },
        {
          "if": {
            "required": [
              "follow"
            ]
          },
          "then": {
            "properties": {
              "method": {
                "const": "GET"
              },
              "format": {
                "const": "json"
              },
              "path": {
                "not": {
                  "pattern": "#"
                }
              }
            },
            "not": {
              "anyOf": [
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "each_row"
                  ]
                },
                {
                  "required": [
                    "each_entry"
                  ]
                },
                {
                  "required": [
                    "all_entries"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "each_row"
            ]
          },
          "then": {
            "properties": {
              "path": {
                "allOf": [
                  {
                    "$ref": "#/definitions/relativeURL"
                  },
                  {
                    "pattern": "\\{[A-Za-z_][A-Za-z0-9_.]*\\}"
                  }
                ]
              },
              "method": {
                "const": "GET"
              },
              "headers": {
                "additionalProperties": {
                  "not": {
                    "pattern": "[{}]"
                  }
                }
              }
            },
            "not": {
              "required": [
                "body"
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "each_entry"
            ]
          },
          "then": {
            "properties": {
              "path": {
                "pattern": "\\{entry\\}",
                "not": {
                  "pattern": "\\{entries\\}"
                }
              },
              "method": {
                "const": "GET"
              },
              "headers": {
                "additionalProperties": {
                  "not": {
                    "pattern": "\\{entr(?:y|ies)\\}"
                  }
                }
              }
            },
            "not": {
              "required": [
                "body"
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "all_entries"
            ]
          },
          "then": {
            "properties": {
              "path": {
                "pattern": "\\{entries\\}",
                "not": {
                  "pattern": "\\{entry\\}"
                }
              },
              "method": {
                "const": "GET"
              },
              "headers": {
                "additionalProperties": {
                  "not": {
                    "pattern": "\\{entr(?:y|ies)\\}"
                  }
                }
              }
            },
            "not": {
              "required": [
                "body"
              ]
            }
          }
        },
        {
          "if": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "each_entry"
                  ]
                },
                {
                  "required": [
                    "all_entries"
                  ]
                }
              ]
            }
          },
          "then": {
            "properties": {
              "path": {
                "not": {
                  "pattern": "\\{entr(?:y|ies)\\}"
                }
              },
              "headers": {
                "additionalProperties": {
                  "not": {
                    "pattern": "\\{entr(?:y|ies)\\}"
                  }
                }
              }
            }
          }
        }
      ]
    },
    "request": {
      "anyOf": [
        {
          "allOf": [
            {
              "$ref": "#/definitions/relativeURL"
            },
            {
              "not": {
                "pattern": "\\{entr(?:y|ies)\\}"
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/definitions/httpsRequestURL"
            },
            {
              "not": {
                "pattern": "\\{entr(?:y|ies)\\}"
              }
            }
          ]
        },
        {
          "$ref": "#/definitions/requestObject"
        }
      ],
      "description": "A same-origin path or full HTTPS URL (only without source secret/auth), or an object with path, headers and format; an object with auth none reads a full HTTPS URL in any source, unsigned. Full URLs cannot have method or body. With each_entry or all_entries, it sends the entries of a list in Settings → Lists; with each_row, it's sent once for each row of another request's answer; with follow, it's sent once for each page of a list; with with, it takes values from another request's answer."
    },
    "loginRequest": {
      "anyOf": [
        {
          "$ref": "#/definitions/relativeURL"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "enum": [
                "GET",
                "POST"
              ],
              "default": "POST"
            },
            "path": {
              "$ref": "#/definitions/relativeURL"
            },
            "body": {},
            "headers": {
              "$ref": "#/definitions/headers"
            },
            "format": {
              "enum": [
                "json",
                "text",
                "feed",
                "prometheus",
                "docker-logs"
              ],
              "default": "json",
              "description": "How the Mac reads the response body. docker-logs reads Docker frames or plain TTY text as { lines: [{ stream, time, text }], count }, keeping the last 200 lines and at most 500 characters per text, without ANSI colour codes. time is present only for a leading RFC 3339 timestamp. feed reads RSS, Atom or JSON Feed as { title, url, count, items: [{ title, url, published, author, summary, id }] }, published in ISO 8601 (UTC)."
            },
            "group_by": {
              "type": "string",
              "minLength": 1,
              "description": "For Prometheus, group samples by this label."
            },
            "split_by": {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "For Prometheus, append these label values to metric field names."
            }
          },
          "required": [],
          "additionalProperties": false
        }
      ],
      "description": "Sign-in request. POST by default; omitting path uses the source URL. {secret} in body strings or headers is replaced with the Keychain value. The response must be JSON."
    },
    "logoutRequest": {
      "anyOf": [
        {
          "$ref": "#/definitions/relativeURL"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "enum": [
                "DELETE",
                "POST",
                "GET"
              ],
              "default": "DELETE"
            },
            "path": {
              "$ref": "#/definitions/relativeURL"
            },
            "body": {},
            "headers": {
              "$ref": "#/definitions/headers"
            }
          },
          "required": [],
          "additionalProperties": false
        }
      ],
      "description": "Sign-out request, sent with the session token when Legato quits or the secret changes, so services that count sessions (Pi-hole) don't fill up. DELETE by default; omitting path uses the source URL."
    },
    "sendToken": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "header": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "header"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "query": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "query"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "bearer": {
              "const": true
            }
          },
          "required": [
            "bearer"
          ],
          "additionalProperties": false
        }
      ],
      "description": "How to send the returned login token. Omit for Authorization: Bearer."
    },
    "auth": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "none"
            }
          },
          "required": [
            "type"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "bearer"
            }
          },
          "required": [
            "type"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "basic"
            }
          },
          "required": [
            "type"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "header"
            },
            "name": {
              "type": "string",
              "minLength": 1
            },
            "value": {
              "type": "string",
              "maxLength": 200,
              "pattern": "^[^{}\\u0000-\\u001f\\u007f]*\\{secret\\}[^{}\\u0000-\\u001f\\u007f]*$",
              "description": "The header’s value, with {secret} exactly once where the secret goes and no other braces: MediaBrowser Token=\"{secret}\" for Jellyfin and Emby. Without it, the secret is sent as it is.",
              "examples": [
                "MediaBrowser Token=\"{secret}\""
              ]
            }
          },
          "required": [
            "type",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "query"
            },
            "name": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "type",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "login"
            },
            "request": {
              "$ref": "#/definitions/loginRequest"
            },
            "token": {
              "$ref": "#/definitions/path"
            },
            "send": {
              "$ref": "#/definitions/sendToken"
            },
            "logout": {
              "$ref": "#/definitions/logoutRequest"
            }
          },
          "required": [
            "type",
            "request",
            "token"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "const": "oauth_client"
            },
            "token_url": {
              "type": "string",
              "pattern": "^(?!.*\\.\\.)(?:/(?!/)|https?://[^/])[^ {}#\\u0000-\\u001f\\u007f]*$",
              "description": "The service’s token endpoint: a path on the source’s address (after base), or a full URL on the same origin. Another host is refused.",
              "examples": [
                "/api/v2/oauth/token"
              ]
            },
            "scope": {
              "type": "string",
              "maxLength": 200,
              "pattern": "^[^ {}\\u0000-\\u001f\\u007f](?:[^{}\\u0000-\\u001f\\u007f]*[^ {}\\u0000-\\u001f\\u007f])?$",
              "description": "Scopes to ask for, parted by spaces. Leave it out to get what the client was given."
            },
            "client_auth": {
              "enum": [
                "body",
                "basic"
              ],
              "default": "body",
              "description": "How the client goes to the token endpoint: in the form (body, the default), or as HTTP Basic (basic)."
            }
          },
          "required": [
            "type",
            "token_url"
          ],
          "additionalProperties": false,
          "description": "OAuth 2.0 client credentials. The source’s secret holds client-id:client-secret; Legato trades it for an access token, keeps it in memory, renews it before it runs out or on a 401, and sends it as Bearer."
        }
      ],
      "description": "Supported sign-in methods. Bearer is the default; use none for public APIs. Basic takes user:password or an API key as the password. A header can wrap the secret in words with value. Login reuses a returned session token. oauth_client signs in with an OAuth client’s ID and secret (client credentials). OAuth sign-in through a browser and refresh tokens are not supported.",
      "default": {
        "type": "bearer"
      }
    },
    "datasetName": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{0,63}$",
      "description": "A dataset’s name: 1–64 lowercase letters, digits and -, starting with a letter or digit."
    },
    "collect": {
      "type": "object",
      "properties": {
        "dataset": {
          "$ref": "#/definitions/datasetName"
        },
        "each": {
          "anyOf": [
            {
              "$ref": "#/definitions/path"
            },
            {
              "type": "array",
              "minItems": 2,
              "maxItems": 4,
              "items": {
                "$ref": "#/definitions/path"
              }
            }
          ],
          "description": "The list of items to keep, or 2 to 4 lists read in order: an item whose key comes up again later in the same answer is kept from where it first appears."
        },
        "key": {
          "allOf": [
            {
              "$ref": "#/definitions/template"
            },
            {
              "not": {
                "pattern": "\\{[ \\t]*param\\."
              },
              "description": "Can’t use {param.…}: a page with params shows one item at a time, so it can’t collect."
            },
            {
              "type": "string",
              "maxLength": 256,
              "pattern": "\\{"
            }
          ],
          "description": "What makes an item the same one next time, from its own text fields, like {carrier_code}:{tracking_number}. An item whose key is missing, blank or longer than 256 characters isn’t kept. Numbers aren’t keys."
        },
        "fields": {
          "anyOf": [
            {
              "type": "array",
              "minItems": 1,
              "maxItems": 64,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "pattern": "^[^.\\[\\]{}\\s\"]+(?:\\[\\])?(?:\\.[^.\\[\\]{}\\s\"]+(?:\\[\\])?)*$",
                "description": "A field to keep: dotted names, [] after a list for every item of it, like events[].date."
              }
            },
            {
              "type": "object",
              "minProperties": 1,
              "maxProperties": 16,
              "propertyNames": {
                "type": "string",
                "pattern": "^[a-z0-9_]{1,32}$"
              },
              "additionalProperties": {
                "$ref": "#/definitions/rule"
              }
            }
          ],
          "description": "The only fields kept of each item. Everything else in the answer is left out before anything is stored. With sample, an object of 1 to 16 names and the rules that fill them from the item (or a list of such names); a value is kept when it’s text of up to 256 characters, a number or true/false. A sample’s rules can’t use {param.…}, {period.…}, { \"answer\": … }, lookup, match or in_list."
        },
        "sample": {
          "type": "object",
          "properties": {
            "every": {
              "type": "string",
              "enum": [
                "1m",
                "2m",
                "3m",
                "4m",
                "5m",
                "6m",
                "10m",
                "12m",
                "15m",
                "20m",
                "30m",
                "60m",
                "1h"
              ],
              "default": "5m",
              "description": "The interval: minutes that divide an hour, 1m to 1h. Not shorter than the source’s every."
            }
          },
          "required": [],
          "additionalProperties": false,
          "description": "Keep one row per item per interval, timed by Legato’s clock, instead of a record per key: an answer later in the same interval replaces that interval’s row. For a monitor’s state and response time every 5 minutes. keep defaults to 365d; not with remove_after, date, time_zone, date_range, accepts_rows or keep.clock."
        },
        "remove_after": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 16,
          "propertyNames": {
            "type": "string",
            "pattern": "^[^.\\[\\]{}\\s\"]+(?:\\[\\])?(?:\\.[^.\\[\\]{}\\s\"]+(?:\\[\\])?)*$",
            "description": "A field to keep: dotted names, [] after a list for every item of it, like events[].date."
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "markers": {
                "type": "array",
                "minItems": 1,
                "maxItems": 16,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "description": "Literal text, case matters. The first marker in the field is kept and everything after it becomes “ [removed]”."
              },
              "keep_exact": {
                "type": "array",
                "maxItems": 32,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "description": "What may follow a marker and stay, matched whole: “Signature Not Req”."
              }
            },
            "required": [
              "markers"
            ],
            "additionalProperties": false
          },
          "description": "Text removed from a kept field after a marker, such as a name after “Received By:”, before it’s stored. It isn’t anonymization."
        },
        "date": {
          "allOf": [
            {
              "$ref": "#/definitions/rule"
            }
          ],
          "description": "Each kept item’s date, as the row’s date field: a rule read on the item as it’s kept (its fields after remove_after). A day, a wall time (filtered by its printed date) or a moment. An item without one is undated."
        },
        "time_zone": {
          "type": "string",
          "pattern": "^(?:UTC|[A-Za-z][A-Za-z0-9_+-]*(?:/[A-Za-z0-9_+-]+){1,2})$",
          "description": "The zone the service’s times without one are in, like America/Los_Angeles: they’re kept as moments. A time repeated when clocks go back is the first; one skipped when they go forward moves forward by the gap."
        },
        "date_range": {
          "type": "object",
          "properties": {
            "from": {
              "type": "string",
              "pattern": "^(?:[0-9]{4}-[0-9]{2}-[0-9]{2}|[+-][0-9]{1,4}[dy])$"
            },
            "to": {
              "type": "string",
              "pattern": "^(?:[0-9]{4}-[0-9]{2}-[0-9]{2}|[+-][0-9]{1,4}[dy])$"
            }
          },
          "required": [],
          "additionalProperties": false,
          "minProperties": 1,
          "description": "Dates kept as dates, inclusive: a day, or days or years from today like +1y. A date outside is kept undated."
        },
        "keep": {
          "type": "object",
          "properties": {
            "for": {
              "type": "string",
              "pattern": "^[1-9][0-9]{0,3}d$",
              "description": "How long a row is kept, in days: 1d to 9999d."
            },
            "clock": {
              "enum": [
                "date",
                "last_seen",
                "date_or_last_seen"
              ],
              "default": "date_or_last_seen",
              "description": "What a row’s age counts from: its date (last_seen when undated), the last answer it was in, or the later of the two."
            }
          },
          "required": [
            "for"
          ],
          "additionalProperties": false
        },
        "readers": {
          "type": "array",
          "maxItems": 32,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9 ._-]{0,127}$",
            "not": {
              "pattern": "\\.json$"
            }
          },
          "description": "The ids of the other pages that may read the dataset."
        },
        "accepts_rows": {
          "type": "boolean",
          "default": false,
          "description": "Rows may also be added from outside the page, with legato rows add or the MCP add_rows tool. They’re kept by this collect’s rules: its key, fields, remove_after and date."
        },
        "account": {
          "allOf": [
            {
              "$ref": "#/definitions/template"
            },
            {
              "not": {
                "pattern": "\\{[ \\t]*param\\."
              },
              "description": "Can’t use {param.…}: a page with params shows one item at a time, so it can’t collect."
            }
          ],
          "description": "Whose data this is, from the answer, like {vehicle.vin}: when it changes, the dataset starts a new history. Without it, the host alone; another secret for the same host pauses collection until Settings → History is told whose history it is. Only a fingerprint of the value is kept, never the value."
        }
      },
      "required": [
        "dataset",
        "each",
        "key",
        "fields"
      ],
      "additionalProperties": false,
      "dependencies": {
        "time_zone": [
          "date"
        ],
        "date_range": [
          "date"
        ]
      },
      "if": {
        "required": [
          "sample"
        ]
      },
      "then": {
        "not": {
          "anyOf": [
            {
              "required": [
                "remove_after"
              ]
            },
            {
              "required": [
                "date"
              ]
            },
            {
              "required": [
                "time_zone"
              ]
            },
            {
              "required": [
                "date_range"
              ]
            },
            {
              "required": [
                "accepts_rows"
              ]
            }
          ]
        },
        "properties": {
          "keep": {
            "not": {
              "required": [
                "clock"
              ]
            }
          }
        }
      },
      "else": {
        "required": [
          "keep"
        ],
        "properties": {
          "fields": {
            "type": "array"
          }
        }
      },
      "description": "Keeps a page’s history: the source’s items as rows on this Mac, in the dataset named here, for pages that read it with a dataset source. Settings → History shows, exports and deletes it. A version of Legato without History checks collect and keeps nothing."
    },
    "datasetSource": {
      "type": "object",
      "properties": {
        "dataset": {
          "$ref": "#/definitions/datasetName"
        },
        "key": {
          "type": "string",
          "maxLength": 256,
          "description": "One item’s rows: those whose key is this text, compared as text on both sides, like {param.id} on a page with params. A history of samples then reads that item’s samples. A key a link didn’t fill reads nothing."
        },
        "row": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 16,
          "propertyNames": {
            "type": "string",
            "pattern": "^[a-z0-9_]+$"
          },
          "additionalProperties": {
            "$ref": "#/definitions/rule"
          },
          "description": "What this page needs from each kept row, by name: each rule reads the row as the answer gives it (row.…, key, date, date_kind, time), and each row’s row then holds only these values. Every row is still read, so counts, sums and averages are unchanged; Legato keeps the values beside the rows, so a large history reads fast. Rules can’t read first_seen or last_seen, use { \"answer\": … }, lookup, {param.…} or {period.…}, be or contain a template (write templates in derive or the card’s map, reading these values), or use match.",
          "examples": [
            {
              "carrier": "row.carrier_code",
              "days": {
                "days_between": [
                  {
                    "date": {
                      "first": "date",
                      "of": "row.events",
                      "where": {
                        "path": "event",
                        "contains": "Accepted"
                      },
                      "sort": {
                        "by": "date",
                        "as": "date"
                      }
                    }
                  },
                  "date"
                ]
              }
            }
          ]
        },
        "derive": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[a-z0-9_]+$"
              },
              "value": {
                "$ref": "#/definitions/rule"
              }
            },
            "required": [
              "name",
              "value"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "dataset"
      ],
      "additionalProperties": false,
      "description": "A page’s history, the rows it keeps with collect, read on this Mac. The answer is kept: rows (each with key, date, date_kind, time for a wall time, first_seen, last_seen and row, the item as kept, or with row set, the values it names), selected_count, total_count, undated_count, epoch and coverage. On a page with a period, rows are those dated in it. A history of samples answers rows of key, at (the interval’s start, ISO 8601 UTC) and row, oldest first, with span (from, until) and sample (every): the last 24 hours of intervals without a period row, the period’s with one."
    },
    "httpSource": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "http",
          "description": "An HTTP API, the default. Leave kind out for HTTP sources."
        },
        "url": {
          "type": "string",
          "pattern": "^https?://[^\\s/]+(?:[^\\s]*)?$",
          "not": {
            "pattern": "\\{entr(?:y|ies)\\}"
          },
          "description": "The full request URL, or the origin/base address for named requests. Both internet and local-network HTTP APIs are supported. A single request’s path or query can carry {date.…} tokens, such as {date.month_start}.",
          "examples": [
            "https://api.github.com/repos/octocat/Hello-World"
          ]
        },
        "every": {
          "$ref": "#/definitions/interval"
        },
        "auth": {
          "$ref": "#/definitions/auth"
        },
        "secret": {
          "type": "string",
          "minLength": 1,
          "description": "Credential name in Settings → Secrets, bound to this source’s host. Never paste the credential itself into a page."
        },
        "secret_optional": {
          "type": "boolean",
          "description": "With true, requests go without signing in while no secret is saved for this host. For a key or password sent with each request, not a login."
        },
        "secret_expires": {
          "type": "string",
          "pattern": "^[a-z0-9_]+$",
          "not": {
            "const": "data"
          },
          "description": "A name for the expiry date saved with this source’s secret in Settings → Secrets (YYYY-MM-DD). It is added to the answer under this name before derive, and is absent when no date is saved. Read it with the expires rule in map or when, such as { \"expires\": { \"date\": \"token_expires\" }, \"as\": \"state\" }, so the days keep counting while the service doesn’t answer. Needs secret; not a request’s or a derived value’s name.",
          "examples": [
            "token_expires"
          ]
        },
        "method": {
          "enum": [
            "GET",
            "POST"
          ],
          "default": "GET"
        },
        "body": {},
        "headers": {
          "$ref": "#/definitions/headers"
        },
        "format": {
          "enum": [
            "json",
            "text",
            "feed",
            "prometheus",
            "docker-logs"
          ],
          "default": "json",
          "description": "How the Mac reads the response body. docker-logs reads Docker frames or plain TTY text as { lines: [{ stream, time, text }], count }, keeping the last 200 lines and at most 500 characters per text, without ANSI colour codes. time is present only for a leading RFC 3339 timestamp. feed reads RSS, Atom or JSON Feed as { title, url, count, items: [{ title, url, published, author, summary, id }] }, published in ISO 8601 (UTC)."
        },
        "group_by": {
          "type": "string",
          "minLength": 1,
          "description": "For Prometheus, group samples by this label."
        },
        "split_by": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          },
          "description": "For Prometheus, append these label values to metric field names."
        },
        "base": {
          "type": "string",
          "pattern": "^/(?!.*(?:[?#]|(?:\\.|%2[eE]){2})).*$",
          "description": "A path prefix such as /sonarr for requests, actions, login and row image paths. Trailing slashes are removed. Full HTTPS URLs are unchanged."
        },
        "requests": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 8,
          "propertyNames": {
            "type": "string",
            "pattern": "^[a-z0-9_]+$"
          },
          "additionalProperties": {
            "$ref": "#/definitions/request"
          },
          "description": "Up to 8 named requests, combined as {name: answer}. Paths use the source origin; full HTTPS URLs may read another host when the source has no secret and no auth, or with auth none on the request, which sends nothing of the source's sign-in or headers. A request with each_entry or all_entries sends the entries of a list in Settings → Lists; one with each_row is sent for each row of another request's answer, after the others; one with follow is sent once for each page of a list, its pages joined; one with with takes values from another request's answer, after the others."
        },
        "derive": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[a-z0-9_]+$"
              },
              "value": {
                "$ref": "#/definitions/rule"
              }
            },
            "required": [
              "name",
              "value"
            ],
            "additionalProperties": false
          },
          "description": "Derived fields evaluated in order, once per shared fetch. Later rules can read earlier fields."
        },
        "fail": {
          "type": "object",
          "properties": {
            "when": {
              "allOf": [
                {
                  "$ref": "#/definitions/condition"
                }
              ],
              "description": "Checked on the answer after derive. A tested path with nothing there (or null) never holds, so { \"path\": \"errors[0].message\", \"not\": null } passes every answer without errors. all and any combine tests."
            },
            "message": {
              "allOf": [
                {
                  "$ref": "#/definitions/rule"
                }
              ],
              "description": "The service’s reason, shown as \"<host> reported an error: …\" (one line, up to 200 characters). Without it, or when it gives nothing, \"<host> reported an error\"."
            }
          },
          "required": [
            "when"
          ],
          "additionalProperties": false,
          "description": "When an answer the service sent (often HTTP 200) counts as a failure all the same: a GraphQL errors list, success: false. The fetch then fails like a refused request: cards keep their last answer with the note, polling backs off, a status card’s failed counts it, and History keeps nothing from it. Not the card’s failed, which says what a status card shows after several failures.",
          "examples": [
            {
              "when": {
                "path": "errors[0].message",
                "not": null
              },
              "message": "errors[0].message"
            }
          ]
        },
        "collect": {
          "$ref": "#/definitions/collect"
        }
      },
      "required": [
        "url"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "group_by"
                ]
              },
              {
                "required": [
                  "split_by"
                ]
              }
            ]
          },
          "then": {
            "required": [
              "format"
            ],
            "properties": {
              "format": {
                "const": "prometheus"
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "requests"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "method"
                  ]
                },
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "format"
                  ]
                },
                {
                  "required": [
                    "group_by"
                  ]
                },
                {
                  "required": [
                    "split_by"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "auth"
            ],
            "properties": {
              "auth": {
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "const": "oauth_client"
                  }
                }
              }
            }
          },
          "then": {
            "required": [
              "secret"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "secret"
                ]
              },
              {
                "required": [
                  "auth"
                ]
              }
            ]
          },
          "then": {
            "properties": {
              "requests": {
                "additionalProperties": {
                  "anyOf": [
                    {
                      "$ref": "#/definitions/relativeURL"
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/definitions/requestObject"
                        },
                        {
                          "properties": {
                            "path": {
                              "$ref": "#/definitions/relativeURL"
                            }
                          }
                        }
                      ]
                    },
                    {
                      "allOf": [
                        {
                          "$ref": "#/definitions/requestObject"
                        },
                        {
                          "required": [
                            "auth"
                          ]
                        }
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      ],
      "description": "A shared HTTP source: one connection, authentication configuration and polling interval for every card that references it.",
      "dependencies": {
        "secret_expires": [
          "secret"
        ]
      }
    },
    "hostsSource": {
      "type": "object",
      "properties": {
        "hosts": {
          "type": "object",
          "properties": {
            "list": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
              "description": "A list in Settings → Lists. Each entry is an address: a host name, read over https (www.githubstatus.com), or an origin with its scheme and an optional port (https://status.example.com:8443, http://192.168.1.20:61208). Plain http goes only to an IPv4 address, a .local name or a single word. Entries that aren’t one, and those past max, get a row saying they weren’t read."
            },
            "max": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30,
              "description": "How many hosts are read: the first ones on the list that can be. Not needed with only."
            },
            "only": {
              "type": "string",
              "pattern": "^(?:\\{param\\.[a-z][a-z0-9_]*\\}|h[0-9a-f]{16})$",
              "description": "One host: {param.name} of a list_key param naming this list (or one row key). The source reads that host alone, as an ordinary source on its address, while the list holds it, and answers as that source does. Buttons on its cards go to that host."
            }
          },
          "required": [
            "list"
          ],
          "additionalProperties": false,
          "description": "Read every host on a list: each host is asked the same named requests as a source of its own, with its own derive and fail, at most four hosts at a time. The answer is hosts, one row per entry in the list’s order: entry, origin, key (the same for the same address), host, state (answered, failed, not_sent or over_budget), fails (failed reads in a row), answer (that host’s derived answer, or a failed host’s last one), last_success (on a failed row) and error. One host failing fails only its row. A host list has no headers of its own.",
          "examples": [
            {
              "list": "status-pages",
              "max": 30
            }
          ]
        },
        "every": {
          "$ref": "#/definitions/interval"
        },
        "secret": {
          "type": "string",
          "minLength": 1,
          "description": "Credential name in Settings → Secrets, saved once for each host: each host gets the one saved for it."
        },
        "secret_optional": {
          "type": "boolean",
          "description": "With true, a host with no secret saved goes without signing in."
        },
        "auth": {
          "allOf": [
            {
              "$ref": "#/definitions/auth"
            }
          ],
          "description": "How each host is sent its secret: basic, bearer, header or query. Never a login or OAuth client."
        },
        "requests": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 6,
          "propertyNames": {
            "type": "string",
            "pattern": "^[a-z0-9_]+$"
          },
          "additionalProperties": {
            "anyOf": [
              {
                "$ref": "#/definitions/relativeURL"
              },
              {
                "type": "object",
                "properties": {
                  "path": {
                    "$ref": "#/definitions/relativeURL"
                  }
                },
                "required": [
                  "path"
                ],
                "additionalProperties": false
              }
            ]
          },
          "description": "Up to 6 named GET requests, each a path read on every host, combined for each host as {name: answer}. max × requests is at most 180."
        },
        "derive": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[a-z0-9_]+$"
              },
              "value": {
                "$ref": "#/definitions/rule"
              }
            },
            "required": [
              "name",
              "value"
            ],
            "additionalProperties": false
          },
          "description": "Derived fields worked out on each host’s answer, in order. With derive, a host’s row keeps only these, under answer; derive what the cards need."
        },
        "fail": {
          "allOf": [
            {
              "type": "object",
              "properties": {
                "when": {
                  "allOf": [
                    {
                      "$ref": "#/definitions/condition"
                    }
                  ],
                  "description": "Checked on the answer after derive. A tested path with nothing there (or null) never holds, so { \"path\": \"errors[0].message\", \"not\": null } passes every answer without errors. all and any combine tests."
                },
                "message": {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rule"
                    }
                  ],
                  "description": "The service’s reason, shown as \"<host> reported an error: …\" (one line, up to 200 characters). Without it, or when it gives nothing, \"<host> reported an error\"."
                }
              },
              "required": [
                "when"
              ],
              "additionalProperties": false,
              "description": "When an answer the service sent (often HTTP 200) counts as a failure all the same: a GraphQL errors list, success: false. The fetch then fails like a refused request: cards keep their last answer with the note, polling backs off, a status card’s failed counts it, and History keeps nothing from it. Not the card’s failed, which says what a status card shows after several failures.",
              "examples": [
                {
                  "when": {
                    "path": "errors[0].message",
                    "not": null
                  },
                  "message": "errors[0].message"
                }
              ]
            }
          ],
          "description": "When a host’s answer counts as that host failing: its row is failed, with the reason as its error."
        }
      },
      "required": [
        "hosts",
        "requests"
      ],
      "additionalProperties": false,
      "description": "Every host on a list in Settings → Lists, one row each, or with only, one host on it. Map a fleet with { \"each\": \"hosts\", … }. A card reading a whole list can’t have buttons, and title_from can’t read one; with only, both can."
    },
    "feedsSource": {
      "type": "object",
      "properties": {
        "feeds": {
          "type": "object",
          "properties": {
            "list": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,47}$",
              "description": "A list in Settings → Lists. Each entry is a feed’s whole address, such as https://example.com/feed.xml or example.com/blog/rss?lang=en (https when no scheme is given). Plain http goes only to an IPv4 address, a .local name or a single word; a public http:// entry gets a row saying to use its https:// address. Entries that aren’t one, and those past max, get a row saying they weren’t read."
            },
            "max": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30,
              "description": "How many feeds are read: the first ones on the list that can be. Not needed with only."
            },
            "only": {
              "type": "string",
              "pattern": "^(?:\\{param\\.[a-z][a-z0-9_]*\\}|h[0-9a-f]{16})$",
              "description": "One feed: {param.name} of a list_key param naming this list (or one row key). The source reads that feed alone while the list holds it, and answers as a format: feed source does (title, url, count and items with summaries), its items newest first. title_from can read it."
            }
          },
          "required": [
            "list"
          ],
          "additionalProperties": false,
          "description": "Read every feed on a list, RSS, Atom or JSON Feed, with no sign-in, at most four at a time. The answer is feeds, one row per entry in the list’s order (entry, url, key, host, state, fails, last_success, error, and answer: the feed’s title, url and its newest 50 items without summaries), and items: every feed’s items in one list, newest first (undated last, a future date as now), up to 200, each with title, url, published, author, id, feed (the feed’s title, or its host) and feed_key (its row’s key); and count. One feed failing fails only its row, keeping its last items. A redirect to another address fails the row: put the new address in the list.",
          "examples": [
            {
              "list": "feeds",
              "max": 30
            }
          ]
        },
        "every": {
          "$ref": "#/definitions/interval"
        }
      },
      "required": [
        "feeds"
      ],
      "additionalProperties": false,
      "description": "Every feed on a list in Settings → Lists, or with only, one feed on it. Map the posts with { \"each\": \"items\", … } and the feeds with { \"each\": \"feeds\", … }. Cards reading a feed list can’t have buttons, title_from can’t read a whole list, and it can’t collect."
    },
    "calendarSource": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "calendar",
          "description": "This Mac’s calendars, read through EventKit. Nothing leaves the Mac. The first read asks for Calendar access from the card."
        },
        "window": {
          "type": "string",
          "pattern": "^(?:[1-7]d|(?:[1-9]|[1-9][0-9]|1[0-5][0-9]|16[0-8])h|month)$",
          "default": "2d",
          "description": "How far ahead to look: hours or days, from 1h to 7d. Or month, for a month card: the six weeks it shows, from the week of the 1st.",
          "examples": [
            "12h",
            "2d",
            "7d",
            "month"
          ]
        },
        "calendars": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "items": {
            "type": "string",
            "minLength": 1
          },
          "description": "Calendar names to include, as Calendar shows them. Omit for every calendar."
        },
        "every": {
          "allOf": [
            {
              "$ref": "#/definitions/interval"
            }
          ],
          "description": "A safety refresh. The source also refreshes when a calendar changes, when an event starts or ends, at midnight and when the time zone changes."
        },
        "derive": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[a-z0-9_]+$"
              },
              "value": {
                "$ref": "#/definitions/rule"
              }
            },
            "required": [
              "name",
              "value"
            ],
            "additionalProperties": false
          },
          "description": "Derived fields evaluated in order, once per shared fetch. Later rules can read earlier fields."
        }
      },
      "required": [
        "kind"
      ],
      "additionalProperties": false,
      "description": "The answer has up (the meeting under way, else the next one: title, at, detail, join, has_join), next, current, today, events, agenda (every event on the window’s whole days, past ones included: map an agenda’s or month’s items from it), today_count, agenda_count, busy_minutes_today, busy_today and empty. See the local pages guide."
    },
    "remindersSource": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "reminders",
          "description": "This Mac’s reminders, read through EventKit. Nothing leaves the Mac. The first read asks for Reminders access from the card."
        },
        "show": {
          "enum": [
            "overdue",
            "today",
            "overdue+today",
            "dashboard",
            "all"
          ],
          "default": "overdue+today",
          "description": "Which reminders: overdue, due today, or both (in items). dashboard answers due, upcoming, undated, lists and completed for an overview; all answers every open reminder in items, for a list’s page. A reminder due on a date is overdue from the next day, one due at a time from that time."
        },
        "lists": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "items": {
            "type": "string",
            "minLength": 1
          },
          "description": "Reminders list names to include, as Reminders shows them. Omit for every list."
        },
        "list_ids": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "items": {
            "type": "string",
            "minLength": 1
          },
          "description": "Reminders lists to include by id (a lists row’s id), for a list’s page: \"list_ids\": [\"{param.list}\"]. With show dashboard or all; not with lists."
        },
        "days": {
          "type": "integer",
          "minimum": 1,
          "maximum": 31,
          "default": 7,
          "description": "With show dashboard: how many days after today upcoming reaches."
        },
        "completed_days": {
          "type": "integer",
          "minimum": 1,
          "maximum": 31,
          "default": 7,
          "description": "With show dashboard: how many days completed and by_day cover, today included."
        },
        "every": {
          "allOf": [
            {
              "$ref": "#/definitions/interval"
            }
          ],
          "description": "A safety refresh. The source also refreshes when a reminder changes, when a timed reminder falls due, at midnight and when the time zone changes."
        },
        "derive": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[a-z0-9_]+$"
              },
              "value": {
                "$ref": "#/definitions/rule"
              }
            },
            "required": [
              "name",
              "value"
            ],
            "additionalProperties": false
          },
          "description": "Derived fields evaluated in order, once per shared fetch. Later rules can read earlier fields."
        }
      },
      "required": [
        "kind"
      ],
      "additionalProperties": false,
      "description": "The answer has items (each with id, title, line, due, due_date, all_day, time, when, due_text, list, color, overdue, today, priority, notes, url and done, always false), count, overdue_count, today_count and empty. Only incomplete reminders with a due date are read, except with show dashboard (due, upcoming, undated, lists, completed, by_day and their counts) or all (items of every open reminder, list_title); their rows add list_id, group, day, info, info_short, repeats and priority_mark. Sections, tags, flags and subtasks aren’t available to apps. See the local pages guide."
    },
    "rowsSource": {
      "type": "object",
      "properties": {
        "collect": {
          "allOf": [
            {
              "$ref": "#/definitions/collect"
            },
            {
              "required": [
                "accepts_rows"
              ],
              "properties": {
                "accepts_rows": {
                  "const": true
                }
              }
            }
          ]
        }
      },
      "required": [
        "collect"
      ],
      "additionalProperties": false,
      "description": "A page’s history with no service to fetch from: rows come only from outside, added with legato rows add (an agent or a script, such as a Health export). collect needs accepts_rows true. Read it with a dataset source."
    },
    "source": {
      "if": {
        "required": [
          "feeds"
        ]
      },
      "then": {
        "$ref": "#/definitions/feedsSource"
      },
      "else": {
        "if": {
          "required": [
            "hosts"
          ]
        },
        "then": {
          "$ref": "#/definitions/hostsSource"
        },
        "else": {
          "if": {
            "required": [
              "dataset"
            ]
          },
          "then": {
            "$ref": "#/definitions/datasetSource"
          },
          "else": {
            "if": {
              "required": [
                "collect"
              ],
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "url"
                    ]
                  },
                  {
                    "required": [
                      "kind"
                    ]
                  }
                ]
              }
            },
            "then": {
              "$ref": "#/definitions/rowsSource"
            },
            "else": {
              "if": {
                "properties": {
                  "kind": {
                    "const": "calendar"
                  }
                },
                "required": [
                  "kind"
                ]
              },
              "then": {
                "$ref": "#/definitions/calendarSource"
              },
              "else": {
                "if": {
                  "properties": {
                    "kind": {
                      "const": "reminders"
                    }
                  },
                  "required": [
                    "kind"
                  ]
                },
                "then": {
                  "$ref": "#/definitions/remindersSource"
                },
                "else": {
                  "$ref": "#/definitions/httpSource"
                }
              }
            }
          }
        }
      },
      "description": "A shared source: an HTTP API (the default); with kind calendar or reminders, this Mac’s calendars or reminders; with dataset, rows a page keeps on this Mac; with hosts, every host on a list; or, with feeds, every feed on a list."
    },
    "historyRule": {
      "type": "object",
      "properties": {
        "history": {
          "$ref": "#/definitions/rule"
        },
        "every": {
          "$ref": "#/definitions/interval",
          "default": "1d",
          "description": "One reading per period, at least 1m; a later reading in the same period replaces it. Days start at midnight on the Mac."
        },
        "keep": {
          "type": "integer",
          "minimum": 2,
          "maximum": 60,
          "default": 60,
          "description": "How many readings to keep, the newest."
        }
      },
      "required": [
        "history"
      ],
      "additionalProperties": false,
      "description": "A sparkline’s points from readings this Mac records: each time the source answers, the history rule’s number is kept, one per every, the newest keep of them, oldest first. For a value the service only reports as it is now. The card says it is collecting readings until there are two."
    },
    "historyOfRule": {
      "type": "object",
      "properties": {
        "history_of": {
          "type": "string",
          "pattern": "^(?!.*\\.json#)[A-Za-z0-9][A-Za-z0-9 ._-]{0,127}#[a-z0-9][a-z0-9_-]{0,63}\\.points$",
          "description": "Another page’s history rule, as page#card.field: net-worth#trend.points."
        },
        "every": {
          "$ref": "#/definitions/interval",
          "default": "1d",
          "description": "How far apart that history’s readings are, for the chart’s labels."
        },
        "keep": {
          "type": "integer",
          "minimum": 2,
          "maximum": 60,
          "default": 60,
          "description": "How many of its newest readings to show."
        }
      },
      "required": [
        "history_of"
      ],
      "additionalProperties": false,
      "description": "The readings another card keeps with a history rule, shown here as they are and never recorded again: a home page’s chart of the net worth its own page keeps. The card waits until that history has two readings.",
      "examples": [
        {
          "history_of": "net-worth#trend.points"
        }
      ]
    },
    "map": {
      "type": "object",
      "propertyNames": {
        "$ref": "#/definitions/fieldPath"
      },
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/definitions/rule"
          },
          {
            "$ref": "#/definitions/historyRule"
          },
          {
            "$ref": "#/definitions/historyOfRule"
          }
        ]
      },
      "description": "Map card fields to values from the shared response. Final field types and required values are checked when the page renders. Each card type says which fields take a history rule: a sparkline’s points."
    },
    "cardSource": {
      "type": "object",
      "properties": {
        "ref": {
          "type": "string",
          "pattern": "^[a-z0-9_-]+$",
          "description": "The name of a source in this page’s sources object."
        },
        "map": {
          "$ref": "#/definitions/map"
        },
        "empty": {
          "type": "object",
          "properties": {
            "when": {
              "$ref": "#/definitions/condition"
            },
            "text": {
              "allOf": [
                {
                  "$ref": "#/definitions/template"
                }
              ],
              "type": "string",
              "minLength": 1,
              "maxLength": 280
            }
          },
          "required": [
            "when",
            "text"
          ],
          "additionalProperties": false,
          "description": "When when holds in the answer, the card shows text (a template) under its own label, and its buttons are hidden (Add Event buttons stay), instead of a card the answer can’t fill. For example nothing in the calendar, or no open pull requests."
        },
        "when": {
          "$ref": "#/definitions/condition",
          "description": "Show the card only while this holds in the source’s answer (its derived values, before map). A card whose content is written out needs only when, no map. False hides the card: it doesn’t light the page or notify, a heading whose section shows nothing hides too, and a page left with nothing says so. When the answer has nothing at a path it tests, the card shows, with a note. After a failed fetch the last answer decides, and the source keeps polling while the card is hidden."
        },
        "loading": {
          "enum": [
            "placeholder",
            "keep"
          ],
          "default": "placeholder",
          "description": "On a page whose param selects: while a pick is on its way and this card reads something it changes, placeholder draws its last shape in grey and keep draws it as it was (a list whose length follows the pane beside it)."
        },
        "failed": {
          "type": "object",
          "properties": {
            "state": {
              "enum": [
                "warning",
                "critical",
                "unknown"
              ],
              "default": "critical"
            },
            "detail": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120,
              "description": "What the card says, such as \"Proxmox isn’t answering\". Without it, \"Not answering since 2:14 PM\"."
            },
            "after": {
              "type": "integer",
              "minimum": 2,
              "maximum": 10,
              "default": 3,
              "description": "Failed fetches in a row before the card changes."
            }
          },
          "required": [],
          "additionalProperties": false,
          "description": "Only on a status or fleet card. Once the source has failed after times in a row, the card shows this state and detail instead of its last answer (a fleet shows one dot, named by its label, in place of its items), lights the page and notifies; the next answer puts it back."
        }
      },
      "required": [
        "ref"
      ],
      "additionalProperties": false,
      "if": {
        "required": [
          "map"
        ],
        "properties": {
          "map": {
            "maxProperties": 0
          }
        }
      },
      "then": {
        "required": [
          "when"
        ]
      }
    },
    "toggleValue": {
      "anyOf": [
        {
          "type": [
            "string",
            "boolean"
          ]
        },
        {
          "type": "number",
          "if": {
            "type": "integer"
          },
          "then": {
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number",
                "if": {
                  "type": "integer"
                },
                "then": {
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              }
            ]
          }
        }
      ]
    },
    "httpAction": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "http",
          "description": "Calls the source’s host, the default. Leave kind out for these."
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 24
        },
        "icon": {
          "type": "string",
          "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}|(?:(?:si|di|mdi):)?\\{param\\.[a-z][a-z0-9_]*\\})$",
          "maxLength": 64,
          "description": "An SF Symbol name, or a logo (si:, di:, mdi:, site:). A page with params can take it from one: {param.icon}, or si:{param.brand}."
        },
        "method": {
          "enum": [
            "POST",
            "PUT",
            "PATCH",
            "DELETE",
            "GET"
          ],
          "default": "POST"
        },
        "path": {
          "$ref": "#/definitions/relativeURL"
        },
        "body": {},
        "headers": {
          "$ref": "#/definitions/headers"
        },
        "when": {
          "$ref": "#/definitions/condition"
        },
        "success": {
          "$ref": "#/definitions/condition"
        },
        "error": {
          "$ref": "#/definitions/path"
        },
        "completion": {
          "type": "object",
          "properties": {
            "path": {
              "$ref": "#/definitions/relativeURL"
            },
            "done": {
              "$ref": "#/definitions/condition"
            },
            "success": {
              "$ref": "#/definitions/condition"
            },
            "timeout": {
              "type": "integer",
              "minimum": 1,
              "maximum": 3600
            },
            "interval": {
              "type": "integer",
              "minimum": 1,
              "maximum": 60
            }
          },
          "required": [
            "path",
            "done",
            "success"
          ],
          "additionalProperties": false
        },
        "timeout": {
          "type": "integer",
          "minimum": 60,
          "maximum": 1800,
          "default": 60,
          "description": "How long the button’s request may take, in seconds. For a service that works only while the request stays open, such as Ollama’s pull with stream false. A button with more than 60 is pressed only in the panel: Spotlight, Shortcuts and notifications don’t offer it."
        },
        "form_style": {
          "enum": [
            "page",
            "card"
          ],
          "default": "page",
          "description": "With inputs: where the form opens. page (the default) puts it in the page’s place; card slides it in over the page, under the title row’s right end as Page Info’s card does, so the page stays in view, its fields grouped as System Settings groups them. For a short edit of what the page shows, such as one transaction. Escape puts the form away without sending it; so does a click elsewhere in the panel while nothing has changed, and that click goes on to what it was on, such as the next row. With changes, a click elsewhere leaves the form open. Closing the panel (another app, the menu bar icon) keeps the form, as it keeps the form in the page’s place."
        },
        "show_label": {
          "type": "boolean",
          "default": false,
          "description": "true: in a card's corner, the button shows its label beside its icon (\"Block domain\") in a plain bordered button, rather than its icon alone with the label in a tooltip. For a change whose icon alone wouldn't say enough."
        },
        "offer": {
          "type": "boolean",
          "default": true,
          "description": "false keeps the button in the panel: Spotlight, Shortcuts and notifications never offer it. For a press that changes many things at once, such as accepting every suggestion on a list, where the panel shows what it acts on. It doesn't ask first by itself: add confirm for that."
        },
        "prominent": {
          "type": "boolean",
          "default": false,
          "description": "Draw the button filled in the accent colour: for the one that matters most right now, such as Stop climate while the climate runs."
        },
        "choices": {
          "anyOf": [
            {
              "type": "array",
              "minItems": 2,
              "maxItems": 12,
              "items": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  },
                  "value": {
                    "type": [
                      "string",
                      "number"
                    ]
                  }
                },
                "required": [
                  "label",
                  "value"
                ],
                "additionalProperties": false
              }
            },
            {
              "allOf": [
                {
                  "$ref": "#/definitions/rule"
                },
                {
                  "type": "object",
                  "required": [
                    "each",
                    "fields"
                  ],
                  "properties": {
                    "fields": {
                      "type": "object",
                      "required": [
                        "label",
                        "value"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "label": {
                          "$ref": "#/definitions/rule"
                        },
                        "value": {
                          "$ref": "#/definitions/rule"
                        }
                      }
                    }
                  }
                }
              ],
              "description": "A menu made from the source’s answer: one choice per element of each, its label and value from fields, such as the models an Ollama server has installed: { \"each\": \"tags.models\", \"fields\": { \"label\": \"name\", \"value\": \"name\" } }. Up to 24 choices, in the answer’s order, labels cut to 24 characters. Pressed by value, so a list that changes between drawing and pressing never sends another choice. With nothing to choose, the button is dimmed. Stays in the panel: Spotlight, Shortcuts and notifications don’t offer it."
            }
          ],
          "description": "Make the button a menu of values, such as cabin temperatures: picking one fills {choice} in the path, body or headers with its value (which must appear in one of them) and sends the request. In a body, a string that is \"{choice}\" alone takes the value as it is, so a number stays a number. Spotlight and Shortcuts list each choice as its own button, \"<label>: <choice>\". Not with confirm. Prefer a menu to a row of preset buttons (70%, 80%, 90%): titled with the current value, the control also says how things are set."
        },
        "current": {
          "$ref": "#/definitions/path",
          "description": "With choices: where the source’s answer holds the value now. The choice with that value is ticked and titles the menu, such as 70°F; without a match (such as a car’s defrost running the cabin at its highest) the menu shows the button’s icon, or its label when it has no icon."
        },
        "confirm": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160,
                  "description": "The question, such as \"Restart pve-lab? Every guest stops first.\" Without it the panel asks the label with a question mark."
                },
                "button": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 24,
                  "description": "The button that runs it, such as Restart. Without it, the button’s own label."
                },
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 40,
                  "description": "Text to type before the button runs, such as the host’s name, for a press that’s hard to undo."
                }
              },
              "required": [],
              "additionalProperties": false
            }
          ],
          "description": "Ask in the panel before the request goes out: true for \"<label>?\", or an object with message, button and type. Spotlight still presses it directly; Shortcuts asks with message; it never goes on a notification."
        },
        "inputs": {
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "items": {
            "allOf": [
              {
                "allOf": [
                  {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "pattern": "^[A-Za-z][A-Za-z0-9_]{0,31}$",
                        "description": "{input.<name>} fills it in the path, body or headers."
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 24
                      },
                      "kind": {
                        "enum": [
                          "text",
                          "choice",
                          "toggle"
                        ],
                        "default": "text",
                        "description": "text: a one-line field. choice: one of choices, as chips (up to 6), a menu, or past 24 a filter over a list. toggle: an on/off switch that sends on_value or off_value, in the body only."
                      },
                      "start": {
                        "$ref": "#/definitions/rule",
                        "description": "What the field opens on, read from the row (a row’s button) or the card’s answer, such as \"payee\", so an edit form shows what’s there now. A toggle opens on when the value is its on_value or true; a choice on the choice with that value; several picks on the values of a list."
                      },
                      "multiple": {
                        "type": "boolean",
                        "default": false,
                        "description": "A choice that takes several of its choices, as checkboxes, sent as a list in the list’s order, such as tags: \"tag_ids\": \"{input.tags}\". Its starting picks come from start. Not with default, guess or suggest."
                      },
                      "lines": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 8,
                        "default": 1,
                        "description": "A text field that runs over lines, as notes do, growing to this many before it scrolls. Line breaks are sent as typed."
                      },
                      "on_value": {
                        "$ref": "#/definitions/toggleValue",
                        "description": "A toggle’s value when it’s on, true unless set, such as a tag’s id in a list, [77], for \"additional_tag_ids\": \"{input.remember}\"."
                      },
                      "off_value": {
                        "$ref": "#/definitions/toggleValue",
                        "description": "A toggle’s value when it’s off: false unless set, except that with an on_value and no off_value the body leaves the key out."
                      },
                      "required": {
                        "type": "boolean",
                        "default": false
                      },
                      "placeholder": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40,
                        "description": "Grey text in an empty field."
                      },
                      "hint": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40,
                        "description": "The line under the field, where a problem shows instead."
                      },
                      "invalid": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "description": "With pattern: what a value that misses it is told."
                      },
                      "max": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 200,
                        "default": 100,
                        "description": "A text input’s longest value, after spaces and case."
                      },
                      "pattern": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200,
                        "description": "A regular expression the whole cleaned value must match. A text input needs one to go in the path."
                      },
                      "spaces": {
                        "enum": [
                          "keep",
                          "remove"
                        ],
                        "default": "keep",
                        "description": "remove takes every space out, as a pasted tracking number needs."
                      },
                      "case": {
                        "enum": [
                          "keep",
                          "upper",
                          "lower"
                        ],
                        "default": "keep"
                      },
                      "default": {
                        "type": [
                          "string",
                          "number",
                          "boolean"
                        ],
                        "description": "A toggle’s starting state (true or false), a text input’s starting text, or a choice’s value. With one on every required input, Shortcuts can press the button without its form."
                      },
                      "choices": {
                        "anyOf": [
                          {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 24,
                            "items": {
                              "type": "object",
                              "properties": {
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 24
                                },
                                "value": {
                                  "type": [
                                    "string",
                                    "number"
                                  ]
                                },
                                "icon": {
                                  "type": "string",
                                  "minLength": 1,
                                  "description": "An SF Symbol or a logo (si:ups), drawn before the label."
                                }
                              },
                              "required": [
                                "label",
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          },
                          {
                            "allOf": [
                              {
                                "$ref": "#/definitions/rule"
                              },
                              {
                                "type": "object",
                                "required": [
                                  "each",
                                  "fields"
                                ],
                                "properties": {
                                  "fields": {
                                    "type": "object",
                                    "required": [
                                      "label",
                                      "value"
                                    ],
                                    "additionalProperties": false,
                                    "properties": {
                                      "label": {
                                        "$ref": "#/definitions/rule"
                                      },
                                      "value": {
                                        "$ref": "#/definitions/rule"
                                      },
                                      "group": {
                                        "$ref": "#/definitions/rule"
                                      }
                                    }
                                  }
                                }
                              }
                            ],
                            "description": "Choices made from the card’s answer, read when the form opens and again when it’s sent, such as a budget’s categories: { \"each\": \"cats.categories\", \"where\": …, \"fields\": { \"label\": \"name\", \"value\": \"id\", \"group\": \"group_name\" } }. Up to 500, in the answer’s order, under their group in the menu; labels cut to 40 characters. A value that has left the list by the time the form is sent is refused. Not with default or guess."
                          }
                        ]
                      },
                      "suggest": {
                        "allOf": [
                          {
                            "$ref": "#/definitions/rule"
                          },
                          {
                            "type": "object",
                            "required": [
                              "each",
                              "fields"
                            ],
                            "properties": {
                              "fields": {
                                "type": "object",
                                "required": [
                                  "value"
                                ],
                                "additionalProperties": false,
                                "properties": {
                                  "value": {
                                    "$ref": "#/definitions/rule"
                                  }
                                }
                              }
                            }
                          }
                        ],
                        "description": "On a row’s button (row_actions), with choices: the row’s suggested values, shown first as chips, the first one picked when the form opens, such as an agent’s suggested categories: { \"each\": \"custom_metadata.legato.choices\", \"fields\": { \"value\": \"category_id\" } }. Only values also on the input’s list count, at most 6, labelled as the list labels them."
                      },
                      "guess": {
                        "type": "object",
                        "properties": {
                          "from": {
                            "type": "string",
                            "description": "The text input whose value is matched."
                          },
                          "rules": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 24,
                            "items": {
                              "type": "object",
                              "properties": {
                                "pattern": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "value": {
                                  "type": [
                                    "string",
                                    "number"
                                  ]
                                }
                              },
                              "required": [
                                "pattern",
                                "value"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "from",
                          "rules"
                        ],
                        "additionalProperties": false,
                        "description": "A choice input picked from a text input as it’s typed, until it’s picked by hand: the first rule whose pattern matches all of the text."
                      }
                    },
                    "required": [
                      "name",
                      "label"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "if": {
                      "required": [
                        "suggest"
                      ]
                    },
                    "then": {
                      "required": [
                        "kind",
                        "choices"
                      ],
                      "properties": {
                        "kind": {
                          "const": "choice"
                        }
                      }
                    }
                  },
                  {
                    "if": {
                      "required": [
                        "choices"
                      ],
                      "properties": {
                        "choices": {
                          "type": "object"
                        }
                      }
                    },
                    "then": {
                      "required": [
                        "kind",
                        "choices"
                      ],
                      "properties": {
                        "kind": {
                          "const": "choice"
                        }
                      },
                      "not": {
                        "anyOf": [
                          {
                            "required": [
                              "default"
                            ]
                          },
                          {
                            "required": [
                              "guess"
                            ]
                          }
                        ]
                      }
                    }
                  },
                  {
                    "if": {
                      "required": [
                        "kind"
                      ],
                      "properties": {
                        "kind": {
                          "const": "toggle"
                        }
                      }
                    },
                    "then": {
                      "properties": {
                        "default": {
                          "type": "boolean"
                        },
                        "required": {
                          "const": false
                        }
                      },
                      "not": {
                        "anyOf": [
                          {
                            "required": [
                              "choices"
                            ]
                          },
                          {
                            "required": [
                              "guess"
                            ]
                          },
                          {
                            "required": [
                              "suggest"
                            ]
                          },
                          {
                            "required": [
                              "max"
                            ]
                          },
                          {
                            "required": [
                              "pattern"
                            ]
                          },
                          {
                            "required": [
                              "invalid"
                            ]
                          },
                          {
                            "required": [
                              "spaces"
                            ]
                          },
                          {
                            "required": [
                              "case"
                            ]
                          },
                          {
                            "required": [
                              "placeholder"
                            ]
                          }
                        ]
                      }
                    },
                    "else": {
                      "properties": {
                        "default": {
                          "type": [
                            "string",
                            "number"
                          ]
                        }
                      },
                      "not": {
                        "anyOf": [
                          {
                            "required": [
                              "on_value"
                            ]
                          },
                          {
                            "required": [
                              "off_value"
                            ]
                          }
                        ]
                      }
                    }
                  }
                ]
              },
              {
                "not": {
                  "required": [
                    "suggest"
                  ]
                }
              }
            ]
          },
          "description": "Ask for what to send: a press opens a form in the page’s place, and its own button (submit) sends the request with {input.<name>} filled. Typed text fills the body as JSON values; it goes in the path only with a pattern (percent-encoded) and never in a header. A body string that is \"{input.x}\" alone keeps a choice’s type, and leaves its key out when an optional field is empty. Spotlight opens the form; Shortcuts presses it only when every required input has a default; it never goes on a notification. Not with choices or confirm."
        },
        "submit": {
          "type": "string",
          "minLength": 1,
          "maxLength": 24,
          "description": "With inputs: the form’s run button. Default Add."
        },
        "send": {
          "enum": [
            "all",
            "changed"
          ],
          "default": "all",
          "description": "With inputs: changed sends only the fields that differ from what the form opened on (each input’s start), leaving the others’ keys out, so an edit never writes back a value nobody touched; a field emptied on purpose goes as empty text, null or an empty list. Save waits for a change. Use all for a request that replaces the whole thing, such as a list of servers."
        },
        "rule": {
          "type": "object",
          "properties": {
            "when": {
              "$ref": "#/definitions/condition",
              "description": "The condition on the source’s answer (derived values included) that presses the button, such as {\"path\": \"age\", \"gte\": 12}."
            },
            "every": {
              "type": "string",
              "pattern": "^[0-9]+(\\.[0-9]+)?[smhd]$",
              "description": "The least time between two presses by the rule, at least 15m, such as 6h. A press that didn’t go through waits as long before the next."
            }
          },
          "required": [
            "when",
            "every"
          ],
          "additionalProperties": false,
          "description": "Legato presses the button itself: each time the card’s source answers, while when holds on the answer (and the button’s own when, if it has one), at most once every every. It goes as a click does, with the same checks, while the page runs; nothing runs while the Mac sleeps or Legato isn’t open. Page Info lists the page’s rules with when each last ran and how it went. For upkeep a person would otherwise press, such as asking a bank to sync when its last sync is 12 hours old. Not with confirm, inputs or choices, and not on a row’s button or a checklist’s itemAction."
        },
        "setting": {
          "type": "string",
          "minLength": 1,
          "maxLength": 24,
          "pattern": "^[^{}]*\\S[^{}]*$",
          "description": "On a card with actions_placement rows: the row this button is, named so (\"Sentry\"). A menu is its setting's row alone; an on/off pair of buttons sharing one setting, each with turns, is a switch, on while the one that turns it off is the one shown."
        },
        "turns": {
          "enum": [
            "on",
            "off"
          ],
          "description": "With setting, on a switch's button: which way it turns the setting. Give the pair whens that never hold together."
        },
        "shown": {
          "type": "boolean",
          "default": true,
          "description": "false, with a rule: the button isn’t drawn on the card or offered to Spotlight, Shortcuts or notifications; only its rule presses it."
        },
        "graphql": {
          "type": "object",
          "properties": {
            "query": {
              "type": "string",
              "minLength": 1,
              "maxLength": 20000,
              "pattern": "\\S",
              "description": "The GraphQL document, sent exactly as written: its braces are GraphQL’s, never filled. Pass values in variables and use them as $name."
            },
            "variables": {
              "type": "object",
              "description": "Filled like a body in this kind of button ({answer.…}, {choice}, {input.…}, {action.id}, a row’s fields): a string that is one placeholder alone keeps its type."
            }
          },
          "required": [
            "query"
          ],
          "additionalProperties": false,
          "description": "Send a GraphQL request in place of body: {\"query\": …, \"variables\": …} as POST to path. Any errors in the answer fail the press, even beside data, and Legato doesn’t send it again (except once after signing in again, on a source with a sign-in request that answered 401). Not with body or completion."
        },
        "body_from": {
          "const": "row",
          "description": "Only on a checklist’s itemAction: the tick sends the row’s element as the service sent it (before lookup, nothing Legato added, nulls kept), with body’s top-level fields laid over it, for an API whose PUT replaces the whole item, such as Mealie’s shopping items: \"body_from\": \"row\", \"body\": {\"checked\": true}. Nothing copied from the row is read for placeholders. map.items’ each must read a request’s answer, not a derived value, without entries, zip, flatten or group. Up to 256 KB. Not with graphql or form."
        },
        "form": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 20,
          "propertyNames": {
            "minLength": 1
          },
          "additionalProperties": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          },
          "description": "Send the request as a form (application/x-www-form-urlencoded) in place of a JSON body, for services whose commands read only a form, such as qBittorrent: {\"hashes\": \"{hash}\"}. Its values are filled like a body’s; each goes as text, a number as its digits and true or false as words. Fields go in name order, and an empty optional {input.…} leaves its field out. A form request never follows a redirect. Not with body or graphql, and not with DELETE."
        }
      },
      "required": [
        "label",
        "path"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "required": [
              "graphql"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "completion"
                  ]
                }
              ]
            },
            "properties": {
              "method": {
                "const": "POST"
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "form"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "graphql"
                  ]
                }
              ]
            },
            "properties": {
              "method": {
                "not": {
                  "const": "DELETE"
                }
              },
              "inputs": {
                "items": {
                  "not": {
                    "required": [
                      "kind"
                    ],
                    "properties": {
                      "kind": {
                        "const": "toggle"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "body_from"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "graphql"
                  ]
                },
                {
                  "required": [
                    "form"
                  ]
                }
              ]
            },
            "properties": {
              "method": {
                "enum": [
                  "PUT",
                  "PATCH",
                  "POST"
                ]
              },
              "body": {
                "type": "object"
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "method"
            ],
            "properties": {
              "method": {
                "const": "GET"
              }
            }
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "form"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "form_style"
            ]
          },
          "then": {
            "required": [
              "inputs"
            ]
          }
        },
        {
          "if": {
            "required": [
              "send"
            ]
          },
          "then": {
            "required": [
              "inputs"
            ]
          }
        },
        {
          "if": {
            "required": [
              "rule"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "confirm"
                  ]
                },
                {
                  "required": [
                    "inputs"
                  ]
                },
                {
                  "required": [
                    "choices"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "shown"
            ],
            "properties": {
              "shown": {
                "const": false
              }
            }
          },
          "then": {
            "required": [
              "rule"
            ]
          }
        }
      ],
      "description": "A button using its card’s source and sign-in. when tests current source data; success tests the command response. error selects a response message when the command fails. Calls run only when clicked."
    },
    "openAction": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "open"
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 24
        },
        "icon": {
          "type": "string",
          "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}|(?:(?:si|di|mdi):)?\\{param\\.[a-z][a-z0-9_]*\\})$",
          "maxLength": 64,
          "description": "An SF Symbol name, or a logo (si:, di:, mdi:, site:). A page with params can take it from one: {param.icon}, or si:{param.brand}."
        },
        "url": {
          "allOf": [
            {
              "$ref": "#/definitions/template"
            }
          ],
          "type": "string",
          "minLength": 1,
          "description": "A template filled from the source’s answer (or a checklist row), such as {up.join}. Only https addresses open. With inputs: a link to one of your pages, legato://page/<id>?<name>={input.<name>}, each {input.…} a whole query value."
        },
        "when": {
          "$ref": "#/definitions/condition"
        },
        "prominent": {
          "type": "boolean",
          "default": false,
          "description": "Draw the button filled in the accent colour: for the one that matters most right now, such as Stop climate while the climate runs."
        },
        "inputs": {
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "items": {
            "allOf": [
              {
                "allOf": [
                  {
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^[A-Za-z][A-Za-z0-9_]{0,31}$",
                            "description": "{input.<name>} fills it in the path, body or headers."
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 24
                          },
                          "kind": {
                            "enum": [
                              "text",
                              "choice",
                              "toggle"
                            ],
                            "default": "text",
                            "description": "text: a one-line field. choice: one of choices, as chips (up to 6), a menu, or past 24 a filter over a list. toggle: an on/off switch that sends on_value or off_value, in the body only."
                          },
                          "start": {
                            "$ref": "#/definitions/rule",
                            "description": "What the field opens on, read from the row (a row’s button) or the card’s answer, such as \"payee\", so an edit form shows what’s there now. A toggle opens on when the value is its on_value or true; a choice on the choice with that value; several picks on the values of a list."
                          },
                          "multiple": {
                            "type": "boolean",
                            "default": false,
                            "description": "A choice that takes several of its choices, as checkboxes, sent as a list in the list’s order, such as tags: \"tag_ids\": \"{input.tags}\". Its starting picks come from start. Not with default, guess or suggest."
                          },
                          "lines": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 8,
                            "default": 1,
                            "description": "A text field that runs over lines, as notes do, growing to this many before it scrolls. Line breaks are sent as typed."
                          },
                          "on_value": {
                            "$ref": "#/definitions/toggleValue",
                            "description": "A toggle’s value when it’s on, true unless set, such as a tag’s id in a list, [77], for \"additional_tag_ids\": \"{input.remember}\"."
                          },
                          "off_value": {
                            "$ref": "#/definitions/toggleValue",
                            "description": "A toggle’s value when it’s off: false unless set, except that with an on_value and no off_value the body leaves the key out."
                          },
                          "required": {
                            "type": "boolean",
                            "default": false
                          },
                          "placeholder": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40,
                            "description": "Grey text in an empty field."
                          },
                          "hint": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40,
                            "description": "The line under the field, where a problem shows instead."
                          },
                          "invalid": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "description": "With pattern: what a value that misses it is told."
                          },
                          "max": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 200,
                            "default": 100,
                            "description": "A text input’s longest value, after spaces and case."
                          },
                          "pattern": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200,
                            "description": "A regular expression the whole cleaned value must match. A text input needs one to go in the path."
                          },
                          "spaces": {
                            "enum": [
                              "keep",
                              "remove"
                            ],
                            "default": "keep",
                            "description": "remove takes every space out, as a pasted tracking number needs."
                          },
                          "case": {
                            "enum": [
                              "keep",
                              "upper",
                              "lower"
                            ],
                            "default": "keep"
                          },
                          "default": {
                            "type": [
                              "string",
                              "number",
                              "boolean"
                            ],
                            "description": "A toggle’s starting state (true or false), a text input’s starting text, or a choice’s value. With one on every required input, Shortcuts can press the button without its form."
                          },
                          "choices": {
                            "anyOf": [
                              {
                                "type": "array",
                                "minItems": 2,
                                "maxItems": 24,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "label": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 24
                                    },
                                    "value": {
                                      "type": [
                                        "string",
                                        "number"
                                      ]
                                    },
                                    "icon": {
                                      "type": "string",
                                      "minLength": 1,
                                      "description": "An SF Symbol or a logo (si:ups), drawn before the label."
                                    }
                                  },
                                  "required": [
                                    "label",
                                    "value"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              {
                                "allOf": [
                                  {
                                    "$ref": "#/definitions/rule"
                                  },
                                  {
                                    "type": "object",
                                    "required": [
                                      "each",
                                      "fields"
                                    ],
                                    "properties": {
                                      "fields": {
                                        "type": "object",
                                        "required": [
                                          "label",
                                          "value"
                                        ],
                                        "additionalProperties": false,
                                        "properties": {
                                          "label": {
                                            "$ref": "#/definitions/rule"
                                          },
                                          "value": {
                                            "$ref": "#/definitions/rule"
                                          },
                                          "group": {
                                            "$ref": "#/definitions/rule"
                                          }
                                        }
                                      }
                                    }
                                  }
                                ],
                                "description": "Choices made from the card’s answer, read when the form opens and again when it’s sent, such as a budget’s categories: { \"each\": \"cats.categories\", \"where\": …, \"fields\": { \"label\": \"name\", \"value\": \"id\", \"group\": \"group_name\" } }. Up to 500, in the answer’s order, under their group in the menu; labels cut to 40 characters. A value that has left the list by the time the form is sent is refused. Not with default or guess."
                              }
                            ]
                          },
                          "suggest": {
                            "allOf": [
                              {
                                "$ref": "#/definitions/rule"
                              },
                              {
                                "type": "object",
                                "required": [
                                  "each",
                                  "fields"
                                ],
                                "properties": {
                                  "fields": {
                                    "type": "object",
                                    "required": [
                                      "value"
                                    ],
                                    "additionalProperties": false,
                                    "properties": {
                                      "value": {
                                        "$ref": "#/definitions/rule"
                                      }
                                    }
                                  }
                                }
                              }
                            ],
                            "description": "On a row’s button (row_actions), with choices: the row’s suggested values, shown first as chips, the first one picked when the form opens, such as an agent’s suggested categories: { \"each\": \"custom_metadata.legato.choices\", \"fields\": { \"value\": \"category_id\" } }. Only values also on the input’s list count, at most 6, labelled as the list labels them."
                          },
                          "guess": {
                            "type": "object",
                            "properties": {
                              "from": {
                                "type": "string",
                                "description": "The text input whose value is matched."
                              },
                              "rules": {
                                "type": "array",
                                "minItems": 1,
                                "maxItems": 24,
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "pattern": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    },
                                    "value": {
                                      "type": [
                                        "string",
                                        "number"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "pattern",
                                    "value"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "from",
                              "rules"
                            ],
                            "additionalProperties": false,
                            "description": "A choice input picked from a text input as it’s typed, until it’s picked by hand: the first rule whose pattern matches all of the text."
                          }
                        },
                        "required": [
                          "name",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "if": {
                          "required": [
                            "suggest"
                          ]
                        },
                        "then": {
                          "required": [
                            "kind",
                            "choices"
                          ],
                          "properties": {
                            "kind": {
                              "const": "choice"
                            }
                          }
                        }
                      },
                      {
                        "if": {
                          "required": [
                            "choices"
                          ],
                          "properties": {
                            "choices": {
                              "type": "object"
                            }
                          }
                        },
                        "then": {
                          "required": [
                            "kind",
                            "choices"
                          ],
                          "properties": {
                            "kind": {
                              "const": "choice"
                            }
                          },
                          "not": {
                            "anyOf": [
                              {
                                "required": [
                                  "default"
                                ]
                              },
                              {
                                "required": [
                                  "guess"
                                ]
                              }
                            ]
                          }
                        }
                      },
                      {
                        "if": {
                          "required": [
                            "kind"
                          ],
                          "properties": {
                            "kind": {
                              "const": "toggle"
                            }
                          }
                        },
                        "then": {
                          "properties": {
                            "default": {
                              "type": "boolean"
                            },
                            "required": {
                              "const": false
                            }
                          },
                          "not": {
                            "anyOf": [
                              {
                                "required": [
                                  "choices"
                                ]
                              },
                              {
                                "required": [
                                  "guess"
                                ]
                              },
                              {
                                "required": [
                                  "suggest"
                                ]
                              },
                              {
                                "required": [
                                  "max"
                                ]
                              },
                              {
                                "required": [
                                  "pattern"
                                ]
                              },
                              {
                                "required": [
                                  "invalid"
                                ]
                              },
                              {
                                "required": [
                                  "spaces"
                                ]
                              },
                              {
                                "required": [
                                  "case"
                                ]
                              },
                              {
                                "required": [
                                  "placeholder"
                                ]
                              }
                            ]
                          }
                        },
                        "else": {
                          "properties": {
                            "default": {
                              "type": [
                                "string",
                                "number"
                              ]
                            }
                          },
                          "not": {
                            "anyOf": [
                              {
                                "required": [
                                  "on_value"
                                ]
                              },
                              {
                                "required": [
                                  "off_value"
                                ]
                              }
                            ]
                          }
                        }
                      }
                    ]
                  },
                  {
                    "not": {
                      "required": [
                        "suggest"
                      ]
                    }
                  }
                ]
              },
              {
                "not": {
                  "required": [
                    "kind"
                  ],
                  "properties": {
                    "kind": {
                      "const": "toggle"
                    }
                  }
                }
              }
            ]
          },
          "description": "A form that opens one of your pages with what was typed, such as a search: the press opens the form, and its button (submit) shows the page url names, legato://page/paperless-search?q={input.q}, with each value percent-encoded into the link. Every input is required. The page takes the values as params (type query for search text). Spotlight opens the form; Shortcuts presses it only when every input has a default; it never goes on a notification."
        },
        "submit": {
          "type": "string",
          "minLength": 1,
          "maxLength": 24,
          "description": "With inputs: the form’s run button. Default Add."
        },
        "form_style": {
          "enum": [
            "page",
            "card"
          ],
          "default": "page",
          "description": "With inputs: where the form opens. page (the default) puts it in the page’s place; card slides it in over the page, under the title row’s right end as Page Info’s card does, so the page stays in view, its fields grouped as System Settings groups them. For a short edit of what the page shows, such as one transaction. Escape puts the form away without sending it; so does a click elsewhere in the panel while nothing has changed, and that click goes on to what it was on, such as the next row. With changes, a click elsewhere leaves the form open. Closing the panel (another app, the menu bar icon) keeps the form, as it keeps the form in the page’s place."
        }
      },
      "required": [
        "kind",
        "label",
        "url"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "required": [
              "form_style"
            ]
          },
          "then": {
            "required": [
              "inputs"
            ]
          }
        }
      ],
      "description": "A button that opens an https address from the source’s answer, such as a meeting’s join link, or, with inputs, a form that opens one of your pages with what was typed. It sends nothing to the source."
    },
    "addEventAction": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "add-event"
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 24
        },
        "icon": {
          "type": "string",
          "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}|(?:(?:si|di|mdi):)?\\{param\\.[a-z][a-z0-9_]*\\})$",
          "maxLength": 64,
          "description": "An SF Symbol name, or a logo (si:, di:, mdi:, site:). A page with params can take it from one: {param.icon}, or si:{param.brand}."
        },
        "title": {
          "allOf": [
            {
              "$ref": "#/definitions/template"
            }
          ],
          "type": "string",
          "minLength": 1,
          "maxLength": 80,
          "description": "The title the form starts with, a template filled from the source’s answer, or plain text. Omit for a blank form."
        },
        "duration": {
          "type": "string",
          "pattern": "^(?:[1-9][0-9]*m|[1-9][0-9]*h)$",
          "default": "1h",
          "description": "How long the event the form starts with lasts, from 5m to 12h.",
          "examples": [
            "30m",
            "1h"
          ]
        },
        "calendar": {
          "type": "string",
          "minLength": 1,
          "description": "The calendar to add it to, by the name Calendar shows. Omit for the default calendar for new events."
        },
        "when": {
          "$ref": "#/definitions/condition"
        },
        "prominent": {
          "type": "boolean",
          "default": false,
          "description": "Draw the button filled in the accent colour: for the one that matters most right now, such as Stop climate while the climate runs."
        }
      },
      "required": [
        "kind",
        "label"
      ],
      "additionalProperties": false,
      "description": "A button that opens a New Event form in the panel, starting now and filled in from title, duration (default 1h) and calendar; the person can change any detail before adding it. From Shortcuts it adds the event as set. Only on a card whose source is a calendar source; it stays on the card when the card has nothing to show."
    },
    "action": {
      "if": {
        "properties": {
          "kind": {
            "const": "open"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "#/definitions/openAction"
      },
      "else": {
        "if": {
          "properties": {
            "kind": {
              "const": "add-event"
            }
          },
          "required": [
            "kind"
          ]
        },
        "then": {
          "$ref": "#/definitions/addEventAction"
        },
        "else": {
          "$ref": "#/definitions/httpAction"
        }
      }
    },
    "completeReminderAction": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "complete-reminder"
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 24
        },
        "icon": {
          "type": "string",
          "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}|(?:(?:si|di|mdi):)?\\{param\\.[a-z][a-z0-9_]*\\})$",
          "maxLength": 64,
          "description": "An SF Symbol name, or a logo (si:, di:, mdi:, site:). A page with params can take it from one: {param.icon}, or si:{param.brand}."
        },
        "id": {
          "allOf": [
            {
              "$ref": "#/definitions/template"
            }
          ],
          "type": "string",
          "minLength": 1,
          "default": "{id}",
          "description": "The reminder’s id, a template filled from the ticked row. The reminders source gives every row an id, so leave this out."
        },
        "when": {
          "$ref": "#/definitions/condition"
        },
        "prominent": {
          "type": "boolean",
          "default": false,
          "description": "Draw the button filled in the accent colour: for the one that matters most right now, such as Stop climate while the climate runs."
        }
      },
      "required": [
        "kind",
        "label"
      ],
      "additionalProperties": false,
      "description": "Marks the ticked row’s reminder done in Reminders. Only as the itemAction of a checklist on a reminders source."
    },
    "itemAction": {
      "if": {
        "properties": {
          "kind": {
            "const": "complete-reminder"
          }
        },
        "required": [
          "kind"
        ]
      },
      "then": {
        "$ref": "#/definitions/completeReminderAction"
      },
      "else": {
        "if": {
          "properties": {
            "kind": {
              "const": "add-event"
            }
          },
          "required": [
            "kind"
          ]
        },
        "then": false,
        "else": {
          "allOf": [
            {
              "$ref": "#/definitions/action"
            },
            {
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "confirm"
                    ]
                  },
                  {
                    "required": [
                      "completion"
                    ]
                  },
                  {
                    "required": [
                      "inputs"
                    ]
                  },
                  {
                    "required": [
                      "form_style"
                    ]
                  },
                  {
                    "required": [
                      "rule"
                    ]
                  },
                  {
                    "required": [
                      "setting"
                    ]
                  },
                  {
                    "required": [
                      "turns"
                    ]
                  },
                  {
                    "required": [
                      "shown"
                    ]
                  }
                ]
              }
            }
          ]
        }
      },
      "description": "One action for every row of a sourced checklist, run when a row that isn’t done is ticked. Its path, body strings and headers are templates filled from that row of the map’s each rule, such as /api/v1/tasks/{id}/close; when tests the row. On a reminders source, kind complete-reminder checks the reminder off. The checklist needs a source whose items rule uses each."
    },
    "rowAction": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "http",
          "description": "Calls the source’s host, the default. Leave kind out for these."
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 24,
          "pattern": "^[^{}]*$",
          "description": "Its own words, without placeholders: the row already says which."
        },
        "icon": {
          "type": "string",
          "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,}|(?:(?:si|di|mdi):)?\\{param\\.[a-z][a-z0-9_]*\\})$",
          "maxLength": 64,
          "description": "The SF Symbol the row draws, such as stop.fill; the label is its tooltip and what VoiceOver says."
        },
        "method": {
          "enum": [
            "POST",
            "PUT",
            "PATCH",
            "DELETE",
            "GET"
          ],
          "default": "POST"
        },
        "path": {
          "$ref": "#/definitions/relativeURL"
        },
        "body": {},
        "when": {
          "$ref": "#/definitions/condition"
        },
        "success": {
          "$ref": "#/definitions/condition"
        },
        "error": {
          "$ref": "#/definitions/path"
        },
        "completion": {
          "type": "object",
          "properties": {
            "path": {
              "$ref": "#/definitions/relativeURL"
            },
            "done": {
              "$ref": "#/definitions/condition"
            },
            "success": {
              "$ref": "#/definitions/condition"
            },
            "timeout": {
              "type": "integer",
              "minimum": 1,
              "maximum": 3600
            },
            "interval": {
              "type": "integer",
              "minimum": 1,
              "maximum": 60
            }
          },
          "required": [
            "path",
            "done",
            "success"
          ],
          "additionalProperties": false
        },
        "timeout": {
          "type": "integer",
          "minimum": 60,
          "maximum": 1800,
          "default": 60,
          "description": "How long the button’s request may take, in seconds. For a service that works only while the request stays open, such as Ollama’s pull with stream false. A button with more than 60 is pressed only in the panel: Spotlight, Shortcuts and notifications don’t offer it."
        },
        "form_style": {
          "enum": [
            "page",
            "card"
          ],
          "default": "page",
          "description": "With inputs: where the form opens. page (the default) puts it in the page’s place; card slides it in over the page, under the title row’s right end as Page Info’s card does, so the page stays in view, its fields grouped as System Settings groups them. For a short edit of what the page shows, such as one transaction. Escape puts the form away without sending it; so does a click elsewhere in the panel while nothing has changed, and that click goes on to what it was on, such as the next row. With changes, a click elsewhere leaves the form open. Closing the panel (another app, the menu bar icon) keeps the form, as it keeps the form in the page’s place."
        },
        "show_label": {
          "type": "boolean",
          "default": false,
          "description": "true: in a card's corner, the button shows its label beside its icon (\"Block domain\") in a plain bordered button, rather than its icon alone with the label in a tooltip. For a change whose icon alone wouldn't say enough."
        },
        "offer": {
          "type": "boolean",
          "default": true,
          "description": "false keeps the button in the panel: Spotlight, Shortcuts and notifications never offer it. For a press that changes many things at once, such as accepting every suggestion on a list, where the panel shows what it acts on. It doesn't ask first by itself: add confirm for that."
        },
        "inputs": {
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "items": {
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9_]{0,31}$",
                    "description": "{input.<name>} fills it in the path, body or headers."
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  },
                  "kind": {
                    "enum": [
                      "text",
                      "choice",
                      "toggle"
                    ],
                    "default": "text",
                    "description": "text: a one-line field. choice: one of choices, as chips (up to 6), a menu, or past 24 a filter over a list. toggle: an on/off switch that sends on_value or off_value, in the body only."
                  },
                  "start": {
                    "$ref": "#/definitions/rule",
                    "description": "What the field opens on, read from the row (a row’s button) or the card’s answer, such as \"payee\", so an edit form shows what’s there now. A toggle opens on when the value is its on_value or true; a choice on the choice with that value; several picks on the values of a list."
                  },
                  "multiple": {
                    "type": "boolean",
                    "default": false,
                    "description": "A choice that takes several of its choices, as checkboxes, sent as a list in the list’s order, such as tags: \"tag_ids\": \"{input.tags}\". Its starting picks come from start. Not with default, guess or suggest."
                  },
                  "lines": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 8,
                    "default": 1,
                    "description": "A text field that runs over lines, as notes do, growing to this many before it scrolls. Line breaks are sent as typed."
                  },
                  "on_value": {
                    "$ref": "#/definitions/toggleValue",
                    "description": "A toggle’s value when it’s on, true unless set, such as a tag’s id in a list, [77], for \"additional_tag_ids\": \"{input.remember}\"."
                  },
                  "off_value": {
                    "$ref": "#/definitions/toggleValue",
                    "description": "A toggle’s value when it’s off: false unless set, except that with an on_value and no off_value the body leaves the key out."
                  },
                  "required": {
                    "type": "boolean",
                    "default": false
                  },
                  "placeholder": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "description": "Grey text in an empty field."
                  },
                  "hint": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "description": "The line under the field, where a problem shows instead."
                  },
                  "invalid": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "With pattern: what a value that misses it is told."
                  },
                  "max": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "default": 100,
                    "description": "A text input’s longest value, after spaces and case."
                  },
                  "pattern": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "A regular expression the whole cleaned value must match. A text input needs one to go in the path."
                  },
                  "spaces": {
                    "enum": [
                      "keep",
                      "remove"
                    ],
                    "default": "keep",
                    "description": "remove takes every space out, as a pasted tracking number needs."
                  },
                  "case": {
                    "enum": [
                      "keep",
                      "upper",
                      "lower"
                    ],
                    "default": "keep"
                  },
                  "default": {
                    "type": [
                      "string",
                      "number",
                      "boolean"
                    ],
                    "description": "A toggle’s starting state (true or false), a text input’s starting text, or a choice’s value. With one on every required input, Shortcuts can press the button without its form."
                  },
                  "choices": {
                    "anyOf": [
                      {
                        "type": "array",
                        "minItems": 2,
                        "maxItems": 24,
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 24
                            },
                            "value": {
                              "type": [
                                "string",
                                "number"
                              ]
                            },
                            "icon": {
                              "type": "string",
                              "minLength": 1,
                              "description": "An SF Symbol or a logo (si:ups), drawn before the label."
                            }
                          },
                          "required": [
                            "label",
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      },
                      {
                        "allOf": [
                          {
                            "$ref": "#/definitions/rule"
                          },
                          {
                            "type": "object",
                            "required": [
                              "each",
                              "fields"
                            ],
                            "properties": {
                              "fields": {
                                "type": "object",
                                "required": [
                                  "label",
                                  "value"
                                ],
                                "additionalProperties": false,
                                "properties": {
                                  "label": {
                                    "$ref": "#/definitions/rule"
                                  },
                                  "value": {
                                    "$ref": "#/definitions/rule"
                                  },
                                  "group": {
                                    "$ref": "#/definitions/rule"
                                  }
                                }
                              }
                            }
                          }
                        ],
                        "description": "Choices made from the card’s answer, read when the form opens and again when it’s sent, such as a budget’s categories: { \"each\": \"cats.categories\", \"where\": …, \"fields\": { \"label\": \"name\", \"value\": \"id\", \"group\": \"group_name\" } }. Up to 500, in the answer’s order, under their group in the menu; labels cut to 40 characters. A value that has left the list by the time the form is sent is refused. Not with default or guess."
                      }
                    ]
                  },
                  "suggest": {
                    "allOf": [
                      {
                        "$ref": "#/definitions/rule"
                      },
                      {
                        "type": "object",
                        "required": [
                          "each",
                          "fields"
                        ],
                        "properties": {
                          "fields": {
                            "type": "object",
                            "required": [
                              "value"
                            ],
                            "additionalProperties": false,
                            "properties": {
                              "value": {
                                "$ref": "#/definitions/rule"
                              }
                            }
                          }
                        }
                      }
                    ],
                    "description": "On a row’s button (row_actions), with choices: the row’s suggested values, shown first as chips, the first one picked when the form opens, such as an agent’s suggested categories: { \"each\": \"custom_metadata.legato.choices\", \"fields\": { \"value\": \"category_id\" } }. Only values also on the input’s list count, at most 6, labelled as the list labels them."
                  },
                  "guess": {
                    "type": "object",
                    "properties": {
                      "from": {
                        "type": "string",
                        "description": "The text input whose value is matched."
                      },
                      "rules": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 24,
                        "items": {
                          "type": "object",
                          "properties": {
                            "pattern": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "value": {
                              "type": [
                                "string",
                                "number"
                              ]
                            }
                          },
                          "required": [
                            "pattern",
                            "value"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "from",
                      "rules"
                    ],
                    "additionalProperties": false,
                    "description": "A choice input picked from a text input as it’s typed, until it’s picked by hand: the first rule whose pattern matches all of the text."
                  }
                },
                "required": [
                  "name",
                  "label"
                ],
                "additionalProperties": false
              },
              {
                "if": {
                  "required": [
                    "suggest"
                  ]
                },
                "then": {
                  "required": [
                    "kind",
                    "choices"
                  ],
                  "properties": {
                    "kind": {
                      "const": "choice"
                    }
                  }
                }
              },
              {
                "if": {
                  "required": [
                    "choices"
                  ],
                  "properties": {
                    "choices": {
                      "type": "object"
                    }
                  }
                },
                "then": {
                  "required": [
                    "kind",
                    "choices"
                  ],
                  "properties": {
                    "kind": {
                      "const": "choice"
                    }
                  },
                  "not": {
                    "anyOf": [
                      {
                        "required": [
                          "default"
                        ]
                      },
                      {
                        "required": [
                          "guess"
                        ]
                      }
                    ]
                  }
                }
              },
              {
                "if": {
                  "required": [
                    "kind"
                  ],
                  "properties": {
                    "kind": {
                      "const": "toggle"
                    }
                  }
                },
                "then": {
                  "properties": {
                    "default": {
                      "type": "boolean"
                    },
                    "required": {
                      "const": false
                    }
                  },
                  "not": {
                    "anyOf": [
                      {
                        "required": [
                          "choices"
                        ]
                      },
                      {
                        "required": [
                          "guess"
                        ]
                      },
                      {
                        "required": [
                          "suggest"
                        ]
                      },
                      {
                        "required": [
                          "max"
                        ]
                      },
                      {
                        "required": [
                          "pattern"
                        ]
                      },
                      {
                        "required": [
                          "invalid"
                        ]
                      },
                      {
                        "required": [
                          "spaces"
                        ]
                      },
                      {
                        "required": [
                          "case"
                        ]
                      },
                      {
                        "required": [
                          "placeholder"
                        ]
                      }
                    ]
                  }
                },
                "else": {
                  "properties": {
                    "default": {
                      "type": [
                        "string",
                        "number"
                      ]
                    }
                  },
                  "not": {
                    "anyOf": [
                      {
                        "required": [
                          "on_value"
                        ]
                      },
                      {
                        "required": [
                          "off_value"
                        ]
                      }
                    ]
                  }
                }
              }
            ]
          },
          "description": "Ask for what to send: a press opens a form in the page’s place, and its own button (submit) sends the request with {input.<name>} filled. Typed text fills the body as JSON values; it goes in the path only with a pattern (percent-encoded) and never in a header. A body string that is \"{input.x}\" alone keeps a choice’s type, and leaves its key out when an optional field is empty. Spotlight opens the form; Shortcuts presses it only when every required input has a default; it never goes on a notification. Not with choices or confirm."
        },
        "submit": {
          "type": "string",
          "minLength": 1,
          "maxLength": 24,
          "description": "With inputs: the form’s run button. Default Add."
        },
        "send": {
          "enum": [
            "all",
            "changed"
          ],
          "default": "all",
          "description": "With inputs: changed sends only the fields that differ from what the form opened on (each input’s start), leaving the others’ keys out, so an edit never writes back a value nobody touched; a field emptied on purpose goes as empty text, null or an empty list. Save waits for a change. Use all for a request that replaces the whole thing, such as a list of servers."
        },
        "graphql": {
          "type": "object",
          "properties": {
            "query": {
              "type": "string",
              "minLength": 1,
              "maxLength": 20000,
              "pattern": "\\S",
              "description": "The GraphQL document, sent exactly as written: its braces are GraphQL’s, never filled. Pass values in variables and use them as $name."
            },
            "variables": {
              "type": "object",
              "description": "Filled like a body in this kind of button ({answer.…}, {choice}, {input.…}, {action.id}, a row’s fields): a string that is one placeholder alone keeps its type."
            }
          },
          "required": [
            "query"
          ],
          "additionalProperties": false,
          "description": "Send a GraphQL request in place of body: {\"query\": …, \"variables\": …} as POST to path. Any errors in the answer fail the press, even beside data, and Legato doesn’t send it again (except once after signing in again, on a source with a sign-in request that answered 401). Not with body or completion."
        },
        "form": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 20,
          "propertyNames": {
            "minLength": 1
          },
          "additionalProperties": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          },
          "description": "Send the request as a form (application/x-www-form-urlencoded) in place of a JSON body, for services whose commands read only a form, such as qBittorrent: {\"hashes\": \"{hash}\"}. Its values are filled like a body’s; each goes as text, a number as its digits and true or false as words. Fields go in name order, and an empty optional {input.…} leaves its field out. A form request never follows a redirect. Not with body or graphql, and not with DELETE."
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "pattern": "^[^{}]*$"
          },
          "description": "Fixed values only: a row’s values never go in a header."
        },
        "alternate": {
          "type": "boolean",
          "default": false,
          "description": "Take the place of the button before it, for the other half of an on/off pair such as Stop and Start: give the two whens that never hold on the same row. If both hold, the first shows. Not on the first button, and not on two in a row."
        },
        "done_note": {
          "type": "string",
          "minLength": 1,
          "maxLength": 12,
          "pattern": "^[^{}]*\\S[^{}]*$",
          "description": "Words for a press the service accepted, such as \"Passed\": drawn where the row’s icons were for two minutes, while the pointer is elsewhere. For a press that changes nothing the row shows, such as a test that passes. A refused press shows its reason under the card as always."
        },
        "confirm": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160,
                  "description": "The question, such as \"Restart pve-lab? Every guest stops first.\" Without it the panel asks the label with a question mark."
                },
                "button": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 24,
                  "description": "The button that runs it, such as Restart. Without it, the button’s own label."
                }
              },
              "required": [],
              "additionalProperties": false
            }
          ],
          "description": "Ask in the row before the request goes out: true for \"<label> “<row>”?\", or an object with message (filled from the row, such as \"Stop {title} for {user}?\") and button. No type: there is no room in a row to type."
        }
      },
      "required": [
        "label",
        "icon",
        "path"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "required": [
              "graphql"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "completion"
                  ]
                }
              ]
            },
            "properties": {
              "method": {
                "const": "POST"
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "form"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "graphql"
                  ]
                }
              ]
            },
            "properties": {
              "method": {
                "not": {
                  "const": "DELETE"
                }
              },
              "inputs": {
                "items": {
                  "not": {
                    "required": [
                      "kind"
                    ],
                    "properties": {
                      "kind": {
                        "const": "toggle"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "method"
            ],
            "properties": {
              "method": {
                "const": "GET"
              }
            }
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "form"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "form_style"
            ]
          },
          "then": {
            "required": [
              "inputs"
            ]
          }
        }
      ],
      "description": "A button at the end of each row, shown under the pointer, with keyboard focus and to VoiceOver as one of the row’s actions. Its path and body are templates filled from that row of the map’s each rule ({id}), plus {answer.…}, {input.…} and {action.id}; answer, input and action are read before a row field of the same name. A path value is percent-encoded; a body string that is one placeholder alone keeps its type, so a number stays a number (unlike a checklist’s itemAction, which fills every body value as text). when tests the row; a row that lacks a value the button needs shows it unavailable. Never offered to Spotlight, Shortcuts or notifications, since rows come and go."
    },
    "stat": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "stat"
        },
        "label": {
          "type": "string"
        },
        "value": {
          "type": [
            "number",
            "string"
          ]
        },
        "unit": {
          "type": "string"
        },
        "delta": {
          "type": [
            "number",
            "string"
          ]
        },
        "url": {
          "type": "string",
          "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. Without buttons the whole card is the link; with them, the link is its own small button after them."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "value": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "delta": {
                      "$ref": "#/definitions/rule"
                    },
                    "url": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|value|unit|delta|url)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "value": {
                "type": [
                  "number",
                  "string"
                ],
                "maxLength": 32
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              },
              "delta": {
                "type": [
                  "number",
                  "string"
                ],
                "maxLength": 16
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. Without buttons the whole card is the link; with them, the link is its own small button after them."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        },
        "daily": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "values"
          ],
          "description": "For a page with a period, on a card without a source: one value a day, which Legato adds up for the period showing: a stat’s or pacing’s value, a sparkline’s points, columns by day, week or month. Days still to come aren’t drawn.",
          "properties": {
            "values": {
              "type": "array",
              "maxItems": 3660,
              "items": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "number"
                  }
                ]
              },
              "description": "Days and values: [[\"2026-10-01\", 62], …]."
            },
            "aggregate": {
              "enum": [
                "sum",
                "mean",
                "last",
                "min",
                "max"
              ],
              "default": "sum",
              "description": "How a period’s days add up: sum for spending or steps, mean for an average, last for a balance."
            },
            "compare": {
              "type": "boolean",
              "default": false,
              "description": "With the period’s compare: a stat’s delta is the change from the stretch before, and columns show both side by side."
            }
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A single headline number: balance, open PRs, uptime.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^value(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "value": {
                "type": [
                  "number",
                  "string"
                ],
                "maxLength": 32
              }
            },
            "required": [
              "value"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^delta(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "delta": {
                "type": [
                  "number",
                  "string"
                ],
                "maxLength": 16
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^url(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. Without buttons the whole card is the link; with them, the link is its own small button after them."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "pacing": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "pacing"
        },
        "label": {
          "type": "string"
        },
        "value": {
          "type": "number"
        },
        "target": {
          "type": "number"
        },
        "elapsed": {
          "type": "number",
          "description": "Fraction of the period gone, 0 to 1. Leave it out for a goal with no period, like steps today."
        },
        "unit": {
          "type": "string"
        },
        "detail": {
          "type": "string",
          "description": "A second line under the card, like \"no mindful minutes yet\"."
        },
        "shape": {
          "default": "bar",
          "description": "A full-width bar; a half-width ring like a fitness ring; or rings: up to three items as nested rings at half width, each figure beside them in its ring's colour, the way a watch shows Move, Exercise and Stand. With days, rings are a full-width calendar of a day each instead."
        },
        "hide_caption": {
          "type": "boolean",
          "default": false,
          "description": "Leave out the pace line under the bar or ring, which shows only with elapsed, like \"$380 ahead of pace\"."
        },
        "amounts": {
          "default": "spent",
          "description": "left: a budget’s words. Each bar row says what’s left (\"$288 left\") or how far over (\"$36 over\"), and the pace line says under or over pace. The card’s own total keeps \"$5,161 of $7,103\". Rings keep their figures. value: the card’s value is one large figure under its name (\"65%\"), with note beside it, for a level whose target is its full scale, such as a battery out of 100%."
        },
        "items": {
          "type": "array",
          "description": "Rows, each with its own target: a budget per category. Each draws as a bar like the card's, with the pace tick when elapsed is set. With items, value and target are optional: leave them out for rows only, or set them for an overall bar above the rows. A card with items is drawn as bars, unless its shape is rings: then 1 to 3 items, each a ring. A row can also carry a grey subtitle and state word on its title line, a detail line under its bar (its figure then moves to that line's end), a link and a thumbnail: a stream as it plays. With a source, map items with each; an answer with none can show source.empty's text (\"Nothing playing\").",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "value": {
                "type": "number"
              },
              "target": {
                "type": "number"
              },
              "unit": {
                "type": "string",
                "description": "The row's own unit, when it isn't the card's: rings measure kcal, minutes and hours."
              },
              "icon": {
                "type": "string",
                "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
              },
              "color": {
                "description": "Optional colour for the row's icon, or with shape rings for its ring, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, and rings take pink, green and teal in turn. Use it when the colour means something, like a category's colour on other pages."
              },
              "key": {
                "type": [
                  "string",
                  "number"
                ],
                "description": "Matches this row to its details lines: a category id, say. Text or a number; 12 and \"12\" match."
              },
              "subtitle": {
                "type": "string",
                "description": "Optional grey words after the label on the title line, cut first when the line runs short: \"S2 · E5 · The Long Tide\"."
              },
              "state": {
                "type": "string",
                "description": "Optional short grey word at the right of the title line, like \"Paused\". Words only: it never colours the row or counts as a problem."
              },
              "detail": {
                "type": "string",
                "description": "Optional grey line under the bar: \"riley · Living room TV · Direct play\". Once any row has one, every row draws the line and its figure (\"31 of 47 min\") moves to its end, so the rows keep one height."
              },
              "url": {
                "type": "string",
                "description": "Optional link the row opens: https, legato://page/ID, or plain http on the card's source's own address (a server on your network). A row with details lines to open opens them instead."
              },
              "image": {
                "type": "string",
                "description": "Optional thumbnail, drawn in the icon's place: a path on the card's source's own address (/Items/{id}/Images/Primary), or a full http(s) address on that same scheme, host and port. Fetched with the source's sign-in, only while the panel shows the card, and kept in Legato's cache; an address anywhere else is refused, and Preview Source says why. Posters and covers keep their own colours."
              },
              "image_shape": {
                "description": "The thumbnail's shape: poster (2:3, the default), square (1:1, an album) or wide (16:9). An item's own overrides the card's."
              }
            },
            "additionalProperties": false
          }
        },
        "image_shape": {
          "default": "poster",
          "description": "The rows' thumbnails' shape, unless a row sets its own: poster (2:3), square (1:1) or wide (16:9)."
        },
        "details": {
          "type": "array",
          "description": "Lines a row shows when opened, matched by key. The first 20 appear with Show all for the remaining supplied lines. Lines for no row are ignored. This does not fetch additional records.",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": [
                  "string",
                  "number"
                ],
                "description": "The key of the row this line belongs to."
              },
              "text": {
                "type": "string"
              },
              "detail": {
                "type": "string",
                "description": "Right-aligned, like \"$212 · Oct 3\"."
              },
              "url": {
                "type": "string",
                "description": "Optional destination for this individual detail line, separate from the row disclosure."
              },
              "detail_color": {
                "description": "Optional colour for the line's detail, by the breakdown card's names, in their deeper shade for text: a refund's amount in green. Leave it out and the detail is grey."
              },
              "aside": {
                "type": "string",
                "description": "A short grey column on the line: its date, say. Once any of a row's lines has one, their asides and details each keep one width, so dates and amounts line up."
              }
            },
            "additionalProperties": false
          }
        },
        "details_aside_at": {
          "default": "end",
          "description": "Where the detail lines' aside column sits: end, before the detail, or start, before the text (a date at the start of a ledger line)."
        },
        "fit": {
          "type": "boolean",
          "default": false,
          "description": "Keeps the page within the sidebar's length: the card shows as many rows as fit, at least 5, with Show N more only when some are left out, and an opened row shows as many of its lines as fit, at least 3, with Show all only when some are left out (the row opened last gives way first). Without the sidebar, every row shows and an opened row shows 20 lines."
        },
        "url": {
          "type": "string",
          "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. A card with items isn't a link, since a click on a row opens its details, unless its shape is rings."
        },
        "days": {
          "type": "array",
          "description": "With shape rings: a day each, drawn as a calendar of small rings under the title instead of the rings and figures, at full width. Each has its date and a value for each item, in the items' order (null for a day with no figure). The items give the rings' targets, units and colours. Days with no entry draw empty rings. An empty days array keeps a full-width empty calendar. Without calendar, the first and last dates must be within 42 consecutive days.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "date": {
                "type": "string",
                "description": "The day, YYYY-MM-DD."
              },
              "values": {
                "type": "array",
                "items": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "description": "A value for each item, in order; no more values than items."
              }
            }
          }
        },
        "calendar": {
          "description": "With days: the week or the month the days are in, so a month's first few days still show the whole month. Without it, the weeks from the first day to the last."
        },
        "note": {
          "type": "string",
          "description": "With amounts value, a few words beside the large figure, such as a battery's range (\"213 mi\")."
        },
        "color": {
          "description": "The bar's colour where the colour means something, such as a battery's charge in green. The accent without."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "value": {
                      "$ref": "#/definitions/rule"
                    },
                    "target": {
                      "$ref": "#/definitions/rule"
                    },
                    "elapsed": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "shape": {
                      "$ref": "#/definitions/rule"
                    },
                    "hide_caption": {
                      "$ref": "#/definitions/rule"
                    },
                    "amounts": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "image_shape": {
                      "$ref": "#/definitions/rule"
                    },
                    "details": {
                      "$ref": "#/definitions/rule"
                    },
                    "details_aside_at": {
                      "$ref": "#/definitions/rule"
                    },
                    "fit": {
                      "$ref": "#/definitions/rule"
                    },
                    "url": {
                      "$ref": "#/definitions/rule"
                    },
                    "days": {
                      "$ref": "#/definitions/rule"
                    },
                    "calendar": {
                      "$ref": "#/definitions/rule"
                    },
                    "note": {
                      "$ref": "#/definitions/rule"
                    },
                    "color": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|value|target|elapsed|unit|detail|shape|hide_caption|amounts|items|image_shape|details|details_aside_at|fit|url|days|calendar|note|color)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "row_actions": {
          "oneOf": [
            {
              "type": "array",
              "minItems": 1,
              "maxItems": 4,
              "items": {
                "$ref": "#/definitions/rowAction"
              },
              "if": {
                "minItems": 4
              },
              "then": {
                "contains": {
                  "type": "object",
                  "required": [
                    "alternate"
                  ],
                  "properties": {
                    "alternate": {
                      "const": true
                    }
                  }
                }
              }
            }
          ],
          "description": "Up to three places for buttons at the end of each row’s first line, such as Message and Stop on a stream, filled from that row. A fourth button fits only as the alternate of the one before it (Start in Stop’s place). On a list with row_actions_place detail, a \"|\" between two buttons draws a thin line between the groups. Needs a source whose items rule uses each. Not on shelf or chips lists, a ring or rings, or a list with ask or copyable. Their room is kept on every row, so nothing moves when they show."
        },
        "row_actions_shown": {
          "enum": [
            "hover",
            "always"
          ],
          "default": "hover",
          "description": "When the row buttons show: under the pointer and with keyboard focus (hover), or on every row all the time (always), for rows the person acts on, such as a download queue's Pause and Remove. Needs row_actions."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "value": {
                "type": "number"
              },
              "target": {
                "type": "number",
                "exclusiveMinimum": 0
              },
              "elapsed": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "Fraction of the period gone, 0 to 1. Leave it out for a goal with no period, like steps today."
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              },
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "A second line under the card, like \"no mindful minutes yet\"."
              },
              "shape": {
                "enum": [
                  "bar",
                  "ring",
                  "rings"
                ],
                "default": "bar",
                "description": "A full-width bar; a half-width ring like a fitness ring; or rings: up to three items as nested rings at half width, each figure beside them in its ring's colour, the way a watch shows Move, Exercise and Stand. With days, rings are a full-width calendar of a day each instead."
              },
              "hide_caption": {
                "type": "boolean",
                "default": false,
                "description": "Leave out the pace line under the bar or ring, which shows only with elapsed, like \"$380 ahead of pace\"."
              },
              "amounts": {
                "enum": [
                  "spent",
                  "left",
                  "value"
                ],
                "default": "spent",
                "description": "left: a budget’s words. Each bar row says what’s left (\"$288 left\") or how far over (\"$36 over\"), and the pace line says under or over pace. The card’s own total keeps \"$5,161 of $7,103\". Rings keep their figures. value: the card’s value is one large figure under its name (\"65%\"), with note beside it, for a level whose target is its full scale, such as a battery out of 100%."
              },
              "items": {
                "type": "array",
                "minItems": 0,
                "maxItems": 20,
                "description": "Rows, each with its own target: a budget per category. Each draws as a bar like the card's, with the pace tick when elapsed is set. With items, value and target are optional: leave them out for rows only, or set them for an overall bar above the rows. A card with items is drawn as bars, unless its shape is rings: then 1 to 3 items, each a ring. A row can also carry a grey subtitle and state word on its title line, a detail line under its bar (its figure then moves to that line's end), a link and a thumbnail: a stream as it plays. With a source, map items with each; an answer with none can show source.empty's text (\"Nothing playing\").",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "value": {
                      "type": "number"
                    },
                    "target": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "unit": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 16,
                      "description": "The row's own unit, when it isn't the card's: rings measure kcal, minutes and hours."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the row's icon, or with shape rings for its ring, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, and rings take pink, green and teal in turn. Use it when the colour means something, like a category's colour on other pages."
                    },
                    "key": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "description": "Matches this row to its details lines: a category id, say. Text or a number; 12 and \"12\" match."
                    },
                    "subtitle": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "description": "Optional grey words after the label on the title line, cut first when the line runs short: \"S2 · E5 · The Long Tide\"."
                    },
                    "state": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 16,
                      "description": "Optional short grey word at the right of the title line, like \"Paused\". Words only: it never colours the row or counts as a problem."
                    },
                    "detail": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "description": "Optional grey line under the bar: \"riley · Living room TV · Direct play\". Once any row has one, every row draws the line and its figure (\"31 of 47 min\") moves to its end, so the rows keep one height."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https?://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link the row opens: https, legato://page/ID, or plain http on the card's source's own address (a server on your network). A row with details lines to open opens them instead."
                    },
                    "image": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048,
                      "pattern": "^(/(?!/)[^\\s\\\\#]*|https?://[^\\s\\\\#]+)$",
                      "description": "Optional thumbnail, drawn in the icon's place: a path on the card's source's own address (/Items/{id}/Images/Primary), or a full http(s) address on that same scheme, host and port. Fetched with the source's sign-in, only while the panel shows the card, and kept in Legato's cache; an address anywhere else is refused, and Preview Source says why. Posters and covers keep their own colours."
                    },
                    "image_shape": {
                      "enum": [
                        "poster",
                        "square",
                        "wide"
                      ],
                      "description": "The thumbnail's shape: poster (2:3, the default), square (1:1, an album) or wide (16:9). An item's own overrides the card's."
                    }
                  },
                  "required": [
                    "label",
                    "value",
                    "target"
                  ],
                  "additionalProperties": false
                }
              },
              "image_shape": {
                "enum": [
                  "poster",
                  "square",
                  "wide"
                ],
                "default": "poster",
                "description": "The rows' thumbnails' shape, unless a row sets its own: poster (2:3), square (1:1) or wide (16:9)."
              },
              "details": {
                "type": "array",
                "maxItems": 500,
                "description": "Lines a row shows when opened, matched by key. The first 20 appear with Show all for the remaining supplied lines. Lines for no row are ignored. This does not fetch additional records.",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "description": "The key of the row this line belongs to."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 40,
                      "description": "Right-aligned, like \"$212 · Oct 3\"."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional destination for this individual detail line, separate from the row disclosure."
                    },
                    "detail_color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the line's detail, by the breakdown card's names, in their deeper shade for text: a refund's amount in green. Leave it out and the detail is grey."
                    },
                    "aside": {
                      "type": "string",
                      "maxLength": 24,
                      "description": "A short grey column on the line: its date, say. Once any of a row's lines has one, their asides and details each keep one width, so dates and amounts line up."
                    }
                  },
                  "required": [
                    "key",
                    "text"
                  ],
                  "additionalProperties": false
                }
              },
              "details_aside_at": {
                "enum": [
                  "end",
                  "start"
                ],
                "default": "end",
                "description": "Where the detail lines' aside column sits: end, before the detail, or start, before the text (a date at the start of a ledger line)."
              },
              "fit": {
                "type": "boolean",
                "default": false,
                "description": "Keeps the page within the sidebar's length: the card shows as many rows as fit, at least 5, with Show N more only when some are left out, and an opened row shows as many of its lines as fit, at least 3, with Show all only when some are left out (the row opened last gives way first). Without the sidebar, every row shows and an opened row shows 20 lines."
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. A card with items isn't a link, since a click on a row opens its details, unless its shape is rings."
              },
              "days": {
                "type": "array",
                "maxItems": 42,
                "description": "With shape rings: a day each, drawn as a calendar of small rings under the title instead of the rings and figures, at full width. Each has its date and a value for each item, in the items' order (null for a day with no figure). The items give the rings' targets, units and colours. Days with no entry draw empty rings. An empty days array keeps a full-width empty calendar. Without calendar, the first and last dates must be within 42 consecutive days.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "date",
                    "values"
                  ],
                  "properties": {
                    "date": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}",
                      "description": "The day, YYYY-MM-DD."
                    },
                    "values": {
                      "type": "array",
                      "maxItems": 3,
                      "items": {
                        "type": [
                          "number",
                          "null"
                        ]
                      },
                      "description": "A value for each item, in order; no more values than items."
                    }
                  }
                }
              },
              "calendar": {
                "enum": [
                  "week",
                  "month"
                ],
                "description": "With days: the week or the month the days are in, so a month's first few days still show the whole month. Without it, the weeks from the first day to the last."
              },
              "note": {
                "type": "string",
                "maxLength": 40,
                "description": "With amounts value, a few words beside the large figure, such as a battery's range (\"213 mi\")."
              },
              "color": {
                "enum": [
                  "blue",
                  "teal",
                  "orange",
                  "purple",
                  "green",
                  "pink",
                  "yellow",
                  "red",
                  "rose",
                  "grey",
                  "slate",
                  "graphite",
                  "ink"
                ],
                "description": "The bar's colour where the colour means something, such as a battery's charge in green. The accent without."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        },
        "daily": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "values"
          ],
          "description": "For a page with a period, on a card without a source: one value a day, which Legato adds up for the period showing: a stat’s or pacing’s value, a sparkline’s points, columns by day, week or month. Days still to come aren’t drawn.",
          "properties": {
            "values": {
              "type": "array",
              "maxItems": 3660,
              "items": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "number"
                  }
                ]
              },
              "description": "Days and values: [[\"2026-10-01\", 62], …]."
            },
            "aggregate": {
              "enum": [
                "sum",
                "mean",
                "last",
                "min",
                "max"
              ],
              "default": "sum",
              "description": "How a period’s days add up: sum for spending or steps, mean for an average, last for a balance."
            },
            "compare": {
              "const": false,
              "default": false,
              "description": "With the period’s compare: a stat’s delta is the change from the stretch before, and columns show both side by side."
            }
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Progress against a target: budget pace over the month, a sprint, steps toward today's goal; or rows, each against its own target, like a budget per category.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^value(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "value": {
                "type": "number"
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^target(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "target": {
                "type": "number",
                "exclusiveMinimum": 0
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^elapsed(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "elapsed": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "Fraction of the period gone, 0 to 1. Leave it out for a goal with no period, like steps today."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "A second line under the card, like \"no mindful minutes yet\"."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^shape(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "shape": {
                "enum": [
                  "bar",
                  "ring",
                  "rings"
                ],
                "default": "bar",
                "description": "A full-width bar; a half-width ring like a fitness ring; or rings: up to three items as nested rings at half width, each figure beside them in its ring's colour, the way a watch shows Move, Exercise and Stand. With days, rings are a full-width calendar of a day each instead."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^hide_caption(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "hide_caption": {
                "type": "boolean",
                "default": false,
                "description": "Leave out the pace line under the bar or ring, which shows only with elapsed, like \"$380 ahead of pace\"."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^amounts(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "amounts": {
                "enum": [
                  "spent",
                  "left",
                  "value"
                ],
                "default": "spent",
                "description": "left: a budget’s words. Each bar row says what’s left (\"$288 left\") or how far over (\"$36 over\"), and the pace line says under or over pace. The card’s own total keeps \"$5,161 of $7,103\". Rings keep their figures. value: the card’s value is one large figure under its name (\"65%\"), with note beside it, for a level whose target is its full scale, such as a battery out of 100%."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "minItems": 0,
                "maxItems": 20,
                "description": "Rows, each with its own target: a budget per category. Each draws as a bar like the card's, with the pace tick when elapsed is set. With items, value and target are optional: leave them out for rows only, or set them for an overall bar above the rows. A card with items is drawn as bars, unless its shape is rings: then 1 to 3 items, each a ring. A row can also carry a grey subtitle and state word on its title line, a detail line under its bar (its figure then moves to that line's end), a link and a thumbnail: a stream as it plays. With a source, map items with each; an answer with none can show source.empty's text (\"Nothing playing\").",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "value": {
                      "type": "number"
                    },
                    "target": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "unit": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 16,
                      "description": "The row's own unit, when it isn't the card's: rings measure kcal, minutes and hours."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the row's icon, or with shape rings for its ring, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, and rings take pink, green and teal in turn. Use it when the colour means something, like a category's colour on other pages."
                    },
                    "key": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "description": "Matches this row to its details lines: a category id, say. Text or a number; 12 and \"12\" match."
                    },
                    "subtitle": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "description": "Optional grey words after the label on the title line, cut first when the line runs short: \"S2 · E5 · The Long Tide\"."
                    },
                    "state": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 16,
                      "description": "Optional short grey word at the right of the title line, like \"Paused\". Words only: it never colours the row or counts as a problem."
                    },
                    "detail": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "description": "Optional grey line under the bar: \"riley · Living room TV · Direct play\". Once any row has one, every row draws the line and its figure (\"31 of 47 min\") moves to its end, so the rows keep one height."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https?://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link the row opens: https, legato://page/ID, or plain http on the card's source's own address (a server on your network). A row with details lines to open opens them instead."
                    },
                    "image": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048,
                      "pattern": "^(/(?!/)[^\\s\\\\#]*|https?://[^\\s\\\\#]+)$",
                      "description": "Optional thumbnail, drawn in the icon's place: a path on the card's source's own address (/Items/{id}/Images/Primary), or a full http(s) address on that same scheme, host and port. Fetched with the source's sign-in, only while the panel shows the card, and kept in Legato's cache; an address anywhere else is refused, and Preview Source says why. Posters and covers keep their own colours."
                    },
                    "image_shape": {
                      "enum": [
                        "poster",
                        "square",
                        "wide"
                      ],
                      "description": "The thumbnail's shape: poster (2:3, the default), square (1:1, an album) or wide (16:9). An item's own overrides the card's."
                    }
                  },
                  "required": [
                    "label",
                    "value",
                    "target"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^image_shape(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "image_shape": {
                "enum": [
                  "poster",
                  "square",
                  "wide"
                ],
                "default": "poster",
                "description": "The rows' thumbnails' shape, unless a row sets its own: poster (2:3), square (1:1) or wide (16:9)."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^details(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "details": {
                "type": "array",
                "maxItems": 500,
                "description": "Lines a row shows when opened, matched by key. The first 20 appear with Show all for the remaining supplied lines. Lines for no row are ignored. This does not fetch additional records.",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "description": "The key of the row this line belongs to."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 40,
                      "description": "Right-aligned, like \"$212 · Oct 3\"."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional destination for this individual detail line, separate from the row disclosure."
                    },
                    "detail_color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the line's detail, by the breakdown card's names, in their deeper shade for text: a refund's amount in green. Leave it out and the detail is grey."
                    },
                    "aside": {
                      "type": "string",
                      "maxLength": 24,
                      "description": "A short grey column on the line: its date, say. Once any of a row's lines has one, their asides and details each keep one width, so dates and amounts line up."
                    }
                  },
                  "required": [
                    "key",
                    "text"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^details_aside_at(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "details_aside_at": {
                "enum": [
                  "end",
                  "start"
                ],
                "default": "end",
                "description": "Where the detail lines' aside column sits: end, before the detail, or start, before the text (a date at the start of a ledger line)."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^fit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "fit": {
                "type": "boolean",
                "default": false,
                "description": "Keeps the page within the sidebar's length: the card shows as many rows as fit, at least 5, with Show N more only when some are left out, and an opened row shows as many of its lines as fit, at least 3, with Show all only when some are left out (the row opened last gives way first). Without the sidebar, every row shows and an opened row shows 20 lines."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^url(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. A card with items isn't a link, since a click on a row opens its details, unless its shape is rings."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^days(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "days": {
                "type": "array",
                "maxItems": 42,
                "description": "With shape rings: a day each, drawn as a calendar of small rings under the title instead of the rings and figures, at full width. Each has its date and a value for each item, in the items' order (null for a day with no figure). The items give the rings' targets, units and colours. Days with no entry draw empty rings. An empty days array keeps a full-width empty calendar. Without calendar, the first and last dates must be within 42 consecutive days.",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "date",
                    "values"
                  ],
                  "properties": {
                    "date": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}",
                      "description": "The day, YYYY-MM-DD."
                    },
                    "values": {
                      "type": "array",
                      "maxItems": 3,
                      "items": {
                        "type": [
                          "number",
                          "null"
                        ]
                      },
                      "description": "A value for each item, in order; no more values than items."
                    }
                  }
                }
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^calendar(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "calendar": {
                "enum": [
                  "week",
                  "month"
                ],
                "description": "With days: the week or the month the days are in, so a month's first few days still show the whole month. Without it, the weeks from the first day to the last."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^note(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "note": {
                "type": "string",
                "maxLength": 40,
                "description": "With amounts value, a few words beside the large figure, such as a battery's range (\"213 mi\")."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^color(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "color": {
                "enum": [
                  "blue",
                  "teal",
                  "orange",
                  "purple",
                  "green",
                  "pink",
                  "yellow",
                  "red",
                  "rose",
                  "grey",
                  "slate",
                  "graphite",
                  "ink"
                ],
                "description": "The bar's colour where the colour means something, such as a battery's charge in green. The accent without."
              }
            }
          }
        },
        {
          "anyOf": [
            {
              "required": [
                "value",
                "target"
              ]
            },
            {
              "required": [
                "items"
              ]
            },
            {
              "required": [
                "source"
              ]
            },
            {
              "required": [
                "periods"
              ]
            },
            {
              "required": [
                "daily",
                "target"
              ]
            }
          ]
        },
        {
          "if": {
            "required": [
              "daily"
            ]
          },
          "then": {
            "required": [
              "target"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^shape(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "if": {
              "required": [
                "shape"
              ],
              "properties": {
                "shape": {
                  "const": "rings"
                }
              }
            },
            "then": {
              "properties": {
                "items": {
                  "maxItems": 3
                }
              },
              "anyOf": [
                {
                  "required": [
                    "items"
                  ]
                },
                {
                  "required": [
                    "source"
                  ]
                },
                {
                  "required": [
                    "periods"
                  ]
                }
              ]
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^days(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^shape(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "if": {
              "required": [
                "days"
              ]
            },
            "then": {
              "required": [
                "shape"
              ],
              "properties": {
                "shape": {
                  "const": "rings"
                }
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^calendar(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^days(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "if": {
              "required": [
                "calendar"
              ]
            },
            "then": {
              "required": [
                "days"
              ]
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "row_actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        }
      ]
    },
    "list": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "list"
        },
        "label": {
          "type": "string",
          "description": "Optional: a list in a tab drops a title that repeats the tab's name, and then has no header row."
        },
        "items": {
          "type": "array",
          "description": "Up to 500 lines, such as a month of transactions; give a long list max_items so it opens short, with Show more for the rest. A line is a string, or an object for a row that links somewhere, has something at its right, a grey line under it or an icon before it. An object line can also have a thumbnail (image).",
          "items": {
            "if": {
              "type": "string"
            },
            "then": {
              "type": "string"
            },
            "else": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string",
                  "description": "The line, with inline formatting."
                },
                "url": {
                  "type": "string",
                  "description": "Optional link the row opens when it's clicked: an https address (a post, a pull request, a search result), legato://page/ID for another of your pages, or plain http on the card's source's own address (a server on your network)."
                },
                "detail": {
                  "type": "string",
                  "description": "Optional short text at the row's right, like \"2h ago\" or \"$212\"."
                },
                "subtitle": {
                  "type": "string",
                  "description": "Optional grey line of plain text under the row's words, cut short to fit: an issue's \"APP-214 · Due today\", or who commented. The detail stays at the right of the first line. Drawn in rows layout only."
                },
                "icon": {
                  "type": "string",
                  "description": "Optional icon before the line's text: an SF Symbol name (shippingbox), an icon from Simple Icons (si:ups), Dashboard Icons or Material Design Icons, or a website's own icon (site:fedex.com), as other cards' item icons are. Once any line has one, every line keeps its space, so the words line up."
                },
                "color": {
                  "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
                },
                "image": {
                  "type": "string",
                  "description": "Optional thumbnail, drawn in the icon's place: a path on the card's source's own address (/Items/{id}/Images/Primary), or a full http(s) address on that same scheme, host and port. Fetched with the source's sign-in, only while the panel shows the card, and kept in Legato's cache; an address anywhere else is refused, and Preview Source says why. Posters and covers keep their own colours."
                },
                "image_shape": {
                  "description": "The thumbnail's shape: poster (2:3, the default), square (1:1, an album) or wide (16:9). An item's own overrides the card's."
                },
                "key": {
                  "type": [
                    "string",
                    "number"
                  ],
                  "description": "Optional: the row's identity from one answer to the next, like a stream's or an item's id, for buttons on each row. Text or a number; 12 and \"12\" match."
                },
                "section": {
                  "type": "string",
                  "description": "A small heading when this section differs from the row above. Drawn in rows layout only."
                },
                "detail_color": {
                  "description": "Optional colour for the row's detail, by the breakdown card's names, in their deeper shade for text: a credit's amount in green. Leave it out and the detail is the row's own colour. Give colour only when it means something."
                },
                "selected": {
                  "type": [
                    "boolean",
                    "string"
                  ],
                  "description": "Optional: true draws the row on a grey plate, for the row the page shows now (the drive on its map). A source can set it from a comparison; \"true\" counts. Rows layout only."
                },
                "aside": {
                  "type": "string",
                  "description": "A short grey column on the row's one line: a transaction's category beside its payee, or a date before it (aside_at). Once any row has one, the card's asides and details each keep one width, so they line up, and the words keep one line, cut short."
                },
                "lead": {
                  "type": "string",
                  "description": "A short grey column at the very start of the row, before its words: a log line's time. Every row's lead keeps one width, the widest, so the words line up."
                },
                "spark": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  },
                  "description": "A small chart of the row's own numbers, oldest first, as thin grey bars before its detail: a client's queries through the day. Once any row has one, every row keeps its room."
                }
              },
              "additionalProperties": false
            }
          }
        },
        "style": {
          "default": "plain",
          "description": "How the lines are marked: plain lines, bullets, 1. 2. 3., or check marks for a list of what's done or included."
        },
        "tone": {
          "default": "neutral",
          "description": "Tints the card as a text card's tone does, and colours its bullets, numbers or checks."
        },
        "copyable": {
          "type": "boolean",
          "default": false,
          "description": "Gives each line a Copy button that copies its words without formatting: prompts to try, commands, codes."
        },
        "max_items": {
          "type": "integer",
          "description": "Show no more than this many lines, with Show more for the rest. A recent list on an overview shows 4."
        },
        "paged": {
          "type": "boolean",
          "default": false,
          "description": "Turns a long list into pages of max_items lines, with a pager at the end of the title row in place of Show more: a month of transactions, say. Needs max_items; not for a shelf or chips."
        },
        "fit": {
          "type": "boolean",
          "default": false,
          "description": "With paged: each page shows as many lines as keep the page within the sidebar's length, so the panel never grows past it for this list, at most max_items and at least 5. Pages grow and shrink by whole lines as the sidebar and the rest of the page change. Without the sidebar, pages are max_items lines."
        },
        "aside_at": {
          "default": "end",
          "description": "Where the rows' aside column sits: end, between the words and the detail (a transaction's category), or start, before the words (a date). Only for rows that have an aside."
        },
        "sections": {
          "description": "days: each row's section is its date (2026-12-03, or a time on that day), and the rows are grouped by day: Today, then each of the next seven days, then one group for each later month (Later in December) whose rows show their date. Give the rows in date order. Rows layout only."
        },
        "layout": {
          "default": "rows",
          "description": "rows: a line per item. shelf: up to four tiles across, each its image at image_shape with its text and detail under it on one line each, for what was just added to a media library; max_items still applies, and Show N more adds rows of four. chips: wrapping capsules with an icon and one line of text; detail is help and accessibility text. Chips take no images or row_actions. Both shelf and chips take no style, copyable or ask."
        },
        "image_shape": {
          "default": "poster",
          "description": "The thumbnails' shape, unless an item sets its own: poster (2:3), square (1:1) or wide (16:9)."
        },
        "truncate": {
          "description": "middle: each row's words on one line, a long one cut in its middle so both ends show (a long generated host name). Its whole text shows on hover."
        },
        "headings": {
          "type": "object",
          "description": "Grey names over the rows' columns, under a rule, each over its column: lead, text, aside and detail, such as Time, Domain, Client and Outcome. For a list read as a table. Rows layout only.",
          "properties": {
            "lead": {
              "type": "string"
            },
            "text": {
              "type": "string"
            },
            "aside": {
              "type": "string"
            },
            "detail": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "total": {
          "type": [
            "integer",
            "string"
          ],
          "description": "How many there are at the service, of which items are the first: a query log's 74,628 when the list holds the latest 100. A tab with counts shows it after its name, and a pager at the bottom says \"Showing 100 of 74,628\". A source can set it from the answer's count; \"74,628\" counts."
        },
        "pager_at": {
          "description": "bottom: with paged, the pager goes under the rows, with how many are showing at its left, in place of the title row's end. For a list with headings, or one beside a detail pane."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "style": {
                      "$ref": "#/definitions/rule"
                    },
                    "tone": {
                      "$ref": "#/definitions/rule"
                    },
                    "copyable": {
                      "$ref": "#/definitions/rule"
                    },
                    "max_items": {
                      "$ref": "#/definitions/rule"
                    },
                    "paged": {
                      "$ref": "#/definitions/rule"
                    },
                    "fit": {
                      "$ref": "#/definitions/rule"
                    },
                    "aside_at": {
                      "$ref": "#/definitions/rule"
                    },
                    "sections": {
                      "$ref": "#/definitions/rule"
                    },
                    "layout": {
                      "$ref": "#/definitions/rule"
                    },
                    "image_shape": {
                      "$ref": "#/definitions/rule"
                    },
                    "truncate": {
                      "$ref": "#/definitions/rule"
                    },
                    "headings": {
                      "$ref": "#/definitions/rule"
                    },
                    "total": {
                      "$ref": "#/definitions/rule"
                    },
                    "pager_at": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|items|style|tone|copyable|max_items|paged|fit|aside_at|sections|layout|image_shape|truncate|headings|total|pager_at)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "row_actions": {
          "oneOf": [
            {
              "type": "array",
              "minItems": 1,
              "maxItems": 4,
              "items": {
                "$ref": "#/definitions/rowAction"
              },
              "if": {
                "minItems": 4
              },
              "then": {
                "contains": {
                  "type": "object",
                  "required": [
                    "alternate"
                  ],
                  "properties": {
                    "alternate": {
                      "const": true
                    }
                  }
                }
              }
            },
            {
              "type": "array",
              "minItems": 3,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "array",
              "minItems": 4,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "$ref": "#/definitions/rowAction"
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "array",
              "minItems": 4,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "$ref": "#/definitions/rowAction"
                }
              ]
            },
            {
              "type": "array",
              "minItems": 5,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "array",
              "minItems": 5,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "$ref": "#/definitions/rowAction"
                },
                {
                  "$ref": "#/definitions/rowAction"
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                }
              ],
              "contains": {
                "type": "object",
                "required": [
                  "alternate"
                ],
                "properties": {
                  "alternate": {
                    "const": true
                  }
                }
              }
            },
            {
              "type": "array",
              "minItems": 5,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "$ref": "#/definitions/rowAction"
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "$ref": "#/definitions/rowAction"
                }
              ],
              "contains": {
                "type": "object",
                "required": [
                  "alternate"
                ],
                "properties": {
                  "alternate": {
                    "const": true
                  }
                }
              }
            },
            {
              "type": "array",
              "minItems": 5,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "$ref": "#/definitions/rowAction"
                },
                {
                  "$ref": "#/definitions/rowAction"
                }
              ],
              "contains": {
                "type": "object",
                "required": [
                  "alternate"
                ],
                "properties": {
                  "alternate": {
                    "const": true
                  }
                }
              }
            },
            {
              "type": "array",
              "minItems": 6,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "$ref": "#/definitions/rowAction"
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                }
              ],
              "contains": {
                "type": "object",
                "required": [
                  "alternate"
                ],
                "properties": {
                  "alternate": {
                    "const": true
                  }
                }
              }
            },
            {
              "type": "array",
              "minItems": 6,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "$ref": "#/definitions/rowAction"
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                }
              ],
              "contains": {
                "type": "object",
                "required": [
                  "alternate"
                ],
                "properties": {
                  "alternate": {
                    "const": true
                  }
                }
              }
            },
            {
              "type": "array",
              "minItems": 6,
              "additionalItems": false,
              "items": [
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "const": "|"
                },
                {
                  "allOf": [
                    {
                      "$ref": "#/definitions/rowAction"
                    },
                    {
                      "not": {
                        "type": "object",
                        "required": [
                          "alternate"
                        ],
                        "properties": {
                          "alternate": {
                            "const": true
                          }
                        }
                      }
                    }
                  ]
                },
                {
                  "$ref": "#/definitions/rowAction"
                }
              ],
              "contains": {
                "type": "object",
                "required": [
                  "alternate"
                ],
                "properties": {
                  "alternate": {
                    "const": true
                  }
                }
              }
            }
          ],
          "description": "Up to three places for buttons at the end of each row’s first line, such as Message and Stop on a stream, filled from that row. A fourth button fits only as the alternate of the one before it (Start in Stop’s place). On a list with row_actions_place detail, a \"|\" between two buttons draws a thin line between the groups. Needs a source whose items rule uses each. Not on shelf or chips lists, a ring or rings, or a list with ask or copyable. Their room is kept on every row, so nothing moves when they show."
        },
        "row_actions_shown": {
          "enum": [
            "hover",
            "always"
          ],
          "default": "hover",
          "description": "When the row buttons show: under the pointer and with keyboard focus (hover), or on every row all the time (always), for rows the person acts on, such as a download queue's Pause and Remove. Needs row_actions."
        },
        "row_actions_place": {
          "enum": [
            "title",
            "detail",
            "row"
          ],
          "default": "title",
          "description": "Where a list's row buttons go: at the end of each row's first line, in room every row keeps (title), as one small group over the row's detail, such as its amount, only under the pointer and with keyboard focus, the row keeping no room for them (detail), as mail apps do, or nowhere, a click on the row pressing the first button it offers, usually to open its form (row), with the row's url left to rows that offer none. Detail suits rows that mostly read, such as questions to answer. Needs row_actions; not with row_actions_shown always, and row takes no row_actions_shown."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: a list in a tab drops a title that repeats the tab's name, and then has no header row."
              },
              "items": {
                "type": "array",
                "maxItems": 500,
                "description": "Up to 500 lines, such as a month of transactions; give a long list max_items so it opens short, with Show more for the rest. A line is a string, or an object for a row that links somewhere, has something at its right, a grey line under it or an icon before it. An object line can also have a thumbnail (image).",
                "items": {
                  "if": {
                    "type": "string"
                  },
                  "then": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "else": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160,
                        "description": "The line, with inline formatting."
                      },
                      "url": {
                        "type": "string",
                        "maxLength": 2048,
                        "pattern": "^(https?://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                        "description": "Optional link the row opens when it's clicked: an https address (a post, a pull request, a search result), legato://page/ID for another of your pages, or plain http on the card's source's own address (a server on your network)."
                      },
                      "detail": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40,
                        "description": "Optional short text at the row's right, like \"2h ago\" or \"$212\"."
                      },
                      "subtitle": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "description": "Optional grey line of plain text under the row's words, cut short to fit: an issue's \"APP-214 · Due today\", or who commented. The detail stays at the right of the first line. Drawn in rows layout only."
                      },
                      "icon": {
                        "type": "string",
                        "maxLength": 80,
                        "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                        "description": "Optional icon before the line's text: an SF Symbol name (shippingbox), an icon from Simple Icons (si:ups), Dashboard Icons or Material Design Icons, or a website's own icon (site:fedex.com), as other cards' item icons are. Once any line has one, every line keeps its space, so the words line up."
                      },
                      "color": {
                        "enum": [
                          "blue",
                          "teal",
                          "orange",
                          "purple",
                          "green",
                          "pink",
                          "yellow",
                          "red",
                          "rose",
                          "grey",
                          "slate",
                          "graphite",
                          "ink",
                          "gray"
                        ],
                        "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
                      },
                      "image": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048,
                        "pattern": "^(/(?!/)[^\\s\\\\#]*|https?://[^\\s\\\\#]+)$",
                        "description": "Optional thumbnail, drawn in the icon's place: a path on the card's source's own address (/Items/{id}/Images/Primary), or a full http(s) address on that same scheme, host and port. Fetched with the source's sign-in, only while the panel shows the card, and kept in Legato's cache; an address anywhere else is refused, and Preview Source says why. Posters and covers keep their own colours."
                      },
                      "image_shape": {
                        "enum": [
                          "poster",
                          "square",
                          "wide"
                        ],
                        "description": "The thumbnail's shape: poster (2:3, the default), square (1:1, an album) or wide (16:9). An item's own overrides the card's."
                      },
                      "key": {
                        "type": [
                          "string",
                          "number"
                        ],
                        "description": "Optional: the row's identity from one answer to the next, like a stream's or an item's id, for buttons on each row. Text or a number; 12 and \"12\" match."
                      },
                      "section": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40,
                        "description": "A small heading when this section differs from the row above. Drawn in rows layout only."
                      },
                      "detail_color": {
                        "enum": [
                          "blue",
                          "teal",
                          "orange",
                          "purple",
                          "green",
                          "pink",
                          "yellow",
                          "red",
                          "rose",
                          "grey",
                          "slate",
                          "graphite",
                          "ink",
                          "gray"
                        ],
                        "description": "Optional colour for the row's detail, by the breakdown card's names, in their deeper shade for text: a credit's amount in green. Leave it out and the detail is the row's own colour. Give colour only when it means something."
                      },
                      "selected": {
                        "type": [
                          "boolean",
                          "string"
                        ],
                        "description": "Optional: true draws the row on a grey plate, for the row the page shows now (the drive on its map). A source can set it from a comparison; \"true\" counts. Rows layout only."
                      },
                      "aside": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "A short grey column on the row's one line: a transaction's category beside its payee, or a date before it (aside_at). Once any row has one, the card's asides and details each keep one width, so they line up, and the words keep one line, cut short."
                      },
                      "lead": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "A short grey column at the very start of the row, before its words: a log line's time. Every row's lead keeps one width, the widest, so the words line up."
                      },
                      "spark": {
                        "type": "array",
                        "maxItems": 60,
                        "items": {
                          "type": "number"
                        },
                        "description": "A small chart of the row's own numbers, oldest first, as thin grey bars before its detail: a client's queries through the day. Once any row has one, every row keeps its room."
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "style": {
                "enum": [
                  "plain",
                  "bullet",
                  "numbered",
                  "check"
                ],
                "default": "plain",
                "description": "How the lines are marked: plain lines, bullets, 1. 2. 3., or check marks for a list of what's done or included."
              },
              "tone": {
                "enum": [
                  "neutral",
                  "info",
                  "success",
                  "warning",
                  "critical"
                ],
                "default": "neutral",
                "description": "Tints the card as a text card's tone does, and colours its bullets, numbers or checks."
              },
              "copyable": {
                "type": "boolean",
                "default": false,
                "description": "Gives each line a Copy button that copies its words without formatting: prompts to try, commands, codes."
              },
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 60,
                "description": "Show no more than this many lines, with Show more for the rest. A recent list on an overview shows 4."
              },
              "paged": {
                "type": "boolean",
                "default": false,
                "description": "Turns a long list into pages of max_items lines, with a pager at the end of the title row in place of Show more: a month of transactions, say. Needs max_items; not for a shelf or chips."
              },
              "fit": {
                "type": "boolean",
                "default": false,
                "description": "With paged: each page shows as many lines as keep the page within the sidebar's length, so the panel never grows past it for this list, at most max_items and at least 5. Pages grow and shrink by whole lines as the sidebar and the rest of the page change. Without the sidebar, pages are max_items lines."
              },
              "aside_at": {
                "enum": [
                  "end",
                  "start"
                ],
                "default": "end",
                "description": "Where the rows' aside column sits: end, between the words and the detail (a transaction's category), or start, before the words (a date). Only for rows that have an aside."
              },
              "sections": {
                "enum": [
                  "days"
                ],
                "description": "days: each row's section is its date (2026-12-03, or a time on that day), and the rows are grouped by day: Today, then each of the next seven days, then one group for each later month (Later in December) whose rows show their date. Give the rows in date order. Rows layout only."
              },
              "layout": {
                "enum": [
                  "rows",
                  "shelf",
                  "chips"
                ],
                "default": "rows",
                "description": "rows: a line per item. shelf: up to four tiles across, each its image at image_shape with its text and detail under it on one line each, for what was just added to a media library; max_items still applies, and Show N more adds rows of four. chips: wrapping capsules with an icon and one line of text; detail is help and accessibility text. Chips take no images or row_actions. Both shelf and chips take no style, copyable or ask."
              },
              "image_shape": {
                "enum": [
                  "poster",
                  "square",
                  "wide"
                ],
                "default": "poster",
                "description": "The thumbnails' shape, unless an item sets its own: poster (2:3), square (1:1) or wide (16:9)."
              },
              "truncate": {
                "enum": [
                  "middle"
                ],
                "description": "middle: each row's words on one line, a long one cut in its middle so both ends show (a long generated host name). Its whole text shows on hover."
              },
              "headings": {
                "type": "object",
                "description": "Grey names over the rows' columns, under a rule, each over its column: lead, text, aside and detail, such as Time, Domain, Client and Outcome. For a list read as a table. Rows layout only.",
                "properties": {
                  "lead": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  },
                  "aside": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  },
                  "detail": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  }
                },
                "additionalProperties": false
              },
              "total": {
                "type": [
                  "integer",
                  "string"
                ],
                "description": "How many there are at the service, of which items are the first: a query log's 74,628 when the list holds the latest 100. A tab with counts shows it after its name, and a pager at the bottom says \"Showing 100 of 74,628\". A source can set it from the answer's count; \"74,628\" counts."
              },
              "pager_at": {
                "enum": [
                  "bottom"
                ],
                "description": "bottom: with paged, the pager goes under the rows, with how many are showing at its left, in place of the title row's end. For a list with headings, or one beside a detail pane."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Up to 60 short lines: largest charges, new deals, steps, or rows that link somewhere, like a feed's latest posts. Inline formatting works: **bold**, *italic*, ~~strikethrough~~, `code` and [links](https://example.com) (https, legato://page/ID for another of your pages, or mailto: with one address). Block Markdown (headings, lists, code fences) doesn't; use the card types for those. A literal * or _ that should stay can be escaped with \\.",
      "allOf": [
        {
          "if": {
            "required": [
              "row_actions"
            ],
            "properties": {
              "row_actions": {
                "contains": {
                  "const": "|"
                }
              }
            }
          },
          "then": {
            "required": [
              "row_actions_place"
            ],
            "properties": {
              "row_actions_place": {
                "const": "detail"
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "row_actions_place"
            ]
          },
          "then": {
            "required": [
              "row_actions"
            ]
          }
        },
        {
          "if": {
            "required": [
              "row_actions_place"
            ],
            "properties": {
              "row_actions_place": {
                "const": "detail"
              }
            }
          },
          "then": {
            "not": {
              "required": [
                "row_actions_shown"
              ],
              "properties": {
                "row_actions_shown": {
                  "const": "always"
                }
              }
            }
          }
        },
        {
          "if": {
            "required": [
              "row_actions_place"
            ],
            "properties": {
              "row_actions_place": {
                "const": "row"
              }
            }
          },
          "then": {
            "not": {
              "required": [
                "row_actions_shown"
              ]
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: a list in a tab drops a title that repeats the tab's name, and then has no header row."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 500,
                "description": "Up to 500 lines, such as a month of transactions; give a long list max_items so it opens short, with Show more for the rest. A line is a string, or an object for a row that links somewhere, has something at its right, a grey line under it or an icon before it. An object line can also have a thumbnail (image).",
                "items": {
                  "if": {
                    "type": "string"
                  },
                  "then": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "else": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160,
                        "description": "The line, with inline formatting."
                      },
                      "url": {
                        "type": "string",
                        "maxLength": 2048,
                        "pattern": "^(https?://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                        "description": "Optional link the row opens when it's clicked: an https address (a post, a pull request, a search result), legato://page/ID for another of your pages, or plain http on the card's source's own address (a server on your network)."
                      },
                      "detail": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40,
                        "description": "Optional short text at the row's right, like \"2h ago\" or \"$212\"."
                      },
                      "subtitle": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80,
                        "description": "Optional grey line of plain text under the row's words, cut short to fit: an issue's \"APP-214 · Due today\", or who commented. The detail stays at the right of the first line. Drawn in rows layout only."
                      },
                      "icon": {
                        "type": "string",
                        "maxLength": 80,
                        "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                        "description": "Optional icon before the line's text: an SF Symbol name (shippingbox), an icon from Simple Icons (si:ups), Dashboard Icons or Material Design Icons, or a website's own icon (site:fedex.com), as other cards' item icons are. Once any line has one, every line keeps its space, so the words line up."
                      },
                      "color": {
                        "enum": [
                          "blue",
                          "teal",
                          "orange",
                          "purple",
                          "green",
                          "pink",
                          "yellow",
                          "red",
                          "rose",
                          "grey",
                          "slate",
                          "graphite",
                          "ink",
                          "gray"
                        ],
                        "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
                      },
                      "image": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048,
                        "pattern": "^(/(?!/)[^\\s\\\\#]*|https?://[^\\s\\\\#]+)$",
                        "description": "Optional thumbnail, drawn in the icon's place: a path on the card's source's own address (/Items/{id}/Images/Primary), or a full http(s) address on that same scheme, host and port. Fetched with the source's sign-in, only while the panel shows the card, and kept in Legato's cache; an address anywhere else is refused, and Preview Source says why. Posters and covers keep their own colours."
                      },
                      "image_shape": {
                        "enum": [
                          "poster",
                          "square",
                          "wide"
                        ],
                        "description": "The thumbnail's shape: poster (2:3, the default), square (1:1, an album) or wide (16:9). An item's own overrides the card's."
                      },
                      "key": {
                        "type": [
                          "string",
                          "number"
                        ],
                        "description": "Optional: the row's identity from one answer to the next, like a stream's or an item's id, for buttons on each row. Text or a number; 12 and \"12\" match."
                      },
                      "section": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40,
                        "description": "A small heading when this section differs from the row above. Drawn in rows layout only."
                      },
                      "detail_color": {
                        "enum": [
                          "blue",
                          "teal",
                          "orange",
                          "purple",
                          "green",
                          "pink",
                          "yellow",
                          "red",
                          "rose",
                          "grey",
                          "slate",
                          "graphite",
                          "ink",
                          "gray"
                        ],
                        "description": "Optional colour for the row's detail, by the breakdown card's names, in their deeper shade for text: a credit's amount in green. Leave it out and the detail is the row's own colour. Give colour only when it means something."
                      },
                      "selected": {
                        "type": [
                          "boolean",
                          "string"
                        ],
                        "description": "Optional: true draws the row on a grey plate, for the row the page shows now (the drive on its map). A source can set it from a comparison; \"true\" counts. Rows layout only."
                      },
                      "aside": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "A short grey column on the row's one line: a transaction's category beside its payee, or a date before it (aside_at). Once any row has one, the card's asides and details each keep one width, so they line up, and the words keep one line, cut short."
                      },
                      "lead": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "A short grey column at the very start of the row, before its words: a log line's time. Every row's lead keeps one width, the widest, so the words line up."
                      },
                      "spark": {
                        "type": "array",
                        "maxItems": 60,
                        "items": {
                          "type": "number"
                        },
                        "description": "A small chart of the row's own numbers, oldest first, as thin grey bars before its detail: a client's queries through the day. Once any row has one, every row keeps its room."
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^style(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "style": {
                "enum": [
                  "plain",
                  "bullet",
                  "numbered",
                  "check"
                ],
                "default": "plain",
                "description": "How the lines are marked: plain lines, bullets, 1. 2. 3., or check marks for a list of what's done or included."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^tone(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "tone": {
                "enum": [
                  "neutral",
                  "info",
                  "success",
                  "warning",
                  "critical"
                ],
                "default": "neutral",
                "description": "Tints the card as a text card's tone does, and colours its bullets, numbers or checks."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^copyable(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "copyable": {
                "type": "boolean",
                "default": false,
                "description": "Gives each line a Copy button that copies its words without formatting: prompts to try, commands, codes."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max_items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 60,
                "description": "Show no more than this many lines, with Show more for the rest. A recent list on an overview shows 4."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^paged(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "paged": {
                "type": "boolean",
                "default": false,
                "description": "Turns a long list into pages of max_items lines, with a pager at the end of the title row in place of Show more: a month of transactions, say. Needs max_items; not for a shelf or chips."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^fit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "fit": {
                "type": "boolean",
                "default": false,
                "description": "With paged: each page shows as many lines as keep the page within the sidebar's length, so the panel never grows past it for this list, at most max_items and at least 5. Pages grow and shrink by whole lines as the sidebar and the rest of the page change. Without the sidebar, pages are max_items lines."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^aside_at(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "aside_at": {
                "enum": [
                  "end",
                  "start"
                ],
                "default": "end",
                "description": "Where the rows' aside column sits: end, between the words and the detail (a transaction's category), or start, before the words (a date). Only for rows that have an aside."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^sections(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "sections": {
                "enum": [
                  "days"
                ],
                "description": "days: each row's section is its date (2026-12-03, or a time on that day), and the rows are grouped by day: Today, then each of the next seven days, then one group for each later month (Later in December) whose rows show their date. Give the rows in date order. Rows layout only."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^layout(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "layout": {
                "enum": [
                  "rows",
                  "shelf",
                  "chips"
                ],
                "default": "rows",
                "description": "rows: a line per item. shelf: up to four tiles across, each its image at image_shape with its text and detail under it on one line each, for what was just added to a media library; max_items still applies, and Show N more adds rows of four. chips: wrapping capsules with an icon and one line of text; detail is help and accessibility text. Chips take no images or row_actions. Both shelf and chips take no style, copyable or ask."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^image_shape(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "image_shape": {
                "enum": [
                  "poster",
                  "square",
                  "wide"
                ],
                "default": "poster",
                "description": "The thumbnails' shape, unless an item sets its own: poster (2:3), square (1:1) or wide (16:9)."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^truncate(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "truncate": {
                "enum": [
                  "middle"
                ],
                "description": "middle: each row's words on one line, a long one cut in its middle so both ends show (a long generated host name). Its whole text shows on hover."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^headings(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "headings": {
                "type": "object",
                "description": "Grey names over the rows' columns, under a rule, each over its column: lead, text, aside and detail, such as Time, Domain, Client and Outcome. For a list read as a table. Rows layout only.",
                "properties": {
                  "lead": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  },
                  "aside": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  },
                  "detail": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 24
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^total(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "total": {
                "type": [
                  "integer",
                  "string"
                ],
                "description": "How many there are at the service, of which items are the first: a query log's 74,628 when the list holds the latest 100. A tab with counts shows it after its name, and a pager at the bottom says \"Showing 100 of 74,628\". A source can set it from the answer's count; \"74,628\" counts."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^pager_at(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "pager_at": {
                "enum": [
                  "bottom"
                ],
                "description": "bottom: with paged, the pager goes under the rows, with how many are showing at its left, in place of the title row's end. For a list with headings, or one beside a detail pane."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "row_actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        }
      ]
    },
    "table": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "table"
        },
        "label": {
          "type": "string"
        },
        "columns": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "rows": {
          "type": "array",
          "description": "Each row has exactly one cell per column.",
          "items": {
            "type": "array",
            "items": {
              "type": [
                "string",
                "number"
              ]
            }
          }
        },
        "one_line": {
          "type": "boolean",
          "default": false,
          "description": "Every cell on one line, cut short with … rather than wrapping to two. For a table wide enough to read that way, such as a full-width list of transactions in a page layout."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "columns": {
                      "$ref": "#/definitions/rule"
                    },
                    "rows": {
                      "$ref": "#/definitions/rule"
                    },
                    "one_line": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|columns|rows|one_line)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "columns": {
                "type": "array",
                "minItems": 1,
                "maxItems": 8,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                }
              },
              "rows": {
                "type": "array",
                "maxItems": 10,
                "description": "Each row has exactly one cell per column.",
                "items": {
                  "type": "array",
                  "maxItems": 8,
                  "items": {
                    "type": [
                      "string",
                      "number"
                    ],
                    "maxLength": 60
                  }
                }
              },
              "one_line": {
                "type": "boolean",
                "default": false,
                "description": "Every cell on one line, cut short with … rather than wrapping to two. For a table wide enough to read that way, such as a full-width list of transactions in a page layout."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A grid of up to 8 columns and 10 rows: service status, a short ledger, recent transactions.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^columns(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "columns": {
                "type": "array",
                "minItems": 1,
                "maxItems": 8,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                }
              }
            },
            "required": [
              "columns"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^rows(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "rows": {
                "type": "array",
                "maxItems": 10,
                "description": "Each row has exactly one cell per column.",
                "items": {
                  "type": "array",
                  "maxItems": 8,
                  "items": {
                    "type": [
                      "string",
                      "number"
                    ],
                    "maxLength": 60
                  }
                }
              }
            },
            "required": [
              "rows"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^one_line(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "one_line": {
                "type": "boolean",
                "default": false,
                "description": "Every cell on one line, cut short with … rather than wrapping to two. For a table wide enough to read that way, such as a full-width list of transactions in a page layout."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "sparkline": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "sparkline"
        },
        "label": {
          "type": "string",
          "description": "Optional: leave it out when the page's title already says what the line is, such as a Net Worth page's trend."
        },
        "points": {
          "type": "array",
          "items": {
            "type": "number"
          }
        },
        "unit": {
          "type": "string"
        },
        "start_label": {
          "type": "string",
          "description": "Under the line's first point: the time it stands for, like \"12h ago\" or \"Oct 1\". A sparkline filled by a history rule gets it from its first reading unless this is set."
        },
        "end_label": {
          "type": "string",
          "description": "Under the line's last point: \"Now\", \"Today\" or a date. A sparkline filled by a history rule gets it from its last reading unless this is set."
        },
        "labels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "What each point stands for, one per point, oldest first, like \"Jan\" or \"Oct 28\". A few are drawn under the line, and the point under the pointer shows its label. A sparkline filled by a history rule gets them from its readings unless this is set."
        },
        "shape": {
          "default": "smooth",
          "description": "How the points are joined: a smooth curve (smooth), or straight segments (sharp) for values that shouldn't read as passing through the ones in between."
        },
        "grid": {
          "type": "boolean",
          "default": false,
          "description": "Lines across the chart at the axis's values. Off by default: the values down the leading edge stay either way."
        },
        "max": {
          "type": "number",
          "description": "The most the value can be, such as a guest's memory or a disk's size. The chart then runs from zero up to it, with a dashed line there, and the value reads \"9.4 GB of 13 GB\". A value over it still shows."
        },
        "change": {
          "type": "boolean",
          "default": true,
          "description": "The badge beside the value saying how far it is from the first point (+4.2%, or the difference for a percentage). false leaves it out, for a reading whose change isn't news, such as a machine's CPU or memory. Turn it off when the change since the first point isn't news, as for CPU, memory or a battery."
        },
        "axis_labels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "What's drawn under the line, one per point like labels, when it should be shorter than what the pointer shows: \"9 PM\" under the chart and \"8:54 PM\" on hover. Without it, labels are drawn there too."
        },
        "width": {
          "default": "full",
          "description": "half: a small chart that shares a row with the half-width card beside it, such as CPU beside memory."
        },
        "times": {
          "type": "array",
          "items": {
            "type": [
              "number",
              "string"
            ]
          },
          "description": "When each point was, one per point and in order: Unix seconds (or milliseconds) or ISO 8601. The points then sit at their moments rather than evenly, and the line breaks where readings stop for a while, such as a car asleep overnight."
        },
        "target": {
          "type": "number",
          "description": "A level the value is meant to reach or stay under, such as a car's charge limit: a dashed line, kept in view, and the value reads \"· Limit 80%\". Unlike max, the chart doesn't run from zero. Use it for the level a reading is meant to reach, such as a charge limit, instead of a separate card."
        },
        "target_label": {
          "type": "string",
          "description": "The target's name beside the value. Target without one."
        },
        "right_unit": {
          "type": "string",
          "description": "With right_scale: a second scale on the right for the same line, in this unit, such as mi beside a battery's percentage."
        },
        "right_scale": {
          "type": "number",
          "description": "With right_unit: what one unit of the value is on the right scale, such as 3.25 miles for each percent of battery. The value reads \"69% · 224 mi\". Often filled from a source: range divided by level. One chart with two scales replaces two cards of the same quantity (a battery gauge beside a Range stat)."
        },
        "series": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Names the two lines of a card that draws a second one with points2, such as [\"WAN\", \"WAN2\"] or [\"Down\", \"Up\"]. Both lines share one scale; each reading is named beside a dot in its line's colour. No change badge, and no right_unit."
        },
        "points2": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "With series: the second line's readings, oldest first. Without times, one per point of points. With times, give it times2: each line sits at its own moments, so a reading one line lacks is a gap in that line, never a made-up value. May be empty while the second line has no readings."
        },
        "times2": {
          "type": "array",
          "items": {
            "type": [
              "number",
              "string"
            ]
          },
          "description": "With times and points2: when each of points2's readings was, one per reading and in order."
        },
        "color": {
          "description": "The line's colour, by the breakdown card's names, such as graphite for a neutral chart beside other neutral cards. The accent without; give colour only when it means something."
        },
        "fill": {
          "type": "boolean",
          "default": true,
          "description": "false draws the line alone, with no wash under it: a charge curve beside the route's ink."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "points": {
                      "anyOf": [
                        {
                          "$ref": "#/definitions/rule"
                        },
                        {
                          "$ref": "#/definitions/historyRule"
                        },
                        {
                          "$ref": "#/definitions/historyOfRule"
                        }
                      ]
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "start_label": {
                      "$ref": "#/definitions/rule"
                    },
                    "end_label": {
                      "$ref": "#/definitions/rule"
                    },
                    "labels": {
                      "$ref": "#/definitions/rule"
                    },
                    "shape": {
                      "$ref": "#/definitions/rule"
                    },
                    "grid": {
                      "$ref": "#/definitions/rule"
                    },
                    "max": {
                      "$ref": "#/definitions/rule"
                    },
                    "change": {
                      "$ref": "#/definitions/rule"
                    },
                    "axis_labels": {
                      "$ref": "#/definitions/rule"
                    },
                    "width": {
                      "$ref": "#/definitions/rule"
                    },
                    "times": {
                      "$ref": "#/definitions/rule"
                    },
                    "target": {
                      "$ref": "#/definitions/rule"
                    },
                    "target_label": {
                      "$ref": "#/definitions/rule"
                    },
                    "right_unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "right_scale": {
                      "$ref": "#/definitions/rule"
                    },
                    "series": {
                      "$ref": "#/definitions/rule"
                    },
                    "points2": {
                      "$ref": "#/definitions/rule"
                    },
                    "times2": {
                      "$ref": "#/definitions/rule"
                    },
                    "color": {
                      "$ref": "#/definitions/rule"
                    },
                    "fill": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|points|unit|start_label|end_label|labels|shape|grid|max|change|axis_labels|width|times|target|target_label|right_unit|right_scale|series|points2|times2|color|fill)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: leave it out when the page's title already says what the line is, such as a Net Worth page's trend."
              },
              "points": {
                "type": "array",
                "minItems": 2,
                "maxItems": 240,
                "items": {
                  "type": "number"
                }
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              },
              "start_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "Under the line's first point: the time it stands for, like \"12h ago\" or \"Oct 1\". A sparkline filled by a history rule gets it from its first reading unless this is set."
              },
              "end_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "Under the line's last point: \"Now\", \"Today\" or a date. A sparkline filled by a history rule gets it from its last reading unless this is set."
              },
              "labels": {
                "type": "array",
                "minItems": 2,
                "maxItems": 240,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 24
                },
                "description": "What each point stands for, one per point, oldest first, like \"Jan\" or \"Oct 28\". A few are drawn under the line, and the point under the pointer shows its label. A sparkline filled by a history rule gets them from its readings unless this is set."
              },
              "shape": {
                "enum": [
                  "smooth",
                  "sharp"
                ],
                "default": "smooth",
                "description": "How the points are joined: a smooth curve (smooth), or straight segments (sharp) for values that shouldn't read as passing through the ones in between."
              },
              "grid": {
                "type": "boolean",
                "default": false,
                "description": "Lines across the chart at the axis's values. Off by default: the values down the leading edge stay either way."
              },
              "max": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "The most the value can be, such as a guest's memory or a disk's size. The chart then runs from zero up to it, with a dashed line there, and the value reads \"9.4 GB of 13 GB\". A value over it still shows."
              },
              "change": {
                "type": "boolean",
                "default": true,
                "description": "The badge beside the value saying how far it is from the first point (+4.2%, or the difference for a percentage). false leaves it out, for a reading whose change isn't news, such as a machine's CPU or memory. Turn it off when the change since the first point isn't news, as for CPU, memory or a battery."
              },
              "axis_labels": {
                "type": "array",
                "minItems": 2,
                "maxItems": 240,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 24
                },
                "description": "What's drawn under the line, one per point like labels, when it should be shorter than what the pointer shows: \"9 PM\" under the chart and \"8:54 PM\" on hover. Without it, labels are drawn there too."
              },
              "width": {
                "enum": [
                  "full",
                  "half"
                ],
                "default": "full",
                "description": "half: a small chart that shares a row with the half-width card beside it, such as CPU beside memory."
              },
              "times": {
                "type": "array",
                "minItems": 2,
                "maxItems": 500,
                "items": {
                  "type": [
                    "number",
                    "string"
                  ]
                },
                "description": "When each point was, one per point and in order: Unix seconds (or milliseconds) or ISO 8601. The points then sit at their moments rather than evenly, and the line breaks where readings stop for a while, such as a car asleep overnight."
              },
              "target": {
                "type": "number",
                "description": "A level the value is meant to reach or stay under, such as a car's charge limit: a dashed line, kept in view, and the value reads \"· Limit 80%\". Unlike max, the chart doesn't run from zero. Use it for the level a reading is meant to reach, such as a charge limit, instead of a separate card."
              },
              "target_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "The target's name beside the value. Target without one."
              },
              "right_unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 8,
                "description": "With right_scale: a second scale on the right for the same line, in this unit, such as mi beside a battery's percentage."
              },
              "right_scale": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "With right_unit: what one unit of the value is on the right scale, such as 3.25 miles for each percent of battery. The value reads \"69% · 224 mi\". Often filled from a source: range divided by level. One chart with two scales replaces two cards of the same quantity (a battery gauge beside a Range stat)."
              },
              "series": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16
                },
                "description": "Names the two lines of a card that draws a second one with points2, such as [\"WAN\", \"WAN2\"] or [\"Down\", \"Up\"]. Both lines share one scale; each reading is named beside a dot in its line's colour. No change badge, and no right_unit."
              },
              "points2": {
                "type": "array",
                "maxItems": 240,
                "items": {
                  "type": "number"
                },
                "description": "With series: the second line's readings, oldest first. Without times, one per point of points. With times, give it times2: each line sits at its own moments, so a reading one line lacks is a gap in that line, never a made-up value. May be empty while the second line has no readings."
              },
              "times2": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": [
                    "number",
                    "string"
                  ]
                },
                "description": "With times and points2: when each of points2's readings was, one per reading and in order."
              },
              "color": {
                "enum": [
                  "blue",
                  "teal",
                  "orange",
                  "purple",
                  "green",
                  "pink",
                  "yellow",
                  "red",
                  "rose",
                  "grey",
                  "slate",
                  "graphite",
                  "ink"
                ],
                "description": "The line's colour, by the breakdown card's names, such as graphite for a neutral chart beside other neutral cards. The accent without; give colour only when it means something."
              },
              "fill": {
                "type": "boolean",
                "default": true,
                "description": "false draws the line alone, with no wash under it: a charge curve beside the route's ink."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        },
        "daily": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "values"
          ],
          "description": "For a page with a period, on a card without a source: one value a day, which Legato adds up for the period showing: a stat’s or pacing’s value, a sparkline’s points, columns by day, week or month. Days still to come aren’t drawn.",
          "properties": {
            "values": {
              "type": "array",
              "maxItems": 3660,
              "items": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "number"
                  }
                ]
              },
              "description": "Days and values: [[\"2026-10-01\", 62], …]."
            },
            "aggregate": {
              "enum": [
                "sum",
                "mean",
                "last",
                "min",
                "max"
              ],
              "default": "sum",
              "description": "How a period’s days add up: sum for spending or steps, mean for an average, last for a balance."
            },
            "compare": {
              "const": false,
              "default": false,
              "description": "With the period’s compare: a stat’s delta is the change from the stretch before, and columns show both side by side."
            }
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A trend line of up to 60 points, oldest first, with the latest value and its change since the first point.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: leave it out when the page's title already says what the line is, such as a Net Worth page's trend."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^points(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "points": {
                "type": "array",
                "minItems": 2,
                "maxItems": 240,
                "items": {
                  "type": "number"
                }
              }
            },
            "required": [
              "points"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^start_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "start_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "Under the line's first point: the time it stands for, like \"12h ago\" or \"Oct 1\". A sparkline filled by a history rule gets it from its first reading unless this is set."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^end_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "end_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "Under the line's last point: \"Now\", \"Today\" or a date. A sparkline filled by a history rule gets it from its last reading unless this is set."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^labels(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "labels": {
                "type": "array",
                "minItems": 2,
                "maxItems": 240,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 24
                },
                "description": "What each point stands for, one per point, oldest first, like \"Jan\" or \"Oct 28\". A few are drawn under the line, and the point under the pointer shows its label. A sparkline filled by a history rule gets them from its readings unless this is set."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^shape(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "shape": {
                "enum": [
                  "smooth",
                  "sharp"
                ],
                "default": "smooth",
                "description": "How the points are joined: a smooth curve (smooth), or straight segments (sharp) for values that shouldn't read as passing through the ones in between."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^grid(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "grid": {
                "type": "boolean",
                "default": false,
                "description": "Lines across the chart at the axis's values. Off by default: the values down the leading edge stay either way."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "The most the value can be, such as a guest's memory or a disk's size. The chart then runs from zero up to it, with a dashed line there, and the value reads \"9.4 GB of 13 GB\". A value over it still shows."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^change(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "change": {
                "type": "boolean",
                "default": true,
                "description": "The badge beside the value saying how far it is from the first point (+4.2%, or the difference for a percentage). false leaves it out, for a reading whose change isn't news, such as a machine's CPU or memory. Turn it off when the change since the first point isn't news, as for CPU, memory or a battery."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^axis_labels(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "axis_labels": {
                "type": "array",
                "minItems": 2,
                "maxItems": 240,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 24
                },
                "description": "What's drawn under the line, one per point like labels, when it should be shorter than what the pointer shows: \"9 PM\" under the chart and \"8:54 PM\" on hover. Without it, labels are drawn there too."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^width(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "width": {
                "enum": [
                  "full",
                  "half"
                ],
                "default": "full",
                "description": "half: a small chart that shares a row with the half-width card beside it, such as CPU beside memory."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^times(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "times": {
                "type": "array",
                "minItems": 2,
                "maxItems": 500,
                "items": {
                  "type": [
                    "number",
                    "string"
                  ]
                },
                "description": "When each point was, one per point and in order: Unix seconds (or milliseconds) or ISO 8601. The points then sit at their moments rather than evenly, and the line breaks where readings stop for a while, such as a car asleep overnight."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^target(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "target": {
                "type": "number",
                "description": "A level the value is meant to reach or stay under, such as a car's charge limit: a dashed line, kept in view, and the value reads \"· Limit 80%\". Unlike max, the chart doesn't run from zero. Use it for the level a reading is meant to reach, such as a charge limit, instead of a separate card."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^target_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "target_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "The target's name beside the value. Target without one."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^right_unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "right_unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 8,
                "description": "With right_scale: a second scale on the right for the same line, in this unit, such as mi beside a battery's percentage."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^right_scale(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "right_scale": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "With right_unit: what one unit of the value is on the right scale, such as 3.25 miles for each percent of battery. The value reads \"69% · 224 mi\". Often filled from a source: range divided by level. One chart with two scales replaces two cards of the same quantity (a battery gauge beside a Range stat)."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^series(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "series": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16
                },
                "description": "Names the two lines of a card that draws a second one with points2, such as [\"WAN\", \"WAN2\"] or [\"Down\", \"Up\"]. Both lines share one scale; each reading is named beside a dot in its line's colour. No change badge, and no right_unit."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^points2(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "points2": {
                "type": "array",
                "maxItems": 240,
                "items": {
                  "type": "number"
                },
                "description": "With series: the second line's readings, oldest first. Without times, one per point of points. With times, give it times2: each line sits at its own moments, so a reading one line lacks is a gap in that line, never a made-up value. May be empty while the second line has no readings."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^times2(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "times2": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": [
                    "number",
                    "string"
                  ]
                },
                "description": "With times and points2: when each of points2's readings was, one per reading and in order."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^color(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "color": {
                "enum": [
                  "blue",
                  "teal",
                  "orange",
                  "purple",
                  "green",
                  "pink",
                  "yellow",
                  "red",
                  "rose",
                  "grey",
                  "slate",
                  "graphite",
                  "ink"
                ],
                "description": "The line's colour, by the breakdown card's names, such as graphite for a neutral chart beside other neutral cards. The accent without; give colour only when it means something."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^fill(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "fill": {
                "type": "boolean",
                "default": true,
                "description": "false draws the line alone, with no wash under it: a charge curve beside the route's ink."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^series(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^right_unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "if": {
              "required": [
                "series"
              ]
            },
            "then": {
              "not": {
                "required": [
                  "right_unit"
                ]
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "status": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "status"
        },
        "label": {
          "type": "string"
        },
        "state": {},
        "icon": {
          "type": "string",
          "description": "Optional SF Symbol drawn in place of the state's own, in the state's colour: a moon for a market that's closed. A name the Mac doesn't have shows the state's icon."
        },
        "detail": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "description": "Optional link a click on the card opens: legato://page/ID for a page with more (an alert's details), an https address, or plain http on the card's source's own address or a private network address, such as a server's web interface at http://192.168.1.20 or http://tower.local. Without buttons the whole card is the link; with them, the link is its own small button after them."
        },
        "width": {
          "default": "half",
          "description": "half (the default) shares a row with the half-width card beside it; full gives the card the whole row, as a page's main status above tiles. Give the one status that watches a service's overview the full width, in a closed Status heading at the top."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "state": {
                      "$ref": "#/definitions/rule"
                    },
                    "icon": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "url": {
                      "$ref": "#/definitions/rule"
                    },
                    "width": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|state|icon|detail|url|width)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "placement": {
          "const": "page_info",
          "description": "Optional. \"page_info\" draws this status or fleet card in Page Info's Health section, in full, instead of on the page. Only on a card on the page itself (not in a tab) and without buttons. While the worst of these cards isn't ok, the Page Info button shows its state's symbol in its colour (orange, red or grey); with all ok or off it stays plain. The light, notifications, Spotlight and History still read the card. Use it for a service overview's own health (version, \"No problems\") in place of a closed Status section."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "state": {
                "enum": [
                  "ok",
                  "warning",
                  "critical",
                  "unknown",
                  "off"
                ]
              },
              "icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "Optional SF Symbol drawn in place of the state's own, in the state's colour: a moon for a market that's closed. A name the Mac doesn't have shows the state's icon."
              },
              "detail": {
                "type": "string",
                "maxLength": 120
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https?://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (an alert's details), an https address, or plain http on the card's source's own address or a private network address, such as a server's web interface at http://192.168.1.20 or http://tower.local. Without buttons the whole card is the link; with them, the link is its own small button after them."
              },
              "width": {
                "enum": [
                  "half",
                  "full"
                ],
                "default": "half",
                "description": "half (the default) shares a row with the half-width card beside it; full gives the card the whole row, as a page's main status above tiles. Give the one status that watches a service's overview the full width, in a closed Status heading at the top."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "The health of one service or job.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^state(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "state": {
                "enum": [
                  "ok",
                  "warning",
                  "critical",
                  "unknown",
                  "off"
                ]
              }
            },
            "required": [
              "state"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^icon(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "Optional SF Symbol drawn in place of the state's own, in the state's colour: a moon for a market that's closed. A name the Mac doesn't have shows the state's icon."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 120
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^url(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https?://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (an alert's details), an https address, or plain http on the card's source's own address or a private network address, such as a server's web interface at http://192.168.1.20 or http://tower.local. Without buttons the whole card is the link; with them, the link is its own small button after them."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^width(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "width": {
                "enum": [
                  "half",
                  "full"
                ],
                "default": "half",
                "description": "half (the default) shares a row with the half-width card beside it; full gives the card the whole row, as a page's main status above tiles. Give the one status that watches a service's overview the full width, in a closed Status heading at the top."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "placement"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "actions"
                  ]
                },
                {
                  "required": [
                    "actions_placement"
                  ]
                },
                {
                  "required": [
                    "actions_align"
                  ]
                }
              ]
            }
          }
        }
      ]
    },
    "text": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "text"
        },
        "label": {
          "type": "string"
        },
        "body": {
          "type": "string",
          "description": ""
        },
        "tone": {
          "default": "neutral"
        },
        "icon": {
          "type": "string",
          "description": "Optional SF Symbol name, drawn before the body, in the tone's colour: with a tone, a callout."
        },
        "style": {
          "default": "plain",
          "description": "quote draws the body as a quotation, with a bar at its leading edge in the tone's colour. cover makes the card a page's front: the label large, the body under it. Use it for a page's first card only, usually with a fill."
        },
        "fill": {
          "description": "A soft tint with a fine grain behind the card, in place of the tone's: legatobar.com's blue, sky, lilac or green, deeper in dark mode. For a page's cover or a note that introduces a page, never for a state: a fill doesn't change the page's status, and status cards and tones are for states."
        },
        "note": {
          "type": "string",
          "description": "A short reading at the right of the title's line, such as \"68° in · 66° out\" on a car's Climate buttons. One line; often filled from a source. Needs a label. For a reading short enough to sit beside its title, instead of a card of its own."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "body": {
                      "$ref": "#/definitions/rule"
                    },
                    "tone": {
                      "$ref": "#/definitions/rule"
                    },
                    "icon": {
                      "$ref": "#/definitions/rule"
                    },
                    "style": {
                      "$ref": "#/definitions/rule"
                    },
                    "fill": {
                      "$ref": "#/definitions/rule"
                    },
                    "note": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|body|tone|icon|style|fill|note)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "placement": {
          "const": "title",
          "description": "Optional. \"title\" draws this text card's buttons in the page's title row, at its right, as large icons with their names in tooltips, like a window's toolbar: the page's controls. Only a card of buttons (actions, no body), on the page itself (not in a tab), without actions_placement or actions_align. On a sheet page in the window the card itself isn't drawn; elsewhere it's an ordinary card. Give an on/off pair one setting and turns, so it's one icon, lit while on. The person can hide any of them from the row (right-click it); hidden ones stay under ⋯. Spotlight and Shortcuts offer every one."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "body": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500,
                "description": ""
              },
              "tone": {
                "enum": [
                  "neutral",
                  "info",
                  "success",
                  "warning",
                  "critical"
                ],
                "default": "neutral"
              },
              "icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "Optional SF Symbol name, drawn before the body, in the tone's colour: with a tone, a callout."
              },
              "style": {
                "enum": [
                  "plain",
                  "quote",
                  "cover"
                ],
                "default": "plain",
                "description": "quote draws the body as a quotation, with a bar at its leading edge in the tone's colour. cover makes the card a page's front: the label large, the body under it. Use it for a page's first card only, usually with a fill."
              },
              "fill": {
                "enum": [
                  "blue",
                  "sky",
                  "lilac",
                  "green"
                ],
                "description": "A soft tint with a fine grain behind the card, in place of the tone's: legatobar.com's blue, sky, lilac or green, deeper in dark mode. For a page's cover or a note that introduces a page, never for a state: a fill doesn't change the page's status, and status cards and tones are for states."
              },
              "note": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40,
                "description": "A short reading at the right of the title's line, such as \"68° in · 66° out\" on a car's Climate buttons. One line; often filled from a source. Needs a label. For a reading short enough to sit beside its title, instead of a card of its own."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A note from the agent, up to 500 characters; a tone tints it, and an icon makes it a callout. Inline formatting works: **bold**, *italic*, ~~strikethrough~~, `code` and [links](https://example.com) (https, or mailto: with one address). Block Markdown (headings, lists, code fences) doesn't; use the card types for those. A literal * or _ that should stay can be escaped with \\.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^body(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "body": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500,
                "description": ""
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^tone(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "tone": {
                "enum": [
                  "neutral",
                  "info",
                  "success",
                  "warning",
                  "critical"
                ],
                "default": "neutral"
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^icon(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "Optional SF Symbol name, drawn before the body, in the tone's colour: with a tone, a callout."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^style(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "style": {
                "enum": [
                  "plain",
                  "quote",
                  "cover"
                ],
                "default": "plain",
                "description": "quote draws the body as a quotation, with a bar at its leading edge in the tone's colour. cover makes the card a page's front: the label large, the body under it. Use it for a page's first card only, usually with a fill."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^fill(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "fill": {
                "enum": [
                  "blue",
                  "sky",
                  "lilac",
                  "green"
                ],
                "description": "A soft tint with a fine grain behind the card, in place of the tone's: legatobar.com's blue, sky, lilac or green, deeper in dark mode. For a page's cover or a note that introduces a page, never for a state: a fill doesn't change the page's status, and status cards and tones are for states."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^note(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "note": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40,
                "description": "A short reading at the right of the title's line, such as \"68° in · 66° out\" on a car's Climate buttons. One line; often filled from a source. Needs a label. For a reading short enough to sit beside its title, instead of a card of its own."
              }
            }
          }
        },
        {
          "anyOf": [
            {
              "required": [
                "body"
              ]
            },
            {
              "required": [
                "actions"
              ]
            },
            {
              "required": [
                "source"
              ]
            },
            {
              "required": [
                "periods"
              ]
            }
          ]
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "placement"
            ]
          },
          "then": {
            "required": [
              "actions"
            ],
            "not": {
              "anyOf": [
                {
                  "required": [
                    "body"
                  ]
                },
                {
                  "required": [
                    "actions_placement"
                  ]
                },
                {
                  "required": [
                    "actions_align"
                  ]
                }
              ]
            }
          }
        }
      ]
    },
    "link": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "link"
        },
        "label": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "description": "An https address, or legato://page/ID to show another of your pages (its id as legato list shows it)."
        },
        "detail": {
          "type": "string",
          "description": "Optional line under the label, like a song's name or what's at the link."
        },
        "icon": {
          "type": "string",
          "description": "Optional SF Symbol name in place of the default compass, like music.note or doc.text."
        },
        "tone": {
          "default": "neutral",
          "description": "Colours the icon: info blue, success green, warning orange, critical red."
        },
        "layout": {
          "default": "button",
          "description": "button: a full-width button, the default. tile: a half-width card that pairs with the next half-width card, its icon beside the label and the detail under it; the whole card is the link, showing its arrow under the pointer. For a grid of places to go, each with a line of state: rooms with how many lights are on."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "url": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "icon": {
                      "$ref": "#/definitions/rule"
                    },
                    "tone": {
                      "$ref": "#/definitions/rule"
                    },
                    "layout": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|url|detail|icon|tone|layout)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "An https address, or legato://page/ID to show another of your pages (its id as legato list shows it)."
              },
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "Optional line under the label, like a song's name or what's at the link."
              },
              "icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "Optional SF Symbol name in place of the default compass, like music.note or doc.text."
              },
              "tone": {
                "enum": [
                  "neutral",
                  "info",
                  "success",
                  "warning",
                  "critical"
                ],
                "default": "neutral",
                "description": "Colours the icon: info blue, success green, warning orange, critical red."
              },
              "layout": {
                "enum": [
                  "button",
                  "tile"
                ],
                "default": "button",
                "description": "button: a full-width button, the default. tile: a half-width card that pairs with the next half-width card, its icon beside the label and the detail under it; the whole card is the link, showing its arrow under the pointer. For a grid of places to go, each with a line of state: rooms with how many lights are on."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A button that opens an https URL, or shows another page with legato://page/ID, after a click, with an optional icon and a second line.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^url(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "An https address, or legato://page/ID to show another of your pages (its id as legato list shows it)."
              }
            },
            "required": [
              "url"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "Optional line under the label, like a song's name or what's at the link."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^icon(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "Optional SF Symbol name in place of the default compass, like music.note or doc.text."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^tone(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "tone": {
                "enum": [
                  "neutral",
                  "info",
                  "success",
                  "warning",
                  "critical"
                ],
                "default": "neutral",
                "description": "Colours the icon: info blue, success green, warning orange, critical red."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^layout(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "layout": {
                "enum": [
                  "button",
                  "tile"
                ],
                "default": "button",
                "description": "button: a full-width button, the default. tile: a half-width card that pairs with the next half-width card, its icon beside the label and the detail under it; the whole card is the link, showing its arrow under the pointer. For a grid of places to go, each with a line of state: rooms with how many lights are on."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "countdown": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "countdown"
        },
        "label": {
          "type": "string"
        },
        "at": {
          "type": [
            "string",
            "number"
          ],
          "description": "When it happens: an ISO 8601 date-time with seconds and a zone, like 2026-10-24T19:15:00-04:00, or Unix seconds, as a service such as a weather API sends a sunset."
        },
        "detail": {
          "type": "string"
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "at": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|at|detail)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "at": {
                "type": [
                  "string",
                  "number"
                ],
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                "description": "When it happens: an ISO 8601 date-time with seconds and a zone, like 2026-10-24T19:15:00-04:00, or Unix seconds, as a service such as a weather API sends a sunset.",
                "minimum": 0
              },
              "detail": {
                "type": "string",
                "maxLength": 120
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Time until a moment: a flight boards, a domain renews. The Mac counts down on its own between writes.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^at(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "at": {
                "type": [
                  "string",
                  "number"
                ],
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                "description": "When it happens: an ISO 8601 date-time with seconds and a zone, like 2026-10-24T19:15:00-04:00, or Unix seconds, as a service such as a weather API sends a sunset.",
                "minimum": 0
              }
            },
            "required": [
              "at"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 120
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "window": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "window"
        },
        "label": {
          "type": "string",
          "description": "The headline in the window, like \"Daylight left\". Default \"Left\"."
        },
        "before_label": {
          "type": "string",
          "description": "The headline before it starts, like \"Until sunrise\" or \"Opens in\". Default \"Starts in\"."
        },
        "after_label": {
          "type": "string",
          "description": "The headline after it ends: counting to next_start when there is one (default \"Starts in\"), else since the end (default \"Ended\")."
        },
        "start": {
          "type": [
            "string",
            "number"
          ],
          "description": "When it starts: ISO 8601 with seconds and a zone, or Unix seconds as services send it."
        },
        "end": {
          "type": [
            "string",
            "number"
          ],
          "description": "When it ends, after the start and within a day of it. A window may cross midnight."
        },
        "next_start": {
          "type": [
            "string",
            "number"
          ],
          "description": "When it next starts, in either form, so the time after it counts down to that."
        },
        "start_label": {
          "type": "string",
          "description": "Words before the start's time under the bar, like \"Sunrise\"."
        },
        "end_label": {
          "type": "string",
          "description": "Words before the end's time under the bar, like \"Sunset\"."
        },
        "detail": {
          "type": "string",
          "description": "A line under the bar."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "before_label": {
                      "$ref": "#/definitions/rule"
                    },
                    "after_label": {
                      "$ref": "#/definitions/rule"
                    },
                    "start": {
                      "$ref": "#/definitions/rule"
                    },
                    "end": {
                      "$ref": "#/definitions/rule"
                    },
                    "next_start": {
                      "$ref": "#/definitions/rule"
                    },
                    "start_label": {
                      "$ref": "#/definitions/rule"
                    },
                    "end_label": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|before_label|after_label|start|end|next_start|start_label|end_label|detail)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "The headline in the window, like \"Daylight left\". Default \"Left\"."
              },
              "before_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "The headline before it starts, like \"Until sunrise\" or \"Opens in\". Default \"Starts in\"."
              },
              "after_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "The headline after it ends: counting to next_start when there is one (default \"Starts in\"), else since the end (default \"Ended\")."
              },
              "start": {
                "type": [
                  "string",
                  "number"
                ],
                "minimum": 0,
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                "description": "When it starts: ISO 8601 with seconds and a zone, or Unix seconds as services send it."
              },
              "end": {
                "type": [
                  "string",
                  "number"
                ],
                "minimum": 0,
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                "description": "When it ends, after the start and within a day of it. A window may cross midnight."
              },
              "next_start": {
                "type": [
                  "string",
                  "number"
                ],
                "minimum": 0,
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                "description": "When it next starts, in either form, so the time after it counts down to that."
              },
              "start_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "Words before the start's time under the bar, like \"Sunrise\"."
              },
              "end_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "Words before the end's time under the bar, like \"Sunset\"."
              },
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "A line under the bar."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A window of time on the day, midnight to midnight, with now on it: daylight between sunrise and sunset, a store's hours, off-peak charging. Counts down the time left in it, or until it starts.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "The headline in the window, like \"Daylight left\". Default \"Left\"."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^before_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "before_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "The headline before it starts, like \"Until sunrise\" or \"Opens in\". Default \"Starts in\"."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^after_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "after_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "The headline after it ends: counting to next_start when there is one (default \"Starts in\"), else since the end (default \"Ended\")."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^start(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "start": {
                "type": [
                  "string",
                  "number"
                ],
                "minimum": 0,
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                "description": "When it starts: ISO 8601 with seconds and a zone, or Unix seconds as services send it."
              }
            },
            "required": [
              "start"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^end(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "end": {
                "type": [
                  "string",
                  "number"
                ],
                "minimum": 0,
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                "description": "When it ends, after the start and within a day of it. A window may cross midnight."
              }
            },
            "required": [
              "end"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^next_start(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "next_start": {
                "type": [
                  "string",
                  "number"
                ],
                "minimum": 0,
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                "description": "When it next starts, in either form, so the time after it counts down to that."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^start_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "start_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "Words before the start's time under the bar, like \"Sunrise\"."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^end_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "end_label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "Words before the end's time under the bar, like \"Sunset\"."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "A line under the bar."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "mapCard": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "map"
        },
        "label": {
          "type": "string"
        },
        "pins": {
          "type": "array",
          "description": "Up to 10 places, each opening in Maps when clicked. A source fills them with pins[0].lat and so on, or with each for several, such as a parcel's scans: { \"each\": \"events\", \"sort\": { \"by\": \"date\", \"as\": \"date\" }, \"collapse\": \"location\", \"last\": 10, \"fields\": { \"place\": \"location\" } }.",
          "items": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              },
              "label": {
                "type": "string",
                "description": "Under the pin, and the place's name in Maps."
              },
              "icon": {
                "type": "string",
                "description": "An SF Symbol in the pin, like car.fill; a plain dot without one."
              },
              "place": {
                "type": "string",
                "description": "The place in words, such as \"Anaheim, CA 92899\", for a pin without lat and lon: Legato looks it up with Apple Maps after the page is drawn and keeps the answer on this Mac. A lat and lon win when both are given."
              }
            },
            "additionalProperties": false,
            "anyOf": [
              {},
              {}
            ],
            "dependencies": {
              "lat": [
                "lon"
              ],
              "lon": [
                "lat"
              ]
            }
          }
        },
        "radius": {
          "type": "number",
          "description": "How far around the pins the map shows, in metres. Without it, enough to show every pin, and at least 400 m."
        },
        "detail": {
          "type": "string",
          "description": "A line under the map."
        },
        "url": {
          "type": "string",
          "description": "Where a click off the pins goes instead of Maps: an https address, or legato://page/ID."
        },
        "route": {
          "type": "boolean",
          "default": false,
          "description": "The pins are stops in order, oldest first, joined by a dashed line: where a package was scanned, not a calculated route. The earlier stops are small dots, and the last stop is drawn with route_icon, once its own place is found. A stop that isn't found breaks the line."
        },
        "route_icon": {
          "type": "string",
          "description": "The SF Symbol on a route's last stop; box.truck.fill without one."
        },
        "open_maps": {
          "type": "boolean",
          "default": true,
          "description": "False opens nothing in Maps: a click on a pin or the map does nothing, unless url is given. For a map that only shows where things are, such as a package's route."
        },
        "track": {
          "type": "array",
          "description": "A recorded path, oldest first, such as a drive's route: one solid line, a hollow dot where it starts and a filled one where it ends, the map framed on it. Points off the globe (or 0,0) are left out. Thin a long one with buckets.",
          "items": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number"
              },
              "lon": {
                "type": "number"
              }
            },
            "additionalProperties": false
          }
        },
        "height": {
          "type": "number",
          "description": "The map's height in points; 150 without it. A route deserves more (300)."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "pins": {
                      "$ref": "#/definitions/rule"
                    },
                    "radius": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "url": {
                      "$ref": "#/definitions/rule"
                    },
                    "route": {
                      "$ref": "#/definitions/rule"
                    },
                    "route_icon": {
                      "$ref": "#/definitions/rule"
                    },
                    "open_maps": {
                      "$ref": "#/definitions/rule"
                    },
                    "track": {
                      "$ref": "#/definitions/rule"
                    },
                    "height": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|pins|radius|detail|url|route|route_icon|open_maps|track|height)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "pins": {
                "type": "array",
                "maxItems": 10,
                "description": "Up to 10 places, each opening in Maps when clicked. A source fills them with pins[0].lat and so on, or with each for several, such as a parcel's scans: { \"each\": \"events\", \"sort\": { \"by\": \"date\", \"as\": \"date\" }, \"collapse\": \"location\", \"last\": 10, \"fields\": { \"place\": \"location\" } }.",
                "items": {
                  "type": "object",
                  "properties": {
                    "lat": {
                      "type": "number",
                      "minimum": -90,
                      "maximum": 90
                    },
                    "lon": {
                      "type": "number",
                      "minimum": -180,
                      "maximum": 180
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "Under the pin, and the place's name in Maps."
                    },
                    "icon": {
                      "type": "string",
                      "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                      "maxLength": 64,
                      "description": "An SF Symbol in the pin, like car.fill; a plain dot without one."
                    },
                    "place": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "The place in words, such as \"Anaheim, CA 92899\", for a pin without lat and lon: Legato looks it up with Apple Maps after the page is drawn and keeps the answer on this Mac. A lat and lon win when both are given."
                    }
                  },
                  "additionalProperties": false,
                  "anyOf": [
                    {
                      "required": [
                        "lat",
                        "lon"
                      ]
                    },
                    {
                      "required": [
                        "place"
                      ]
                    }
                  ],
                  "dependencies": {
                    "lat": [
                      "lon"
                    ],
                    "lon": [
                      "lat"
                    ]
                  }
                }
              },
              "radius": {
                "type": "number",
                "minimum": 50,
                "maximum": 5000000,
                "description": "How far around the pins the map shows, in metres. Without it, enough to show every pin, and at least 400 m."
              },
              "detail": {
                "type": "string",
                "maxLength": 200,
                "description": "A line under the map."
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Where a click off the pins goes instead of Maps: an https address, or legato://page/ID."
              },
              "route": {
                "type": "boolean",
                "default": false,
                "description": "The pins are stops in order, oldest first, joined by a dashed line: where a package was scanned, not a calculated route. The earlier stops are small dots, and the last stop is drawn with route_icon, once its own place is found. A stop that isn't found breaks the line."
              },
              "route_icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "The SF Symbol on a route's last stop; box.truck.fill without one."
              },
              "open_maps": {
                "type": "boolean",
                "default": true,
                "description": "False opens nothing in Maps: a click on a pin or the map does nothing, unless url is given. For a map that only shows where things are, such as a package's route."
              },
              "track": {
                "type": "array",
                "maxItems": 3000,
                "description": "A recorded path, oldest first, such as a drive's route: one solid line, a hollow dot where it starts and a filled one where it ends, the map framed on it. Points off the globe (or 0,0) are left out. Thin a long one with buckets.",
                "items": {
                  "type": "object",
                  "properties": {
                    "lat": {
                      "type": "number",
                      "minimum": -90,
                      "maximum": 90
                    },
                    "lon": {
                      "type": "number",
                      "minimum": -180,
                      "maximum": 180
                    }
                  },
                  "required": [
                    "lat",
                    "lon"
                  ],
                  "additionalProperties": false
                }
              },
              "height": {
                "type": "number",
                "minimum": 120,
                "maximum": 600,
                "description": "The map's height in points; 150 without it. A route deserves more (300)."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Places on a map: a car, a package, a trip's stops. Apple's map in its muted style around the pins, held still (no dragging or zooming), each pin a dot in the accent colour with its label; a click on a pin opens it in Maps, elsewhere the area around the pins (open_maps false turns both off). A pin is a lat and lon, or a place in words that Legato looks up with Apple Maps and keeps on this Mac; until one is found the card says Locating…, and Couldn't find these places on the map when none is. With route, the pins are stops oldest first, joined by a dashed line (the scan history, not a calculated route), the last drawn with route_icon. With no pins yet (a source that hasn't answered) it says No location yet.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^pins(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "pins": {
                "type": "array",
                "maxItems": 10,
                "description": "Up to 10 places, each opening in Maps when clicked. A source fills them with pins[0].lat and so on, or with each for several, such as a parcel's scans: { \"each\": \"events\", \"sort\": { \"by\": \"date\", \"as\": \"date\" }, \"collapse\": \"location\", \"last\": 10, \"fields\": { \"place\": \"location\" } }.",
                "items": {
                  "type": "object",
                  "properties": {
                    "lat": {
                      "type": "number",
                      "minimum": -90,
                      "maximum": 90
                    },
                    "lon": {
                      "type": "number",
                      "minimum": -180,
                      "maximum": 180
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "Under the pin, and the place's name in Maps."
                    },
                    "icon": {
                      "type": "string",
                      "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                      "maxLength": 64,
                      "description": "An SF Symbol in the pin, like car.fill; a plain dot without one."
                    },
                    "place": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "The place in words, such as \"Anaheim, CA 92899\", for a pin without lat and lon: Legato looks it up with Apple Maps after the page is drawn and keeps the answer on this Mac. A lat and lon win when both are given."
                    }
                  },
                  "additionalProperties": false,
                  "anyOf": [
                    {
                      "required": [
                        "lat",
                        "lon"
                      ]
                    },
                    {
                      "required": [
                        "place"
                      ]
                    }
                  ],
                  "dependencies": {
                    "lat": [
                      "lon"
                    ],
                    "lon": [
                      "lat"
                    ]
                  }
                }
              }
            },
            "required": [
              "pins"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^radius(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "radius": {
                "type": "number",
                "minimum": 50,
                "maximum": 5000000,
                "description": "How far around the pins the map shows, in metres. Without it, enough to show every pin, and at least 400 m."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 200,
                "description": "A line under the map."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^url(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Where a click off the pins goes instead of Maps: an https address, or legato://page/ID."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^route(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "route": {
                "type": "boolean",
                "default": false,
                "description": "The pins are stops in order, oldest first, joined by a dashed line: where a package was scanned, not a calculated route. The earlier stops are small dots, and the last stop is drawn with route_icon, once its own place is found. A stop that isn't found breaks the line."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^route_icon(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "route_icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "The SF Symbol on a route's last stop; box.truck.fill without one."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^open_maps(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "open_maps": {
                "type": "boolean",
                "default": true,
                "description": "False opens nothing in Maps: a click on a pin or the map does nothing, unless url is given. For a map that only shows where things are, such as a package's route."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^track(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "track": {
                "type": "array",
                "maxItems": 3000,
                "description": "A recorded path, oldest first, such as a drive's route: one solid line, a hollow dot where it starts and a filled one where it ends, the map framed on it. Points off the globe (or 0,0) are left out. Thin a long one with buckets.",
                "items": {
                  "type": "object",
                  "properties": {
                    "lat": {
                      "type": "number",
                      "minimum": -90,
                      "maximum": 90
                    },
                    "lon": {
                      "type": "number",
                      "minimum": -180,
                      "maximum": 180
                    }
                  },
                  "required": [
                    "lat",
                    "lon"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^height(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "height": {
                "type": "number",
                "minimum": 120,
                "maximum": 600,
                "description": "The map's height in points; 150 without it. A route deserves more (300)."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "facts": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "facts"
        },
        "label": {
          "type": "string"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "value": {
                "type": [
                  "string",
                  "number"
                ]
              },
              "icon": {
                "type": "string",
                "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
              },
              "color": {
                "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
              },
              "url": {
                "type": "string",
                "description": "Optional link the line opens when it's clicked: legato://page/ID for a page with more about it, or an https address."
              }
            },
            "additionalProperties": false
          },
          "description": "Put the row people check most first, then the rest longest value to shortest, so the right column steps down."
        },
        "muted": {
          "type": "boolean",
          "default": false,
          "description": "true shows each row's label in grey, so the values stand out."
        },
        "layout": {
          "default": "rows",
          "description": "wheels: exactly four items drawn by the wheels of a car seen from above, in the order front left, front right, rear left, rear right, such as tire pressures. An item's color colours its value, so a low tire reads orange by its wheel; grey is the text colour, for a rule's \"nothing wrong\". Any other count is drawn as rows. figures: two to four items side by side, each a large figure with its key under it, the first in the text colour and the rest in grey, such as inside and outside temperatures. line: two to six items on one quiet line, each value then its key in grey, such as a period's totals under its picker (190 mi 16 drives, 228 Wh/mi); it wraps to a column when the card is too narrow."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "muted": {
                      "$ref": "#/definitions/rule"
                    },
                    "layout": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|items|muted|layout)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 12,
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "value": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link the line opens when it's clicked: legato://page/ID for a page with more about it, or an https address."
                    }
                  },
                  "required": [
                    "key",
                    "value"
                  ],
                  "additionalProperties": false
                },
                "description": "Put the row people check most first, then the rest longest value to shortest, so the right column steps down."
              },
              "muted": {
                "type": "boolean",
                "default": false,
                "description": "true shows each row's label in grey, so the values stand out."
              },
              "layout": {
                "enum": [
                  "rows",
                  "wheels",
                  "figures",
                  "line"
                ],
                "default": "rows",
                "description": "wheels: exactly four items drawn by the wheels of a car seen from above, in the order front left, front right, rear left, rear right, such as tire pressures. An item's color colours its value, so a low tire reads orange by its wheel; grey is the text colour, for a rule's \"nothing wrong\". Any other count is drawn as rows. figures: two to four items side by side, each a large figure with its key under it, the first in the text colour and the rest in grey, such as inside and outside temperatures. line: two to six items on one quiet line, each value then its key in grey, such as a period's totals under its picker (190 mi 16 drives, 228 Wh/mi); it wraps to a column when the card is too narrow."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Up to 12 key and value pairs: order number, carrier, ETA.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 12,
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "value": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link the line opens when it's clicked: legato://page/ID for a page with more about it, or an https address."
                    }
                  },
                  "required": [
                    "key",
                    "value"
                  ],
                  "additionalProperties": false
                },
                "description": "Put the row people check most first, then the rest longest value to shortest, so the right column steps down."
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^muted(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "muted": {
                "type": "boolean",
                "default": false,
                "description": "true shows each row's label in grey, so the values stand out."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^layout(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "layout": {
                "enum": [
                  "rows",
                  "wheels",
                  "figures",
                  "line"
                ],
                "default": "rows",
                "description": "wheels: exactly four items drawn by the wheels of a car seen from above, in the order front left, front right, rear left, rear right, such as tire pressures. An item's color colours its value, so a low tire reads orange by its wheel; grey is the text colour, for a rule's \"nothing wrong\". Any other count is drawn as rows. figures: two to four items side by side, each a large figure with its key under it, the first in the text colour and the rest in grey, such as inside and outside temperatures. line: two to six items on one quiet line, each value then its key in grey, such as a period's totals under its picker (190 mi 16 drives, 228 Wh/mi); it wraps to a column when the card is too narrow."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "gauge": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "gauge"
        },
        "label": {
          "type": "string"
        },
        "value": {
          "type": "number"
        },
        "min": {
          "type": "number",
          "default": 0
        },
        "max": {
          "type": "number",
          "description": "Must be greater than min."
        },
        "unit": {
          "type": "string"
        },
        "bands": {
          "type": "array",
          "description": "Coloured ranges along the gauge. The band the value falls in colours the number and counts toward the page's status and its notifications.",
          "items": {
            "type": "object",
            "properties": {
              "from": {
                "type": "number",
                "description": "Defaults to min."
              },
              "to": {
                "type": "number",
                "description": "Defaults to max."
              },
              "state": {}
            },
            "additionalProperties": false
          }
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "value": {
                      "$ref": "#/definitions/rule"
                    },
                    "min": {
                      "$ref": "#/definitions/rule"
                    },
                    "max": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "bands": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|value|min|max|unit|bands)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "value": {
                "type": "number"
              },
              "min": {
                "type": "number",
                "default": 0
              },
              "max": {
                "type": "number",
                "description": "Must be greater than min."
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              },
              "bands": {
                "type": "array",
                "minItems": 1,
                "maxItems": 6,
                "description": "Coloured ranges along the gauge. The band the value falls in colours the number and counts toward the page's status and its notifications.",
                "items": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "number",
                      "description": "Defaults to min."
                    },
                    "to": {
                      "type": "number",
                      "description": "Defaults to max."
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical"
                      ]
                    }
                  },
                  "required": [
                    "state"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A value within a range, with coloured bands: CPU temperature, air quality, glucose.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^value(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "value": {
                "type": "number"
              }
            },
            "required": [
              "value"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^min(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "min": {
                "type": "number",
                "default": 0
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max": {
                "type": "number",
                "description": "Must be greater than min."
              }
            },
            "required": [
              "max"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^bands(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "bands": {
                "type": "array",
                "minItems": 1,
                "maxItems": 6,
                "description": "Coloured ranges along the gauge. The band the value falls in colours the number and counts toward the page's status and its notifications.",
                "items": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "number",
                      "description": "Defaults to min."
                    },
                    "to": {
                      "type": "number",
                      "description": "Defaults to max."
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical"
                      ]
                    }
                  },
                  "required": [
                    "state"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "bars": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "bars"
        },
        "label": {
          "type": "string"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "value": {
                "type": "number"
              },
              "icon": {
                "type": "string",
                "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
              },
              "color": {
                "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
              },
              "url": {
                "type": "string",
                "description": "Optional link the row opens when clicked, as a list row's does: legato://page/ID for a page with more (with ?name=value for a page that takes params), or an https address."
              }
            },
            "additionalProperties": false
          }
        },
        "unit": {
          "type": "string"
        },
        "max": {
          "type": "number",
          "description": "The value a full bar stands for. Defaults to the largest value."
        },
        "fit": {
          "type": "boolean",
          "default": false,
          "description": "Shows as many rows as keep the page within the sidebar's length (or Settings → Appearance → Minimum height), at least 5, with Show N more only when some are left out. Without the sidebar or a minimum height, every row shows."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "max": {
                      "$ref": "#/definitions/rule"
                    },
                    "fit": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|items|unit|max|fit)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "value": {
                      "type": "number",
                      "minimum": 0
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link the row opens when clicked, as a list row's does: legato://page/ID for a page with more (with ?name=value for a page that takes params), or an https address."
                    }
                  },
                  "required": [
                    "label",
                    "value"
                  ],
                  "additionalProperties": false
                }
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              },
              "max": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "The value a full bar stands for. Defaults to the largest value."
              },
              "fit": {
                "type": "boolean",
                "default": false,
                "description": "Shows as many rows as keep the page within the sidebar's length (or Settings → Appearance → Minimum height), at least 5, with Show N more only when some are left out. Without the sidebar or a minimum height, every row shows."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A few categories compared as horizontal bars: spend by category, votes.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "value": {
                      "type": "number",
                      "minimum": 0
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link the row opens when clicked, as a list row's does: legato://page/ID for a page with more (with ?name=value for a page that takes params), or an https address."
                    }
                  },
                  "required": [
                    "label",
                    "value"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "The value a full bar stands for. Defaults to the largest value."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^fit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "fit": {
                "type": "boolean",
                "default": false,
                "description": "Shows as many rows as keep the page within the sidebar's length (or Settings → Appearance → Minimum height), at least 5, with Show N more only when some are left out. Without the sidebar or a minimum height, every row shows."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "breakdown": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "breakdown"
        },
        "label": {
          "type": "string"
        },
        "items": {
          "type": "array",
          "description": "The parts, in the order the bar and legend draw them, largest first is usually clearest.",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "value": {
                "type": "number"
              },
              "color": {
                "description": "A named colour, drawn in the system's shade for light or dark mode (purple in a deeper violet than the system's, which leans pink). Leave it out and items take blue, teal, orange, purple, green, pink, yellow and grey in order, skipping colours other items name. Name one to keep a category the same colour across pages."
              },
              "icon": {
                "type": "string",
                "description": "Optional icon for the part: an SF Symbol name (moon.zzz), or a logo as on other cards (si:, di:, mdi:, site:). It sits before the part's label in its colour: in the legend in place of the colour dot, and at the start of a rows row. Never inside the bar."
              }
            },
            "additionalProperties": false
          }
        },
        "layout": {
          "default": "bar",
          "description": "bar: one bar in coloured segments over a legend, the default. rows: each part its own bar, the length its segment has in the one bar (its value over the sum, or over the target), with its value and share of the parts beside it. Rows suit parts compared with each other, like a night's sleep stages or plans by signups; bar suits one whole."
        },
        "unit": {
          "type": "string"
        },
        "total": {
          "type": "number",
          "description": "The headline when it isn't the items' sum, like net worth after debts. Say what it leaves out in detail."
        },
        "target": {
          "type": "number",
          "description": "A budget the parts fill: the bar's full width stands for it, and the headline reads \"$2,140 of $3,200\"."
        },
        "elapsed": {
          "type": "number",
          "description": "With a target, the fraction of the period gone, 0 to 1: a tick marks pace, as on a pacing card."
        },
        "detail": {
          "type": "string",
          "description": "A line under the legend."
        },
        "url": {
          "type": "string",
          "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. Without buttons the whole card is the link; with them, the link is its own small button after them."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "layout": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "total": {
                      "$ref": "#/definitions/rule"
                    },
                    "target": {
                      "$ref": "#/definitions/rule"
                    },
                    "elapsed": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "url": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|items|layout|unit|total|target|elapsed|detail|url)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "items": {
                "type": "array",
                "minItems": 2,
                "maxItems": 6,
                "description": "The parts, in the order the bar and legend draw them, largest first is usually clearest.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "value": {
                      "type": "number",
                      "minimum": 0
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "A named colour, drawn in the system's shade for light or dark mode (purple in a deeper violet than the system's, which leans pink). Leave it out and items take blue, teal, orange, purple, green, pink, yellow and grey in order, skipping colours other items name. Name one to keep a category the same colour across pages."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon for the part: an SF Symbol name (moon.zzz), or a logo as on other cards (si:, di:, mdi:, site:). It sits before the part's label in its colour: in the legend in place of the colour dot, and at the start of a rows row. Never inside the bar."
                    }
                  },
                  "required": [
                    "label",
                    "value"
                  ],
                  "additionalProperties": false
                }
              },
              "layout": {
                "enum": [
                  "bar",
                  "rows"
                ],
                "default": "bar",
                "description": "bar: one bar in coloured segments over a legend, the default. rows: each part its own bar, the length its segment has in the one bar (its value over the sum, or over the target), with its value and share of the parts beside it. Rows suit parts compared with each other, like a night's sleep stages or plans by signups; bar suits one whole."
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              },
              "total": {
                "type": "number",
                "description": "The headline when it isn't the items' sum, like net worth after debts. Say what it leaves out in detail."
              },
              "target": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "A budget the parts fill: the bar's full width stands for it, and the headline reads \"$2,140 of $3,200\"."
              },
              "elapsed": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "With a target, the fraction of the period gone, 0 to 1: a tick marks pace, as on a pacing card."
              },
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "A line under the legend."
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. Without buttons the whole card is the link; with them, the link is its own small button after them."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Parts of one whole as one bar in coloured segments with a legend, or as a bar each (layout rows): net worth by asset, a month's spend by category. With a target, the bar's width is the target and the segments fill it, as a pacing bar does.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "minItems": 2,
                "maxItems": 6,
                "description": "The parts, in the order the bar and legend draw them, largest first is usually clearest.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "value": {
                      "type": "number",
                      "minimum": 0
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "A named colour, drawn in the system's shade for light or dark mode (purple in a deeper violet than the system's, which leans pink). Leave it out and items take blue, teal, orange, purple, green, pink, yellow and grey in order, skipping colours other items name. Name one to keep a category the same colour across pages."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon for the part: an SF Symbol name (moon.zzz), or a logo as on other cards (si:, di:, mdi:, site:). It sits before the part's label in its colour: in the legend in place of the colour dot, and at the start of a rows row. Never inside the bar."
                    }
                  },
                  "required": [
                    "label",
                    "value"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^layout(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "layout": {
                "enum": [
                  "bar",
                  "rows"
                ],
                "default": "bar",
                "description": "bar: one bar in coloured segments over a legend, the default. rows: each part its own bar, the length its segment has in the one bar (its value over the sum, or over the target), with its value and share of the parts beside it. Rows suit parts compared with each other, like a night's sleep stages or plans by signups; bar suits one whole."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^total(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "total": {
                "type": "number",
                "description": "The headline when it isn't the items' sum, like net worth after debts. Say what it leaves out in detail."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^target(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "target": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "A budget the parts fill: the bar's full width stands for it, and the headline reads \"$2,140 of $3,200\"."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^elapsed(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "elapsed": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "With a target, the fraction of the period gone, 0 to 1: a tick marks pace, as on a pacing card."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "A line under the legend."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^url(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. Without buttons the whole card is the link; with them, the link is its own small button after them."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "flow": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "flow"
        },
        "label": {
          "type": "string"
        },
        "links": {
          "type": "array",
          "description": "What goes where: one link per source and destination, with its amount. From up to 6 sources to up to 8 destinations.",
          "items": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "description": "The source's label."
              },
              "to": {
                "type": "string",
                "description": "The destination's label."
              },
              "value": {
                "type": "number"
              }
            },
            "additionalProperties": false
          }
        },
        "from": {
          "type": "array",
          "description": "Optional. The sources in the order to draw them, with colours. Left out, they're the links' sources in the order they first appear. Every link must come from one of them.",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "description": "The source's name, as links name it."
              },
              "color": {
                "description": "A named colour, as on a breakdown. Sources left without one take blue, teal, orange, purple, green, pink and yellow in order, skipping colours other sources name; destinations left without one are grey. A band takes its source's colour."
              }
            },
            "additionalProperties": false
          }
        },
        "to": {
          "type": "array",
          "description": "Optional. The destinations in the order to draw them, with colours. Left out, as from. Every link must go to one of them.",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "description": "The destination's name, as links name it."
              },
              "color": {
                "description": "A named colour, as on a breakdown. Sources left without one take blue, teal, orange, purple, green, pink and yellow in order, skipping colours other sources name; destinations left without one are grey. A band takes its source's colour."
              }
            },
            "additionalProperties": false
          }
        },
        "unit": {
          "type": "string"
        },
        "detail": {
          "type": "string",
          "description": "A line under the chart."
        },
        "hide_amounts": {
          "type": "boolean",
          "default": false,
          "description": "Leave out the amount under each source's name. The headline total and each destination's share stay."
        },
        "url": {
          "type": "string",
          "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. Without buttons the whole card is the link; with them, the link is its own small button after them."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "links": {
                      "$ref": "#/definitions/rule"
                    },
                    "from": {
                      "$ref": "#/definitions/rule"
                    },
                    "to": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "hide_amounts": {
                      "$ref": "#/definitions/rule"
                    },
                    "url": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|links|from|to|unit|detail|hide_amounts|url)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "array",
                "minItems": 1,
                "maxItems": 6,
                "description": "Optional. The sources in the order to draw them, with colours. Left out, they're the links' sources in the order they first appear. Every link must come from one of them.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "The source's name, as links name it."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "A named colour, as on a breakdown. Sources left without one take blue, teal, orange, purple, green, pink and yellow in order, skipping colours other sources name; destinations left without one are grey. A band takes its source's colour."
                    }
                  },
                  "required": [
                    "label"
                  ],
                  "additionalProperties": false
                }
              },
              "to": {
                "type": "array",
                "minItems": 1,
                "maxItems": 8,
                "description": "Optional. The destinations in the order to draw them, with colours. Left out, as from. Every link must go to one of them.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "The destination's name, as links name it."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "A named colour, as on a breakdown. Sources left without one take blue, teal, orange, purple, green, pink and yellow in order, skipping colours other sources name; destinations left without one are grey. A band takes its source's colour."
                    }
                  },
                  "required": [
                    "label"
                  ],
                  "additionalProperties": false
                }
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "links": {
                "type": "array",
                "minItems": 1,
                "maxItems": 48,
                "description": "What goes where: one link per source and destination, with its amount. From up to 6 sources to up to 8 destinations.",
                "items": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "The source's label."
                    },
                    "to": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "The destination's label."
                    },
                    "value": {
                      "type": "number",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "from",
                    "to",
                    "value"
                  ],
                  "additionalProperties": false
                }
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              },
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "A line under the chart."
              },
              "hide_amounts": {
                "type": "boolean",
                "default": false,
                "description": "Leave out the amount under each source's name. The headline total and each destination's share stay."
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. Without buttons the whole card is the link; with them, the link is its own small button after them."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Where amounts go: sources down the left, destinations down the right, and a band from each source to each destination it sends to, as thick as its amount. DNS queries from each client to allowed and blocked, solar and grid to the house and the car, income to spending and savings. Labels sit outside the bars: a source's amount under its name (unless hide_amounts), a destination's share after its name.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^links(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "links": {
                "type": "array",
                "minItems": 1,
                "maxItems": 48,
                "description": "What goes where: one link per source and destination, with its amount. From up to 6 sources to up to 8 destinations.",
                "items": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "The source's label."
                    },
                    "to": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "The destination's label."
                    },
                    "value": {
                      "type": "number",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "from",
                    "to",
                    "value"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "links"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^from(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "from": {
                "type": "array",
                "minItems": 1,
                "maxItems": 6,
                "description": "Optional. The sources in the order to draw them, with colours. Left out, they're the links' sources in the order they first appear. Every link must come from one of them.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "The source's name, as links name it."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "A named colour, as on a breakdown. Sources left without one take blue, teal, orange, purple, green, pink and yellow in order, skipping colours other sources name; destinations left without one are grey. A band takes its source's colour."
                    }
                  },
                  "required": [
                    "label"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^to(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "to": {
                "type": "array",
                "minItems": 1,
                "maxItems": 8,
                "description": "Optional. The destinations in the order to draw them, with colours. Left out, as from. Every link must go to one of them.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "description": "The destination's name, as links name it."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "A named colour, as on a breakdown. Sources left without one take blue, teal, orange, purple, green, pink and yellow in order, skipping colours other sources name; destinations left without one are grey. A band takes its source's colour."
                    }
                  },
                  "required": [
                    "label"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "A line under the chart."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^hide_amounts(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "hide_amounts": {
                "type": "boolean",
                "default": false,
                "description": "Leave out the amount under each source's name. The headline total and each destination's share stay."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^url(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                "description": "Optional link a click on the card opens: legato://page/ID for a page with more (legato://page/ID#card-id brings one of its cards into view, choosing its tab and opening its section), or an https address. Without buttons the whole card is the link; with them, the link is its own small button after them."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "ranges": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "ranges"
        },
        "label": {
          "type": "string"
        },
        "items": {
          "type": "array",
          "description": "One row each, in order: up to 14.",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "description": "Short, like \"Today\" or \"Thu\"."
              },
              "low": {
                "type": "number"
              },
              "high": {
                "type": "number"
              },
              "icon": {
                "type": "string",
                "description": "Drawn before the bar: an SF Symbol name, like sun.max or cloud.rain, or si:/site: as list rows take."
              },
              "color": {
                "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
              },
              "now": {
                "type": "number",
                "description": "Marked on the bar with a dot: the temperature now, on today's row."
              },
              "info": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Up to two short notes in columns of their own, the first before the icon and the second after it: a forecast's wind (\"15 S\") and chance of rain (\"70%\"). An empty string leaves its column blank, so the columns stay lined up."
              }
            },
            "additionalProperties": false
          }
        },
        "unit": {
          "type": "string",
          "description": "A degree unit (°F or °C) shows values as 72°; a currency shows money. clock reads values as hours of the day and shows them as times: 22.5 is 10:30 PM, 24 and up the next day's (a source rule's clock gives these hours)."
        },
        "colors": {
          "default": "accent",
          "description": "accent draws every bar in the accent colour; temperature shades each by its temperatures, purple and blue when cold through teal and green to yellow, orange and red when hot, read in the card's unit (°C, else °F)."
        },
        "info_colors": {
          "type": "array",
          "items": {},
          "description": "The info columns' colours, in order, by the same names as a breakdown's: [\"green\", \"blue\"] for wind and rain. Without it they're grey."
        },
        "detail": {
          "type": "string",
          "description": "A note under the rows."
        },
        "muted": {
          "type": "boolean",
          "default": true,
          "description": "false shows each row's low in the text colour instead of grey, like its high."
        },
        "min": {
          "type": "number",
          "description": "With max, a fixed scale for every row, such as 0 to 100 for charges from 38% to 72%, so a top-up and a full charge look different. Without them the scale runs from the rows' lowest low to their highest high."
        },
        "max": {
          "type": "number",
          "description": "The fixed scale's top; see min."
        },
        "color": {
          "description": "Every bar in one colour where it means something, such as charges in green. The accent without; colors temperature shades by temperature instead."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "colors": {
                      "$ref": "#/definitions/rule"
                    },
                    "info_colors": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "muted": {
                      "$ref": "#/definitions/rule"
                    },
                    "min": {
                      "$ref": "#/definitions/rule"
                    },
                    "max": {
                      "$ref": "#/definitions/rule"
                    },
                    "color": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|items|unit|colors|info_colors|detail|muted|min|max|color)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 14,
                "description": "One row each, in order: up to 14.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 24,
                      "description": "Short, like \"Today\" or \"Thu\"."
                    },
                    "low": {
                      "type": "number"
                    },
                    "high": {
                      "type": "number"
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "Drawn before the bar: an SF Symbol name, like sun.max or cloud.rain, or si:/site: as list rows take."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
                    },
                    "now": {
                      "type": "number",
                      "description": "Marked on the bar with a dot: the temperature now, on today's row."
                    },
                    "info": {
                      "type": "array",
                      "maxItems": 2,
                      "items": {
                        "type": "string",
                        "maxLength": 10
                      },
                      "description": "Up to two short notes in columns of their own, the first before the icon and the second after it: a forecast's wind (\"15 S\") and chance of rain (\"70%\"). An empty string leaves its column blank, so the columns stay lined up."
                    }
                  },
                  "required": [
                    "label",
                    "low",
                    "high"
                  ],
                  "additionalProperties": false
                }
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16,
                "description": "A degree unit (°F or °C) shows values as 72°; a currency shows money. clock reads values as hours of the day and shows them as times: 22.5 is 10:30 PM, 24 and up the next day's (a source rule's clock gives these hours)."
              },
              "colors": {
                "enum": [
                  "accent",
                  "temperature"
                ],
                "default": "accent",
                "description": "accent draws every bar in the accent colour; temperature shades each by its temperatures, purple and blue when cold through teal and green to yellow, orange and red when hot, read in the card's unit (°C, else °F)."
              },
              "info_colors": {
                "type": "array",
                "maxItems": 2,
                "items": {
                  "enum": [
                    "blue",
                    "teal",
                    "orange",
                    "purple",
                    "green",
                    "pink",
                    "yellow",
                    "red",
                    "rose",
                    "grey",
                    "slate",
                    "graphite",
                    "ink",
                    "gray"
                  ]
                },
                "description": "The info columns' colours, in order, by the same names as a breakdown's: [\"green\", \"blue\"] for wind and rain. Without it they're grey."
              },
              "detail": {
                "type": "string",
                "maxLength": 200,
                "description": "A note under the rows."
              },
              "muted": {
                "type": "boolean",
                "default": true,
                "description": "false shows each row's low in the text colour instead of grey, like its high."
              },
              "min": {
                "type": "number",
                "description": "With max, a fixed scale for every row, such as 0 to 100 for charges from 38% to 72%, so a top-up and a full charge look different. Without them the scale runs from the rows' lowest low to their highest high."
              },
              "max": {
                "type": "number",
                "description": "The fixed scale's top; see min."
              },
              "color": {
                "enum": [
                  "blue",
                  "teal",
                  "orange",
                  "purple",
                  "green",
                  "pink",
                  "yellow",
                  "red",
                  "rose",
                  "grey",
                  "slate",
                  "graphite",
                  "ink"
                ],
                "description": "Every bar in one colour where it means something, such as charges in green. The accent without; colors temperature shades by temperature instead."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Rows on one shared scale, each a bar from its low to its high: a week's daily temperatures, a price's range by day. The scale runs from the lowest low to the highest high, so the rows compare at a glance.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            },
            "required": [
              "label"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 14,
                "description": "One row each, in order: up to 14.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 24,
                      "description": "Short, like \"Today\" or \"Thu\"."
                    },
                    "low": {
                      "type": "number"
                    },
                    "high": {
                      "type": "number"
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "Drawn before the bar: an SF Symbol name, like sun.max or cloud.rain, or si:/site: as list rows take."
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink",
                        "gray"
                      ],
                      "description": "Optional colour for the row's icon, by the breakdown card's names, drawn in the system's shade for light or dark mode. Leave it out and the icon is secondary grey, as the row's other supporting marks are. Use it when the colour means something, like a category's colour on other pages."
                    },
                    "now": {
                      "type": "number",
                      "description": "Marked on the bar with a dot: the temperature now, on today's row."
                    },
                    "info": {
                      "type": "array",
                      "maxItems": 2,
                      "items": {
                        "type": "string",
                        "maxLength": 10
                      },
                      "description": "Up to two short notes in columns of their own, the first before the icon and the second after it: a forecast's wind (\"15 S\") and chance of rain (\"70%\"). An empty string leaves its column blank, so the columns stay lined up."
                    }
                  },
                  "required": [
                    "label",
                    "low",
                    "high"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16,
                "description": "A degree unit (°F or °C) shows values as 72°; a currency shows money. clock reads values as hours of the day and shows them as times: 22.5 is 10:30 PM, 24 and up the next day's (a source rule's clock gives these hours)."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^colors(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "colors": {
                "enum": [
                  "accent",
                  "temperature"
                ],
                "default": "accent",
                "description": "accent draws every bar in the accent colour; temperature shades each by its temperatures, purple and blue when cold through teal and green to yellow, orange and red when hot, read in the card's unit (°C, else °F)."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^info_colors(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "info_colors": {
                "type": "array",
                "maxItems": 2,
                "items": {
                  "enum": [
                    "blue",
                    "teal",
                    "orange",
                    "purple",
                    "green",
                    "pink",
                    "yellow",
                    "red",
                    "rose",
                    "grey",
                    "slate",
                    "graphite",
                    "ink",
                    "gray"
                  ]
                },
                "description": "The info columns' colours, in order, by the same names as a breakdown's: [\"green\", \"blue\"] for wind and rain. Without it they're grey."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 200,
                "description": "A note under the rows."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^muted(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "muted": {
                "type": "boolean",
                "default": true,
                "description": "false shows each row's low in the text colour instead of grey, like its high."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^min(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "min": {
                "type": "number",
                "description": "With max, a fixed scale for every row, such as 0 to 100 for charges from 38% to 72%, so a top-up and a full charge look different. Without them the scale runs from the rows' lowest low to their highest high."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max": {
                "type": "number",
                "description": "The fixed scale's top; see min."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^color(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "color": {
                "enum": [
                  "blue",
                  "teal",
                  "orange",
                  "purple",
                  "green",
                  "pink",
                  "yellow",
                  "red",
                  "rose",
                  "grey",
                  "slate",
                  "graphite",
                  "ink"
                ],
                "description": "Every bar in one colour where it means something, such as charges in green. The accent without; colors temperature shades by temperature instead."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "columns": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "columns"
        },
        "label": {
          "type": "string",
          "description": "Optional: leave it out when the page already says what the columns are, such as a Pi-hole page's hourly queries."
        },
        "series": {
          "type": "array",
          "description": "The names of the series, in order, like [\"Income\", \"Spending\"]. One series is drawn in the theme's chart colour; two or more take the category colours unless series_colors names them.",
          "items": {
            "type": "string"
          }
        },
        "items": {
          "type": "array",
          "description": "One group of columns per period, oldest first. Each item has one value per series, in the same order.",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "description": "The period, like \"May\" or \"Wk 42\"."
              },
              "values": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              }
            },
            "additionalProperties": false
          }
        },
        "unit": {
          "type": "string"
        },
        "baseline": {
          "default": "zero",
          "description": "zero starts the columns at zero; auto starts them just below the lowest value, for readings like an hour-by-hour temperature whose shape matters more than its distance from zero. Values below zero are drawn either way."
        },
        "values_on_top": {
          "type": "boolean",
          "default": false,
          "description": "Each column's value written above it, in place of the side axis."
        },
        "highlight": {
          "type": "string",
          "description": "The label of the period that applies now, like \"Now\" or this month's \"Oct\": its label, and its value on top, are bold and bright, while every column keeps its colour."
        },
        "stacked": {
          "type": "boolean",
          "default": false,
          "description": "One column per period, its series stacked as the parts of it, such as a night split into sleep stages. Values on top then show each column's total."
        },
        "series_colors": {
          "type": "array",
          "items": {},
          "description": "The series' colours, in order, by the same names as a breakdown's: [\"purple\", \"blue\", \"teal\"]. Without it, one series is the chart colour and more take the category colours. In a stacked chart, \"grey\" is a lighter context grey, for the part that isn't the subject."
        },
        "detail": {
          "type": "string",
          "description": "A note under the chart, like what the totals leave out."
        },
        "grid": {
          "type": "boolean",
          "default": false,
          "description": "Lines across the chart at the side axis's values. Off by default: the values down the leading edge stay either way."
        },
        "legend_align": {
          "default": "leading",
          "description": "Where the series names go: leading, under the title (the default), or trailing, at the card's right on the title's line."
        },
        "slots": {
          "type": "integer",
          "description": "Room for this many columns: the ones not here yet are left empty at the end, so a day that's still going draws at its full width, like 24 for a day's hours."
        },
        "summary": {
          "type": "string",
          "description": "Grey words after the title on its line, such as **14,623** · **23.3%** blocked. Inline formatting works."
        },
        "last_partial": {
          "type": "boolean",
          "description": "The last column is a period still filling, such as the hour now: it's drawn lighter, so its shortness doesn't read as a drop."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "series": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "baseline": {
                      "$ref": "#/definitions/rule"
                    },
                    "values_on_top": {
                      "$ref": "#/definitions/rule"
                    },
                    "highlight": {
                      "$ref": "#/definitions/rule"
                    },
                    "stacked": {
                      "$ref": "#/definitions/rule"
                    },
                    "series_colors": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "grid": {
                      "$ref": "#/definitions/rule"
                    },
                    "legend_align": {
                      "$ref": "#/definitions/rule"
                    },
                    "slots": {
                      "$ref": "#/definitions/rule"
                    },
                    "summary": {
                      "$ref": "#/definitions/rule"
                    },
                    "last_partial": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|series|items|unit|baseline|values_on_top|highlight|stacked|series_colors|detail|grid|legend_align|slots|summary|last_partial)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: leave it out when the page already says what the columns are, such as a Pi-hole page's hourly queries."
              },
              "series": {
                "type": "array",
                "minItems": 1,
                "maxItems": 3,
                "description": "The names of the series, in order, like [\"Income\", \"Spending\"]. One series is drawn in the theme's chart colour; two or more take the category colours unless series_colors names them.",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 24
                }
              },
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 48,
                "description": "One group of columns per period, oldest first. Each item has one value per series, in the same order.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 12,
                      "description": "The period, like \"May\" or \"Wk 42\"."
                    },
                    "values": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 3,
                      "items": {
                        "type": "number"
                      }
                    }
                  },
                  "required": [
                    "label",
                    "values"
                  ],
                  "additionalProperties": false
                }
              },
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              },
              "baseline": {
                "enum": [
                  "zero",
                  "auto"
                ],
                "default": "zero",
                "description": "zero starts the columns at zero; auto starts them just below the lowest value, for readings like an hour-by-hour temperature whose shape matters more than its distance from zero. Values below zero are drawn either way."
              },
              "values_on_top": {
                "type": "boolean",
                "default": false,
                "description": "Each column's value written above it, in place of the side axis."
              },
              "highlight": {
                "type": "string",
                "minLength": 1,
                "maxLength": 12,
                "description": "The label of the period that applies now, like \"Now\" or this month's \"Oct\": its label, and its value on top, are bold and bright, while every column keeps its colour."
              },
              "stacked": {
                "type": "boolean",
                "default": false,
                "description": "One column per period, its series stacked as the parts of it, such as a night split into sleep stages. Values on top then show each column's total."
              },
              "series_colors": {
                "type": "array",
                "maxItems": 3,
                "items": {
                  "enum": [
                    "blue",
                    "teal",
                    "orange",
                    "purple",
                    "green",
                    "pink",
                    "yellow",
                    "red",
                    "rose",
                    "grey",
                    "slate",
                    "graphite",
                    "ink",
                    "gray"
                  ]
                },
                "description": "The series' colours, in order, by the same names as a breakdown's: [\"purple\", \"blue\", \"teal\"]. Without it, one series is the chart colour and more take the category colours. In a stacked chart, \"grey\" is a lighter context grey, for the part that isn't the subject."
              },
              "detail": {
                "type": "string",
                "maxLength": 200,
                "description": "A note under the chart, like what the totals leave out."
              },
              "grid": {
                "type": "boolean",
                "default": false,
                "description": "Lines across the chart at the side axis's values. Off by default: the values down the leading edge stay either way."
              },
              "legend_align": {
                "enum": [
                  "leading",
                  "trailing"
                ],
                "default": "leading",
                "description": "Where the series names go: leading, under the title (the default), or trailing, at the card's right on the title's line."
              },
              "slots": {
                "type": "integer",
                "minimum": 1,
                "maximum": 96,
                "description": "Room for this many columns: the ones not here yet are left empty at the end, so a day that's still going draws at its full width, like 24 for a day's hours."
              },
              "summary": {
                "type": "string",
                "maxLength": 120,
                "description": "Grey words after the title on its line, such as **14,623** · **23.3%** blocked. Inline formatting works."
              },
              "last_partial": {
                "type": "boolean",
                "description": "The last column is a period still filling, such as the hour now: it's drawn lighter, so its shortness doesn't read as a drop."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        },
        "daily": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "values"
          ],
          "description": "For a page with a period, on a card without a source: one value a day, which Legato adds up for the period showing: a stat’s or pacing’s value, a sparkline’s points, columns by day, week or month. Days still to come aren’t drawn.",
          "properties": {
            "values": {
              "type": "array",
              "maxItems": 3660,
              "items": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "number"
                  }
                ]
              },
              "description": "Days and values: [[\"2026-10-01\", 62], …]."
            },
            "aggregate": {
              "enum": [
                "sum",
                "mean",
                "last",
                "min",
                "max"
              ],
              "default": "sum",
              "description": "How a period’s days add up: sum for spending or steps, mean for an average, last for a balance."
            },
            "compare": {
              "type": "boolean",
              "default": false,
              "description": "With the period’s compare: a stat’s delta is the change from the stretch before, and columns show both side by side."
            }
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Up to 48 periods as groups of vertical columns, one to three series each: income against spending by month, this year against last, a day by hour.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: leave it out when the page already says what the columns are, such as a Pi-hole page's hourly queries."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^series(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "series": {
                "type": "array",
                "minItems": 1,
                "maxItems": 3,
                "description": "The names of the series, in order, like [\"Income\", \"Spending\"]. One series is drawn in the theme's chart colour; two or more take the category colours unless series_colors names them.",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 24
                }
              }
            },
            "required": [
              "series"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 48,
                "description": "One group of columns per period, oldest first. Each item has one value per series, in the same order.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 12,
                      "description": "The period, like \"May\" or \"Wk 42\"."
                    },
                    "values": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 3,
                      "items": {
                        "type": "number"
                      }
                    }
                  },
                  "required": [
                    "label",
                    "values"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "minLength": 1,
                "maxLength": 16
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^baseline(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "baseline": {
                "enum": [
                  "zero",
                  "auto"
                ],
                "default": "zero",
                "description": "zero starts the columns at zero; auto starts them just below the lowest value, for readings like an hour-by-hour temperature whose shape matters more than its distance from zero. Values below zero are drawn either way."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^values_on_top(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "values_on_top": {
                "type": "boolean",
                "default": false,
                "description": "Each column's value written above it, in place of the side axis."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^highlight(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "highlight": {
                "type": "string",
                "minLength": 1,
                "maxLength": 12,
                "description": "The label of the period that applies now, like \"Now\" or this month's \"Oct\": its label, and its value on top, are bold and bright, while every column keeps its colour."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^stacked(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "stacked": {
                "type": "boolean",
                "default": false,
                "description": "One column per period, its series stacked as the parts of it, such as a night split into sleep stages. Values on top then show each column's total."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^series_colors(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "series_colors": {
                "type": "array",
                "maxItems": 3,
                "items": {
                  "enum": [
                    "blue",
                    "teal",
                    "orange",
                    "purple",
                    "green",
                    "pink",
                    "yellow",
                    "red",
                    "rose",
                    "grey",
                    "slate",
                    "graphite",
                    "ink",
                    "gray"
                  ]
                },
                "description": "The series' colours, in order, by the same names as a breakdown's: [\"purple\", \"blue\", \"teal\"]. Without it, one series is the chart colour and more take the category colours. In a stacked chart, \"grey\" is a lighter context grey, for the part that isn't the subject."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 200,
                "description": "A note under the chart, like what the totals leave out."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^grid(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "grid": {
                "type": "boolean",
                "default": false,
                "description": "Lines across the chart at the side axis's values. Off by default: the values down the leading edge stay either way."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^legend_align(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "legend_align": {
                "enum": [
                  "leading",
                  "trailing"
                ],
                "default": "leading",
                "description": "Where the series names go: leading, under the title (the default), or trailing, at the card's right on the title's line."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^slots(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "slots": {
                "type": "integer",
                "minimum": 1,
                "maximum": 96,
                "description": "Room for this many columns: the ones not here yet are left empty at the end, so a day that's still going draws at its full width, like 24 for a day's hours."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^summary(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "summary": {
                "type": "string",
                "maxLength": 120,
                "description": "Grey words after the title on its line, such as **14,623** · **23.3%** blocked. Inline formatting works."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^last_partial(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "last_partial": {
                "type": "boolean",
                "description": "The last column is a period still filling, such as the hour now: it's drawn lighter, so its shortness doesn't read as a drop."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "vehicle": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "vehicle"
        },
        "label": {
          "type": "string"
        },
        "tires": {
          "type": "array",
          "description": "Front left, front right, rear left, rear right.",
          "items": {
            "type": "object",
            "properties": {
              "value": {
                "oneOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "color": {
                "description": "A state's colour by the wheel (orange for a low tire); grey or none draws as usual."
              }
            },
            "additionalProperties": false
          }
        },
        "unit": {
          "type": "string",
          "description": "The tires' unit, small in the body (psi)."
        },
        "locked": {
          "type": "boolean"
        },
        "charging": {
          "type": "boolean",
          "description": "true: the charge port glows green."
        },
        "doors_open": {
          "type": "boolean",
          "description": "true: a door is open, drawn in orange where it is on the car."
        },
        "frunk_open": {
          "type": "boolean",
          "description": "true: the frunk is open, drawn in orange where it is on the car."
        },
        "trunk_open": {
          "type": "boolean",
          "description": "true: the trunk is open, drawn in orange where it is on the car."
        },
        "windows_open": {
          "type": "boolean",
          "description": "true: a window is open, drawn in orange where it is on the car."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "tires": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "locked": {
                      "$ref": "#/definitions/rule"
                    },
                    "charging": {
                      "$ref": "#/definitions/rule"
                    },
                    "doors_open": {
                      "$ref": "#/definitions/rule"
                    },
                    "frunk_open": {
                      "$ref": "#/definitions/rule"
                    },
                    "trunk_open": {
                      "$ref": "#/definitions/rule"
                    },
                    "windows_open": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|tires|unit|locked|charging|doors_open|frunk_open|trunk_open|windows_open)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "tires": {
                "type": "array",
                "minItems": 4,
                "maxItems": 4,
                "description": "Front left, front right, rear left, rear right.",
                "items": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "oneOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "string",
                          "maxLength": 16
                        }
                      ]
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink"
                      ],
                      "description": "A state's colour by the wheel (orange for a low tire); grey or none draws as usual."
                    }
                  },
                  "required": [
                    "value"
                  ],
                  "additionalProperties": false
                }
              },
              "unit": {
                "type": "string",
                "maxLength": 8,
                "description": "The tires' unit, small in the body (psi)."
              },
              "locked": {
                "type": "boolean"
              },
              "charging": {
                "type": "boolean",
                "description": "true: the charge port glows green."
              },
              "doors_open": {
                "type": "boolean",
                "description": "true: a door is open, drawn in orange where it is on the car."
              },
              "frunk_open": {
                "type": "boolean",
                "description": "true: the frunk is open, drawn in orange where it is on the car."
              },
              "trunk_open": {
                "type": "boolean",
                "description": "true: the trunk is open, drawn in orange where it is on the car."
              },
              "windows_open": {
                "type": "boolean",
                "description": "true: a window is open, drawn in orange where it is on the car."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A car from above, large, with its state drawn on it: its four tires' readings by their wheels, a lock while it's locked, the charge port glowing green while it charges, and anything open (doors_open, frunk_open, trunk_open, windows_open) in orange. For a car's overview, beside its state and battery.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^tires(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "tires": {
                "type": "array",
                "minItems": 4,
                "maxItems": 4,
                "description": "Front left, front right, rear left, rear right.",
                "items": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "oneOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "string",
                          "maxLength": 16
                        }
                      ]
                    },
                    "color": {
                      "enum": [
                        "blue",
                        "teal",
                        "orange",
                        "purple",
                        "green",
                        "pink",
                        "yellow",
                        "red",
                        "rose",
                        "grey",
                        "slate",
                        "graphite",
                        "ink"
                      ],
                      "description": "A state's colour by the wheel (orange for a low tire); grey or none draws as usual."
                    }
                  },
                  "required": [
                    "value"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "maxLength": 8,
                "description": "The tires' unit, small in the body (psi)."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^locked(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "locked": {
                "type": "boolean"
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^charging(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "charging": {
                "type": "boolean",
                "description": "true: the charge port glows green."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^doors_open(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "doors_open": {
                "type": "boolean",
                "description": "true: a door is open, drawn in orange where it is on the car."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^frunk_open(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "frunk_open": {
                "type": "boolean",
                "description": "true: the frunk is open, drawn in orange where it is on the car."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^trunk_open(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "trunk_open": {
                "type": "boolean",
                "description": "true: the trunk is open, drawn in orange where it is on the car."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^windows_open(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "windows_open": {
                "type": "boolean",
                "description": "true: a window is open, drawn in orange where it is on the car."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "fleet": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "fleet"
        },
        "label": {
          "type": "string",
          "description": "Optional: a fleet in a tab drops a title that repeats the tab's name, and then has no header row or count."
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "state": {},
              "detail": {
                "type": "string",
                "description": "Shown when the pointer rests on the item."
              },
              "url": {
                "type": "string",
                "description": "Optional link the item opens when it's clicked: the service's own https page, or legato://page/ID for the page about it."
              },
              "group": {
                "type": "string",
                "description": "A small heading the item sits under, such as Services or Jobs. Groups follow the items with none, in first-seen order."
              },
              "key": {
                "type": "string",
                "description": "Optional. What tells this item apart from others with the same name, for its notifications and status history: Gitea's repository fleet gives \"harbor-labs/tidewater-api\" so a fork named tidewater-api keeps its own. Keep it the same from one answer to the next, and never put a secret in it. Without it an item is known by its name."
              }
            },
            "additionalProperties": false
          }
        },
        "max_items": {
          "type": "integer",
          "description": "Show no more than this many items, what needs attention first, with Show N more for the rest. The count still counts every item."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "max_items": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|items|max_items)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "placement": {
          "const": "page_info",
          "description": "Optional. \"page_info\" draws this status or fleet card in Page Info's Health section, in full, instead of on the page. Only on a card on the page itself (not in a tab) and without buttons. While the worst of these cards isn't ok, the Page Info button shows its state's symbol in its colour (orange, red or grey); with all ok or off it stays plain. The light, notifications, Spotlight and History still read the card. Use it for a service overview's own health (version, \"No problems\") in place of a closed Status section."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: a fleet in a tab drops a title that repeats the tab's name, and then has no header row or count."
              },
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 60,
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 24
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off"
                      ]
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 80,
                      "description": "Shown when the pointer rests on the item."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link the item opens when it's clicked: the service's own https page, or legato://page/ID for the page about it."
                    },
                    "group": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 24,
                      "description": "A small heading the item sits under, such as Services or Jobs. Groups follow the items with none, in first-seen order."
                    },
                    "key": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128,
                      "description": "Optional. What tells this item apart from others with the same name, for its notifications and status history: Gitea's repository fleet gives \"harbor-labs/tidewater-api\" so a fork named tidewater-api keeps its own. Keep it the same from one answer to the next, and never put a secret in it. Without it an item is known by its name."
                    }
                  },
                  "required": [
                    "name",
                    "state"
                  ],
                  "additionalProperties": false
                }
              },
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 60,
                "description": "Show no more than this many items, what needs attention first, with Show N more for the rest. The count still counts every item."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Up to 60 hosts or jobs as a grid of named dots. The worst state counts toward the page's status and its notifications. With max_items, what needs attention shows first.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: a fleet in a tab drops a title that repeats the tab's name, and then has no header row or count."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "minItems": 1,
                "maxItems": 60,
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 24
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off"
                      ]
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 80,
                      "description": "Shown when the pointer rests on the item."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link the item opens when it's clicked: the service's own https page, or legato://page/ID for the page about it."
                    },
                    "group": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 24,
                      "description": "A small heading the item sits under, such as Services or Jobs. Groups follow the items with none, in first-seen order."
                    },
                    "key": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128,
                      "description": "Optional. What tells this item apart from others with the same name, for its notifications and status history: Gitea's repository fleet gives \"harbor-labs/tidewater-api\" so a fork named tidewater-api keeps its own. Keep it the same from one answer to the next, and never put a secret in it. Without it an item is known by its name."
                    }
                  },
                  "required": [
                    "name",
                    "state"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max_items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 60,
                "description": "Show no more than this many items, what needs attention first, with Show N more for the rest. The count still counts every item."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "placement"
            ]
          },
          "then": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "actions"
                  ]
                },
                {
                  "required": [
                    "actions_placement"
                  ]
                },
                {
                  "required": [
                    "actions_align"
                  ]
                }
              ]
            }
          }
        }
      ]
    },
    "checklist": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "checklist"
        },
        "label": {
          "type": "string",
          "description": "The title, with the count of done items beside it. Leave it out for a checklist inside a tab that already names it: the card then has no title row, and its rows start at the top."
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              },
              "done": {
                "type": "boolean"
              },
              "detail": {
                "type": "string",
                "description": "Optional second line under the text, smaller and in grey: a reminder's list and how often it repeats, an owner, a due date."
              },
              "icon": {
                "type": "string",
                "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
              },
              "badge": {
                "type": "string",
                "description": "Optional SF Symbol set into the start of the text in the accent colour, taking no room on rows without one: a repeat mark (arrow.clockwise.circle.fill), a flag, a pin. Unlike icon, it marks something about the row rather than what the row is."
              },
              "badge_at": {
                "default": "start",
                "description": "Where the badge goes: start, before the text in the accent colour; or end, after it in grey, as a to-do app marks a repeating to-do."
              },
              "section": {
                "type": "string",
                "description": "A heading the row sits under. A row whose section differs from the row above starts a new heading, as a to-do list groups its days; rows keep the order given. For the list layout."
              },
              "badge_label": {
                "type": "string",
                "description": "The meaning of the badge for VoiceOver. Common repeat, flag and pin symbols have defaults."
              }
            },
            "additionalProperties": false
          }
        },
        "max_items": {
          "type": "integer",
          "description": "Show no more than this many rows, with Show more for the rest; the count beside the title still counts every row. A list a source fills can hold more rows than one written into the page."
        },
        "mark": {
          "default": "check",
          "description": "How a done item looks: check (the circle turns into a checkmark and the text is struck through), fill (the circle fills and the text goes light, as in Reminders), square (a rounded square fills with a checkmark and the text goes light) or switch (for things that are on or off, such as lights: each item's icon is its mark, lit when done and dim when not, and the text stays as it is)."
        },
        "layout": {
          "default": "list",
          "description": "list: a row per item, the default. grid: two columns of small tiles, each item's mark beside its text with the detail under it; an item that's on (switch) or done tints its tile, and the whole tile is the item's action. For things scanned for state and toggled: a room's lights, shades and fans."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "max_items": {
                      "$ref": "#/definitions/rule"
                    },
                    "mark": {
                      "$ref": "#/definitions/rule"
                    },
                    "layout": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|items|max_items|mark|layout)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "itemAction": {
          "$ref": "#/definitions/itemAction"
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "The title, with the count of done items beside it. Leave it out for a checklist inside a tab that already names it: the card then has no title row, and its rows start at the top."
              },
              "items": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "done": {
                      "type": "boolean"
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "Optional second line under the text, smaller and in grey: a reminder's list and how often it repeats, an owner, a due date."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    },
                    "badge": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^[a-z0-9]+(?:\\.[a-z0-9]+)*$",
                      "description": "Optional SF Symbol set into the start of the text in the accent colour, taking no room on rows without one: a repeat mark (arrow.clockwise.circle.fill), a flag, a pin. Unlike icon, it marks something about the row rather than what the row is."
                    },
                    "badge_at": {
                      "enum": [
                        "start",
                        "end"
                      ],
                      "default": "start",
                      "description": "Where the badge goes: start, before the text in the accent colour; or end, after it in grey, as a to-do app marks a repeating to-do."
                    },
                    "section": {
                      "type": "string",
                      "maxLength": 60,
                      "description": "A heading the row sits under. A row whose section differs from the row above starts a new heading, as a to-do list groups its days; rows keep the order given. For the list layout."
                    },
                    "badge_label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "description": "The meaning of the badge for VoiceOver. Common repeat, flag and pin symbols have defaults."
                    }
                  },
                  "required": [
                    "text",
                    "done"
                  ],
                  "additionalProperties": false
                }
              },
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20,
                "description": "Show no more than this many rows, with Show more for the rest; the count beside the title still counts every row. A list a source fills can hold more rows than one written into the page."
              },
              "mark": {
                "enum": [
                  "check",
                  "fill",
                  "square",
                  "switch"
                ],
                "default": "check",
                "description": "How a done item looks: check (the circle turns into a checkmark and the text is struck through), fill (the circle fills and the text goes light, as in Reminders), square (a rounded square fills with a checkmark and the text goes light) or switch (for things that are on or off, such as lights: each item's icon is its mark, lit when done and dim when not, and the text stays as it is)."
              },
              "layout": {
                "enum": [
                  "list",
                  "grid"
                ],
                "default": "list",
                "description": "list: a row per item, the default. grid: two columns of small tiles, each item's mark beside its text with the detail under it; an item that's on (switch) or done tints its tile, and the whole tile is the item's action. For things scanned for state and toggled: a room's lights, shades and fans."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Up to 20 items the agent ticks off, or none yet. Done ones are checked off in the card's mark. Inline formatting works: **bold**, *italic*, ~~strikethrough~~, `code` and [links](https://example.com) (https, or mailto: with one address). Block Markdown (headings, lists, code fences) doesn't; use the card types for those. A literal * or _ that should stay can be escaped with \\.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "The title, with the count of done items beside it. Leave it out for a checklist inside a tab that already names it: the card then has no title row, and its rows start at the top."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "done": {
                      "type": "boolean"
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "Optional second line under the text, smaller and in grey: a reminder's list and how often it repeats, an owner, a due date."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    },
                    "badge": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^[a-z0-9]+(?:\\.[a-z0-9]+)*$",
                      "description": "Optional SF Symbol set into the start of the text in the accent colour, taking no room on rows without one: a repeat mark (arrow.clockwise.circle.fill), a flag, a pin. Unlike icon, it marks something about the row rather than what the row is."
                    },
                    "badge_at": {
                      "enum": [
                        "start",
                        "end"
                      ],
                      "default": "start",
                      "description": "Where the badge goes: start, before the text in the accent colour; or end, after it in grey, as a to-do app marks a repeating to-do."
                    },
                    "section": {
                      "type": "string",
                      "maxLength": 60,
                      "description": "A heading the row sits under. A row whose section differs from the row above starts a new heading, as a to-do list groups its days; rows keep the order given. For the list layout."
                    },
                    "badge_label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120,
                      "description": "The meaning of the badge for VoiceOver. Common repeat, flag and pin symbols have defaults."
                    }
                  },
                  "required": [
                    "text",
                    "done"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max_items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 20,
                "description": "Show no more than this many rows, with Show more for the rest; the count beside the title still counts every row. A list a source fills can hold more rows than one written into the page."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^mark(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "mark": {
                "enum": [
                  "check",
                  "fill",
                  "square",
                  "switch"
                ],
                "default": "check",
                "description": "How a done item looks: check (the circle turns into a checkmark and the text is struck through), fill (the circle fills and the text goes light, as in Reminders), square (a rounded square fills with a checkmark and the text goes light) or switch (for things that are on or off, such as lights: each item's icon is its mark, lit when done and dim when not, and the text stays as it is)."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^layout(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "layout": {
                "enum": [
                  "list",
                  "grid"
                ],
                "default": "list",
                "description": "list: a row per item, the default. grid: two columns of small tiles, each item's mark beside its text with the detail under it; an item that's on (switch) or done tints its tile, and the whole tile is the item's action. For things scanned for state and toggled: a room's lights, shades and fans."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        },
        {
          "if": {
            "required": [
              "itemAction"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        }
      ]
    },
    "agenda": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "agenda"
        },
        "label": {
          "type": "string"
        },
        "days": {
          "type": "integer",
          "default": 1,
          "description": "How many days the card shows, starting today in the Mac's time zone, up to 30. Items outside them are left out and a day with nothing on it says so, so you can write a week once and the card moves on by itself."
        },
        "items": {
          "type": "array",
          "description": "Up to 60 items, in any order: the Mac sorts each day's, all-day ones first. An empty list shows \"Nothing scheduled\".",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "start": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "string"
                  }
                ],
                "description": "A date-time with seconds and a zone, like 2026-10-27T09:30:00-05:00, or a date like 2026-10-28 for an all-day item, which stays on that date in any time zone."
              },
              "end": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "string"
                  }
                ],
                "description": "Optional, in the same form as start and not before it. A date end is the last day the item covers, inclusive: an offsite on the 28th and 29th is start 2026-10-28, end 2026-10-29."
              },
              "detail": {
                "type": "string",
                "description": "A line under the title, like the room or \"ORD → SFO, gate B12\"."
              },
              "url": {
                "type": "string",
                "description": "An https link, or legato://page/ID for another of your pages: the button says Join from 10 minutes before a timed item until it ends, Open otherwise."
              },
              "state": {
                "description": "A coloured mark on the row. It doesn't count toward the page's status."
              },
              "color": {
                "type": "string",
                "description": "#RRGGBB, such as a calendar's colour, drawn as a thin bar at the row's leading edge."
              },
              "icon": {
                "type": "string",
                "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
              }
            },
            "additionalProperties": false,
            "if": {
              "properties": {
                "start": {}
              }
            },
            "then": {
              "properties": {
                "end": {}
              }
            },
            "else": {
              "properties": {
                "end": {}
              }
            }
          }
        },
        "max_events": {
          "type": "integer",
          "description": "List no more than this many events, with Show more for the rest; today's events already over don't count and are left out until it's pressed."
        },
        "hide_empty_days": {
          "type": "boolean",
          "default": false,
          "description": "Leave out the days with nothing on them, instead of saying \"Nothing scheduled\" under each; with none left, the card says it once."
        },
        "hide_all_day_label": {
          "type": "boolean",
          "default": false,
          "description": "Leave \"All day\" off all-day items, for a card where every item is a date, like bills due. With no timed items either, the time column goes and titles start at the left."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "days": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "max_events": {
                      "$ref": "#/definitions/rule"
                    },
                    "hide_empty_days": {
                      "$ref": "#/definitions/rule"
                    },
                    "hide_all_day_label": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|days|items|max_events|hide_empty_days|hide_all_day_label)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30,
                "default": 1,
                "description": "How many days the card shows, starting today in the Mac's time zone, up to 30. Items outside them are left out and a day with nothing on it says so, so you can write a week once and the card moves on by itself."
              },
              "items": {
                "type": "array",
                "maxItems": 60,
                "description": "Up to 60 items, in any order: the Mac sorts each day's, all-day ones first. An empty list shows \"Nothing scheduled\".",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "start": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                        },
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      ],
                      "description": "A date-time with seconds and a zone, like 2026-10-27T09:30:00-05:00, or a date like 2026-10-28 for an all-day item, which stays on that date in any time zone."
                    },
                    "end": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                        },
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      ],
                      "description": "Optional, in the same form as start and not before it. A date end is the last day the item covers, inclusive: an offsite on the 28th and 29th is start 2026-10-28, end 2026-10-29."
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "A line under the title, like the room or \"ORD → SFO, gate B12\"."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "An https link, or legato://page/ID for another of your pages: the button says Join from 10 minutes before a timed item until it ends, Open otherwise."
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off"
                      ],
                      "description": "A coloured mark on the row. It doesn't count toward the page's status."
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^#[0-9A-Fa-f]{6}$",
                      "description": "#RRGGBB, such as a calendar's colour, drawn as a thin bar at the row's leading edge."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    }
                  },
                  "required": [
                    "title",
                    "start"
                  ],
                  "additionalProperties": false,
                  "if": {
                    "properties": {
                      "start": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      }
                    },
                    "required": [
                      "start"
                    ]
                  },
                  "then": {
                    "properties": {
                      "end": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      }
                    }
                  },
                  "else": {
                    "properties": {
                      "end": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                      }
                    }
                  }
                }
              },
              "max_events": {
                "type": "integer",
                "minimum": 1,
                "maximum": 300,
                "description": "List no more than this many events, with Show more for the rest; today's events already over don't count and are left out until it's pressed."
              },
              "hide_empty_days": {
                "type": "boolean",
                "default": false,
                "description": "Leave out the days with nothing on them, instead of saying \"Nothing scheduled\" under each; with none left, the card says it once."
              },
              "hide_all_day_label": {
                "type": "boolean",
                "default": false,
                "description": "Leave \"All day\" off all-day items, for a card where every item is a date, like bills due. With no timed items either, the time column goes and titles start at the left."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A day, a week or up to 30 days of dated items, grouped by day in the Mac's time zone, with a line at now: meetings, an itinerary, an on-call rota, release windows, bills due.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^days(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30,
                "default": 1,
                "description": "How many days the card shows, starting today in the Mac's time zone, up to 30. Items outside them are left out and a day with nothing on it says so, so you can write a week once and the card moves on by itself."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 60,
                "description": "Up to 60 items, in any order: the Mac sorts each day's, all-day ones first. An empty list shows \"Nothing scheduled\".",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "start": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                        },
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      ],
                      "description": "A date-time with seconds and a zone, like 2026-10-27T09:30:00-05:00, or a date like 2026-10-28 for an all-day item, which stays on that date in any time zone."
                    },
                    "end": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                        },
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      ],
                      "description": "Optional, in the same form as start and not before it. A date end is the last day the item covers, inclusive: an offsite on the 28th and 29th is start 2026-10-28, end 2026-10-29."
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "A line under the title, like the room or \"ORD → SFO, gate B12\"."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "An https link, or legato://page/ID for another of your pages: the button says Join from 10 minutes before a timed item until it ends, Open otherwise."
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off"
                      ],
                      "description": "A coloured mark on the row. It doesn't count toward the page's status."
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^#[0-9A-Fa-f]{6}$",
                      "description": "#RRGGBB, such as a calendar's colour, drawn as a thin bar at the row's leading edge."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    }
                  },
                  "required": [
                    "title",
                    "start"
                  ],
                  "additionalProperties": false,
                  "if": {
                    "properties": {
                      "start": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      }
                    },
                    "required": [
                      "start"
                    ]
                  },
                  "then": {
                    "properties": {
                      "end": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      }
                    }
                  },
                  "else": {
                    "properties": {
                      "end": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                      }
                    }
                  }
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max_events(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max_events": {
                "type": "integer",
                "minimum": 1,
                "maximum": 300,
                "description": "List no more than this many events, with Show more for the rest; today's events already over don't count and are left out until it's pressed."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^hide_empty_days(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "hide_empty_days": {
                "type": "boolean",
                "default": false,
                "description": "Leave out the days with nothing on them, instead of saying \"Nothing scheduled\" under each; with none left, the card says it once."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^hide_all_day_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "hide_all_day_label": {
                "type": "boolean",
                "default": false,
                "description": "Leave \"All day\" off all-day items, for a card where every item is a date, like bills due. With no timed items either, the time column goes and titles start at the left."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "month": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "month"
        },
        "label": {
          "type": "string"
        },
        "days": {
          "type": "integer",
          "default": 1,
          "description": "How many days the list under the grid shows, from the chosen day (today until someone clicks another), up to 30, as an agenda's days does. A calendar source's month window reads 30 days past the grid, so a list from any day on it has its items."
        },
        "max_events": {
          "type": "integer",
          "description": "List no more than this many events under the grid, with Show more for the rest; today's events already over don't count and are left out until it's pressed. The grid's dots still show every item."
        },
        "hide_empty_days": {
          "type": "boolean",
          "default": false,
          "description": "With days, leave out the days with nothing on them, instead of saying \"Nothing scheduled\" under each; with none left, the card says it once."
        },
        "items": {
          "type": "array",
          "description": "Up to 300 items, in the agenda's form. Each day with something on it gets a dot in the item's colour (up to three); clicking a day lists its items under the grid, as the agenda shows them.",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "start": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "string"
                  }
                ],
                "description": "A date-time with seconds and a zone, like 2026-10-27T09:30:00-05:00, or a date like 2026-10-28 for an all-day item, which stays on that date in any time zone."
              },
              "end": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "string"
                  }
                ],
                "description": "Optional, in the same form as start and not before it. A date end is the last day the item covers, inclusive: an offsite on the 28th and 29th is start 2026-10-28, end 2026-10-29."
              },
              "detail": {
                "type": "string",
                "description": "A line under the title, like the room or \"ORD → SFO, gate B12\"."
              },
              "url": {
                "type": "string",
                "description": "An https link, or legato://page/ID for another of your pages: the button says Join from 10 minutes before a timed item until it ends, Open otherwise."
              },
              "state": {
                "description": "A coloured mark on the row. It doesn't count toward the page's status."
              },
              "color": {
                "type": "string",
                "description": "#RRGGBB, such as a calendar's colour, drawn as a thin bar at the row's leading edge."
              },
              "icon": {
                "type": "string",
                "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
              }
            },
            "additionalProperties": false,
            "if": {
              "properties": {
                "start": {}
              }
            },
            "then": {
              "properties": {
                "end": {}
              }
            },
            "else": {
              "properties": {
                "end": {}
              }
            }
          }
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "days": {
                      "$ref": "#/definitions/rule"
                    },
                    "max_events": {
                      "$ref": "#/definitions/rule"
                    },
                    "hide_empty_days": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|days|max_events|hide_empty_days|items)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30,
                "default": 1,
                "description": "How many days the list under the grid shows, from the chosen day (today until someone clicks another), up to 30, as an agenda's days does. A calendar source's month window reads 30 days past the grid, so a list from any day on it has its items."
              },
              "max_events": {
                "type": "integer",
                "minimum": 1,
                "maximum": 300,
                "description": "List no more than this many events under the grid, with Show more for the rest; today's events already over don't count and are left out until it's pressed. The grid's dots still show every item."
              },
              "hide_empty_days": {
                "type": "boolean",
                "default": false,
                "description": "With days, leave out the days with nothing on them, instead of saying \"Nothing scheduled\" under each; with none left, the card says it once."
              },
              "items": {
                "type": "array",
                "maxItems": 300,
                "description": "Up to 300 items, in the agenda's form. Each day with something on it gets a dot in the item's colour (up to three); clicking a day lists its items under the grid, as the agenda shows them.",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "start": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                        },
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      ],
                      "description": "A date-time with seconds and a zone, like 2026-10-27T09:30:00-05:00, or a date like 2026-10-28 for an all-day item, which stays on that date in any time zone."
                    },
                    "end": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                        },
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      ],
                      "description": "Optional, in the same form as start and not before it. A date end is the last day the item covers, inclusive: an offsite on the 28th and 29th is start 2026-10-28, end 2026-10-29."
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "A line under the title, like the room or \"ORD → SFO, gate B12\"."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "An https link, or legato://page/ID for another of your pages: the button says Join from 10 minutes before a timed item until it ends, Open otherwise."
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off"
                      ],
                      "description": "A coloured mark on the row. It doesn't count toward the page's status."
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^#[0-9A-Fa-f]{6}$",
                      "description": "#RRGGBB, such as a calendar's colour, drawn as a thin bar at the row's leading edge."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    }
                  },
                  "required": [
                    "title",
                    "start"
                  ],
                  "additionalProperties": false,
                  "if": {
                    "properties": {
                      "start": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      }
                    },
                    "required": [
                      "start"
                    ]
                  },
                  "then": {
                    "properties": {
                      "end": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      }
                    }
                  },
                  "else": {
                    "properties": {
                      "end": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                      }
                    }
                  }
                }
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "This month as a grid in the Mac's time zone, six weeks from the week of the 1st, with a dot on each day that has items and the chosen day's items below (with days, that day and the ones after it). Today is chosen until someone clicks another day.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^days(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30,
                "default": 1,
                "description": "How many days the list under the grid shows, from the chosen day (today until someone clicks another), up to 30, as an agenda's days does. A calendar source's month window reads 30 days past the grid, so a list from any day on it has its items."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max_events(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max_events": {
                "type": "integer",
                "minimum": 1,
                "maximum": 300,
                "description": "List no more than this many events under the grid, with Show more for the rest; today's events already over don't count and are left out until it's pressed. The grid's dots still show every item."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^hide_empty_days(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "hide_empty_days": {
                "type": "boolean",
                "default": false,
                "description": "With days, leave out the days with nothing on them, instead of saying \"Nothing scheduled\" under each; with none left, the card says it once."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 300,
                "description": "Up to 300 items, in the agenda's form. Each day with something on it gets a dot in the item's colour (up to three); clicking a day lists its items under the grid, as the agenda shows them.",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "start": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                        },
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      ],
                      "description": "A date-time with seconds and a zone, like 2026-10-27T09:30:00-05:00, or a date like 2026-10-28 for an all-day item, which stays on that date in any time zone."
                    },
                    "end": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                        },
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      ],
                      "description": "Optional, in the same form as start and not before it. A date end is the last day the item covers, inclusive: an offsite on the 28th and 29th is start 2026-10-28, end 2026-10-29."
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "A line under the title, like the room or \"ORD → SFO, gate B12\"."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "An https link, or legato://page/ID for another of your pages: the button says Join from 10 minutes before a timed item until it ends, Open otherwise."
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off"
                      ],
                      "description": "A coloured mark on the row. It doesn't count toward the page's status."
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^#[0-9A-Fa-f]{6}$",
                      "description": "#RRGGBB, such as a calendar's colour, drawn as a thin bar at the row's leading edge."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    }
                  },
                  "required": [
                    "title",
                    "start"
                  ],
                  "additionalProperties": false,
                  "if": {
                    "properties": {
                      "start": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      }
                    },
                    "required": [
                      "start"
                    ]
                  },
                  "then": {
                    "properties": {
                      "end": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      }
                    }
                  },
                  "else": {
                    "properties": {
                      "end": {
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
                      }
                    }
                  }
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "timeline": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "timeline"
        },
        "label": {
          "type": "string"
        },
        "items": {
          "type": "array",
          "description": "Up to 60 events, newest first. When Legato can read every at, it sorts them itself; otherwise they stay in the order sent. An empty list is allowed and says \"No events yet\".",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string",
                "description": "The event, in the source's own words: Out for delivery, Arrived at facility."
              },
              "at": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  }
                ],
                "description": "When it happened: ISO 8601, a date (2026-11-04, drawn with no time), a date and time with no zone (2026-11-04 14:30:00, read as this Mac's time), Unix seconds, or a carrier's own words such as \"Monday, November 2, 2026 3:14 PM\" or \"02.11.2026 14:30\". A time Legato can't read is shown as written on the detail line, under the day before it."
              },
              "detail": {
                "type": "string",
                "description": "The line under the title: where it happened, such as Beaverton, OR."
              },
              "state": {
                "description": "warning, critical or unknown draws that mark on the rail in place of the node, for an exception or a failed delivery attempt; ok and off are the plain node. It doesn't count toward the page's status."
              },
              "icon": {
                "type": "string",
                "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
              }
            },
            "additionalProperties": false
          }
        },
        "next": {
          "type": "object",
          "description": "What the source expects next, such as a delivery window: one row above the newest event, a hollow node on a dashed rail, never drawn as an event. Without a start Legato can read, there's no row, so a source can map an expected date that's sometimes missing. Once its end (or its start, with no end) has passed, it's dimmed.",
          "properties": {
            "title": {
              "type": "string",
              "description": "Expected delivery."
            },
            "start": {
              "type": "string",
              "description": "When it's expected, in the forms an item's at takes. A date alone leaves the time column empty."
            },
            "end": {
              "type": "string",
              "description": "The end of the window, on the same day: drawn as 2 – 6 PM."
            },
            "detail": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "max_items": {
          "type": "integer",
          "description": "Show the newest so many events, with Show N more for the rest. The newest is always shown; next and the No updates rows don't count."
        },
        "gap_days": {
          "type": "integer",
          "description": "When two shown events are this many days apart or more, or the newest is this old, a grey \"No updates for N days\" sits between them on a dashed stretch of rail. It keeps up with the Mac's clock. A package page sets 2."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "next": {
                      "$ref": "#/definitions/rule"
                    },
                    "max_items": {
                      "$ref": "#/definitions/rule"
                    },
                    "gap_days": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|items|next|max_items|gap_days)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "items": {
                "type": "array",
                "maxItems": 60,
                "description": "Up to 60 events, newest first. When Legato can read every at, it sorts them itself; otherwise they stay in the order sent. An empty list is allowed and says \"No events yet\".",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "description": "The event, in the source's own words: Out for delivery, Arrived at facility."
                    },
                    "at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100000000000
                        }
                      ],
                      "description": "When it happened: ISO 8601, a date (2026-11-04, drawn with no time), a date and time with no zone (2026-11-04 14:30:00, read as this Mac's time), Unix seconds, or a carrier's own words such as \"Monday, November 2, 2026 3:14 PM\" or \"02.11.2026 14:30\". A time Legato can't read is shown as written on the detail line, under the day before it."
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "The line under the title: where it happened, such as Beaverton, OR."
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off"
                      ],
                      "description": "warning, critical or unknown draws that mark on the rail in place of the node, for an exception or a failed delivery attempt; ok and off are the plain node. It doesn't count toward the page's status."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    }
                  },
                  "required": [
                    "title",
                    "at"
                  ],
                  "additionalProperties": false
                }
              },
              "next": {
                "type": "object",
                "description": "What the source expects next, such as a delivery window: one row above the newest event, a hollow node on a dashed rail, never drawn as an event. Without a start Legato can read, there's no row, so a source can map an expected date that's sometimes missing. Once its end (or its start, with no end) has passed, it's dimmed.",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "Expected delivery."
                  },
                  "start": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "When it's expected, in the forms an item's at takes. A date alone leaves the time column empty."
                  },
                  "end": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "The end of the window, on the same day: drawn as 2 – 6 PM."
                  },
                  "detail": {
                    "type": "string",
                    "maxLength": 120
                  }
                },
                "required": [
                  "title"
                ],
                "additionalProperties": false
              },
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 60,
                "description": "Show the newest so many events, with Show N more for the rest. The newest is always shown; next and the No updates rows don't count."
              },
              "gap_days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30,
                "description": "When two shown events are this many days apart or more, or the newest is this old, a grey \"No updates for N days\" sits between them on a dashed stretch of rail. It keeps up with the Mac's clock. A package page sets 2."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A dated history read newest first, a rail of nodes beside agenda's time column, grouped under day headings in the Mac's time zone: a package's tracking events, a job's runs, an order's steps. The newest event is the current one, with a filled node. next is one forecast row above it, such as a delivery window. A quiet spell of gap_days or more says \"No updates for N days\". No progress ring, percentage or steps that haven't happened.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 60,
                "description": "Up to 60 events, newest first. When Legato can read every at, it sorts them itself; otherwise they stay in the order sent. An empty list is allowed and says \"No events yet\".",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "description": "The event, in the source's own words: Out for delivery, Arrived at facility."
                    },
                    "at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 100000000000
                        }
                      ],
                      "description": "When it happened: ISO 8601, a date (2026-11-04, drawn with no time), a date and time with no zone (2026-11-04 14:30:00, read as this Mac's time), Unix seconds, or a carrier's own words such as \"Monday, November 2, 2026 3:14 PM\" or \"02.11.2026 14:30\". A time Legato can't read is shown as written on the detail line, under the day before it."
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 120,
                      "description": "The line under the title: where it happened, such as Beaverton, OR."
                    },
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off"
                      ],
                      "description": "warning, critical or unknown draws that mark on the rail in place of the node, for an exception or a failed delivery attempt; ok and off are the plain node. It doesn't count toward the page's status."
                    },
                    "icon": {
                      "type": "string",
                      "maxLength": 80,
                      "pattern": "^(?:[a-z0-9]+(?:\\.[a-z0-9]+)*|(?:si|di|mdi):[a-z0-9]+(?:-[a-z0-9]+)*|site:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,})$",
                      "description": "Optional icon at the start of the row: an SF Symbol name (creditcard), an icon from Simple Icons (si:chase), Dashboard Icons (di:paypal) or Material Design Icons (mdi:cash), as Glance names them, or a website's own icon (site:citi.com). Logos are drawn in the text's colour by default; each Mac can show site: and di: icons in their brand colours instead."
                    }
                  },
                  "required": [
                    "title",
                    "at"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^next(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "next": {
                "type": "object",
                "description": "What the source expects next, such as a delivery window: one row above the newest event, a hollow node on a dashed rail, never drawn as an event. Without a start Legato can read, there's no row, so a source can map an expected date that's sometimes missing. Once its end (or its start, with no end) has passed, it's dimmed.",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "Expected delivery."
                  },
                  "start": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "When it's expected, in the forms an item's at takes. A date alone leaves the time column empty."
                  },
                  "end": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "The end of the window, on the same day: drawn as 2 – 6 PM."
                  },
                  "detail": {
                    "type": "string",
                    "maxLength": 120
                  }
                },
                "required": [
                  "title"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max_items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 60,
                "description": "Show the newest so many events, with Show N more for the rest. The newest is always shown; next and the No updates rows don't count."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^gap_days(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "gap_days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30,
                "description": "When two shown events are this many days apart or more, or the newest is this old, a grey \"No updates for N days\" sits between them on a dashed stretch of rail. It keeps up with the Mac's clock. A package page sets 2."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "code": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "code"
        },
        "label": {
          "type": "string"
        },
        "language": {
          "type": "string",
          "description": "Optional, shown as a small label, like yaml, bash, swift or json. The code isn't coloured."
        },
        "code": {
          "type": "string",
          "description": "Shown as written, in a monospaced font; long lines scroll sideways."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "language": {
                      "$ref": "#/definitions/rule"
                    },
                    "code": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|language|code)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "language": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9+#.-]{0,23}$",
                "description": "Optional, shown as a small label, like yaml, bash, swift or json. The code isn't coloured."
              },
              "code": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4000,
                "description": "Shown as written, in a monospaced font; long lines scroll sideways."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A block of code or a command, monospaced, with a Copy button: a config fix, a curl command, a log excerpt.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^language(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "language": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9+#.-]{0,23}$",
                "description": "Optional, shown as a small label, like yaml, bash, swift or json. The code isn't coloured."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^code(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "code": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4000,
                "description": "Shown as written, in a monospaced font; long lines scroll sideways."
              }
            },
            "required": [
              "code"
            ]
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "heading": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "heading"
        },
        "text": {
          "type": "string",
          "description": "The section's title, in a larger font, with no card around it."
        },
        "detail": {
          "type": "string",
          "description": "Optional line under the title."
        },
        "icon": {
          "type": "string",
          "description": "Optional SF Symbol name before the title."
        },
        "collapsed": {
          "type": "boolean",
          "default": false,
          "description": "Start with the section closed. A click on the heading opens or closes the cards under it, up to the next heading, either way. A service overview opens with a closed Status section holding its status card; the heading's dot shows when anything inside needs attention."
        },
        "cards": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string"
          },
          "description": "The ids of the cards its section holds, which come right after the heading (in any order). The cards after them stay on the page outside the section, so a section can hold a few cards without taking in the rest of the page. Without it, every card up to the next heading."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "text": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "icon": {
                      "$ref": "#/definitions/rule"
                    },
                    "collapsed": {
                      "$ref": "#/definitions/rule"
                    },
                    "cards": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:text|detail|icon|collapsed|cards)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "description": "The section's title, in a larger font, with no card around it."
              },
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "Optional line under the title."
              },
              "icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "Optional SF Symbol name before the title."
              },
              "collapsed": {
                "type": "boolean",
                "default": false,
                "description": "Start with the section closed. A click on the heading opens or closes the cards under it, up to the next heading, either way. A service overview opens with a closed Status section holding its status card; the heading's dot shows when anything inside needs attention."
              },
              "cards": {
                "type": "array",
                "minItems": 1,
                "maxItems": 24,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                },
                "description": "The ids of the cards its section holds, which come right after the heading (in any order). The cards after them stay on the page outside the section, so a section can hold a few cards without taking in the rest of the page. Without it, every card up to the next heading."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A section title that splits a long page into parts. The cards after it, up to the next heading, are its section, which a click on the heading closes and opens; with cards, only the ones it lists.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^text(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "description": "The section's title, in a larger font, with no card around it."
              }
            },
            "required": [
              "text"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 120,
                "description": "Optional line under the title."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^icon(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(\\.[a-z0-9]+)*$",
                "maxLength": 64,
                "description": "Optional SF Symbol name before the title."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^collapsed(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "collapsed": {
                "type": "boolean",
                "default": false,
                "description": "Start with the section closed. A click on the heading opens or closes the cards under it, up to the next heading, either way. A service overview opens with a closed Status section holding its status card; the heading's dot shows when anything inside needs attention."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^cards(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "cards": {
                "type": "array",
                "minItems": 1,
                "maxItems": 24,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                },
                "description": "The ids of the cards its section holds, which come right after the heading (in any order). The cards after them stay on the page outside the section, so a section can hold a few cards without taking in the rest of the page. Without it, every card up to the next heading."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "strip": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "strip"
        },
        "label": {
          "type": "string"
        },
        "segments": {
          "type": "array",
          "description": "Up to 240 slices, oldest first. Each has a state and an optional label, shown when the pointer is over it.",
          "items": {
            "type": "object",
            "properties": {
              "state": {
                "description": "ok, warning, critical, unknown or off as a status card has them, or none for a slice with no data, drawn as the empty track. Words that aren't a state are unknown; a missing state is none."
              },
              "label": {
                "type": "string",
                "description": "Shown when the pointer is over the segment: its time, and what happened, like \"3 PM · down 12 min\"."
              }
            },
            "additionalProperties": false
          }
        },
        "start_label": {
          "type": "string",
          "description": "Under the left end: when the span starts, like \"24 hours ago\"."
        },
        "end_label": {
          "type": "string",
          "description": "Under the right end: \"Now\"."
        },
        "detail": {
          "type": "string",
          "description": "Beside the label: what the span adds up to, like \"99.2% up\"."
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "segments": {
                      "$ref": "#/definitions/rule"
                    },
                    "start_label": {
                      "$ref": "#/definitions/rule"
                    },
                    "end_label": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|segments|start_label|end_label|detail)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "segments": {
                "type": "array",
                "maxItems": 240,
                "description": "Up to 240 slices, oldest first. Each has a state and an optional label, shown when the pointer is over it.",
                "items": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off",
                        "none"
                      ],
                      "description": "ok, warning, critical, unknown or off as a status card has them, or none for a slice with no data, drawn as the empty track. Words that aren't a state are unknown; a missing state is none."
                    },
                    "label": {
                      "type": "string",
                      "maxLength": 80,
                      "description": "Shown when the pointer is over the segment: its time, and what happened, like \"3 PM · down 12 min\"."
                    }
                  },
                  "additionalProperties": false
                }
              },
              "start_label": {
                "type": "string",
                "maxLength": 40,
                "description": "Under the left end: when the span starts, like \"24 hours ago\"."
              },
              "end_label": {
                "type": "string",
                "maxLength": 40,
                "description": "Under the right end: \"Now\"."
              },
              "detail": {
                "type": "string",
                "maxLength": 40,
                "description": "Beside the label: what the span adds up to, like \"99.2% up\"."
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A row of thin bars, one per slice of a span, each coloured by the state it was in: a monitor's, a host's or a container's last day, from the samples History keeps (collect with sample). Full width. The segment under the pointer shows its label in place of the two end labels, so nothing moves. It is history, not status: it never counts toward the page's status, a section's dot or a notification. Fill segments from a dataset source with each, by_time and buckets, and worst for each slice's state.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^segments(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "segments": {
                "type": "array",
                "maxItems": 240,
                "description": "Up to 240 slices, oldest first. Each has a state and an optional label, shown when the pointer is over it.",
                "items": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "enum": [
                        "ok",
                        "warning",
                        "critical",
                        "unknown",
                        "off",
                        "none"
                      ],
                      "description": "ok, warning, critical, unknown or off as a status card has them, or none for a slice with no data, drawn as the empty track. Words that aren't a state are unknown; a missing state is none."
                    },
                    "label": {
                      "type": "string",
                      "maxLength": 80,
                      "description": "Shown when the pointer is over the segment: its time, and what happened, like \"3 PM · down 12 min\"."
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "segments"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^start_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "start_label": {
                "type": "string",
                "maxLength": 40,
                "description": "Under the left end: when the span starts, like \"24 hours ago\"."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^end_label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "end_label": {
                "type": "string",
                "maxLength": 40,
                "description": "Under the right end: \"Now\"."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 40,
                "description": "Beside the label: what the span adds up to, like \"99.2% up\"."
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "heatmap": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "heatmap"
        },
        "label": {
          "type": "string"
        },
        "detail": {
          "type": "string",
          "description": "Beside the label: what the span adds up to, like \"1,194 in the past year\". The page works it out; the card doesn't."
        },
        "thresholds": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "4 ascending values where levels 1 to 4 start, for an absolute scale: [1, 2500, 5000, 10000] for steps. Without them, a day's level is 0 for 0 or less, else the quartile of every value above 0 that it falls in."
        },
        "items": {
          "type": "array",
          "description": "Up to 371 days, one item each, the first date to the last at most 371 days apart counting both. A date between them with no item is drawn as no data: a page that means zero gives the day value 0. The grid runs from the first date to the last, so to end at today, include today's item.",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string",
                "description": "The day, YYYY-MM-DD, placed as written, never converted to a time zone. The last item for a date wins, so group rows by date first."
              },
              "value": {
                "type": "number",
                "description": "How much happened; the level comes from it unless level is given."
              },
              "level": {
                "type": "integer",
                "description": "The shade, 0 to 4, as the service gives it: GitHub's contributionLevel mapped NONE 0 to FOURTH_QUARTILE 4."
              },
              "label": {
                "type": "string",
                "description": "Shown when the pointer is over the day, and read by VoiceOver: \"3 contributions on Nov 9\". Without one, the date and value."
              },
              "url": {
                "type": "string",
                "description": "Optional link a click on the day opens: https, or legato://page/ID for another page."
              }
            },
            "additionalProperties": false
          }
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "detail": {
                      "$ref": "#/definitions/rule"
                    },
                    "thresholds": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|detail|thresholds|items)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "detail": {
                "type": "string",
                "maxLength": 40,
                "description": "Beside the label: what the span adds up to, like \"1,194 in the past year\". The page works it out; the card doesn't."
              },
              "thresholds": {
                "type": "array",
                "minItems": 4,
                "maxItems": 4,
                "items": {
                  "type": "number"
                },
                "description": "4 ascending values where levels 1 to 4 start, for an absolute scale: [1, 2500, 5000, 10000] for steps. Without them, a day's level is 0 for 0 or less, else the quartile of every value above 0 that it falls in."
              },
              "items": {
                "type": "array",
                "maxItems": 371,
                "description": "Up to 371 days, one item each, the first date to the last at most 371 days apart counting both. A date between them with no item is drawn as no data: a page that means zero gives the day value 0. The grid runs from the first date to the last, so to end at today, include today's item.",
                "items": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string",
                      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
                      "description": "The day, YYYY-MM-DD, placed as written, never converted to a time zone. The last item for a date wins, so group rows by date first."
                    },
                    "value": {
                      "type": "number",
                      "description": "How much happened; the level comes from it unless level is given."
                    },
                    "level": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 4,
                      "description": "The shade, 0 to 4, as the service gives it: GitHub's contributionLevel mapped NONE 0 to FOURTH_QUARTILE 4."
                    },
                    "label": {
                      "type": "string",
                      "maxLength": 80,
                      "description": "Shown when the pointer is over the day, and read by VoiceOver: \"3 contributions on Nov 9\". Without one, the date and value."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link a click on the day opens: https, or legato://page/ID for another page."
                    }
                  },
                  "required": [
                    "date"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "Days as squares in week columns, Sunday at the top and the oldest week at the left, each shaded by how much happened that day: a year of GitHub contributions, steps, completions or spending. Full width, about 53 columns of 6-point squares in the panel, with the month names over the grid and Less … More under it. The day under the pointer shows its label in the legend's place, so nothing moves. A date with no item is drawn as an empty outline, unlike a measured 0. It is history, not status: it never counts toward the page's status, a section's dot or a notification. For GitHub, flatten the calendar's weeks into their days and map contributionLevel to level, never its color.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^detail(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "detail": {
                "type": "string",
                "maxLength": 40,
                "description": "Beside the label: what the span adds up to, like \"1,194 in the past year\". The page works it out; the card doesn't."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^thresholds(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "thresholds": {
                "type": "array",
                "minItems": 4,
                "maxItems": 4,
                "items": {
                  "type": "number"
                },
                "description": "4 ascending values where levels 1 to 4 start, for an absolute scale: [1, 2500, 5000, 10000] for steps. Without them, a day's level is 0 for 0 or less, else the quartile of every value above 0 that it falls in."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 371,
                "description": "Up to 371 days, one item each, the first date to the last at most 371 days apart counting both. A date between them with no item is drawn as no data: a page that means zero gives the day value 0. The grid runs from the first date to the last, so to end at today, include today's item.",
                "items": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string",
                      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
                      "description": "The day, YYYY-MM-DD, placed as written, never converted to a time zone. The last item for a date wins, so group rows by date first."
                    },
                    "value": {
                      "type": "number",
                      "description": "How much happened; the level comes from it unless level is given."
                    },
                    "level": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 4,
                      "description": "The shade, 0 to 4, as the service gives it: GitHub's contributionLevel mapped NONE 0 to FOURTH_QUARTILE 4."
                    },
                    "label": {
                      "type": "string",
                      "maxLength": 80,
                      "description": "Shown when the pointer is over the day, and read by VoiceOver: \"3 contributions on Nov 9\". Without one, the date and value."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link a click on the day opens: https, or legato://page/ID for another page."
                    }
                  },
                  "required": [
                    "date"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "tiles": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "tiles"
        },
        "label": {
          "type": "string",
          "description": "Optional: tiles in a tab that already names them leave it out, and the tiles start at the top."
        },
        "items": {
          "type": "array",
          "description": "Up to 60 tiles, in the order sent. An empty list says Nothing to show yet.",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "description": "The tile's first line, in bold: a symbol, a coin, a host."
              },
              "value": {
                "type": [
                  "string",
                  "number"
                ],
                "description": "The second line: a price as the page writes it (\"$184.62\", \"72.15 EUR\"), a number, or what stands in for one (\"No quote\"). Missing, a dash. On a tile with no change it may take two lines."
              },
              "change": {
                "type": "number",
                "description": "How far it moved, written signed with the card's unit (+2.32%, −4.51%) and setting the tint. Leave it out when there's nothing to compare: the tile then has no change line and stays plain. A number, never a template's text."
              },
              "detail": {
                "type": "string",
                "description": "Shown when the pointer rests on the tile and read by VoiceOver, such as a company's name."
              },
              "url": {
                "type": "string",
                "description": "Optional link a click on the tile opens: https, or legato://page/ID for another page, such as a symbol's page with its params."
              }
            },
            "additionalProperties": false
          }
        },
        "unit": {
          "type": "string",
          "description": "After the change: % when left out. Another unit follows after a space; an empty one shows the number alone."
        },
        "decimals": {
          "type": "integer",
          "description": "The change's decimal places, 2 when left out. A change that rounds to 0 is flat: no sign and no tint."
        },
        "scale": {
          "type": "number",
          "description": "The change that gets the deepest tint, 3 when left out: a fixed scale, so a quiet day looks quiet. Use about 3 for stocks in percent and 10 for coins."
        },
        "max_items": {
          "type": "integer",
          "description": "Show the first so many tiles, in the order sent, with Show N more for the rest."
        },
        "style": {
          "default": "heat",
          "description": "heat (the default) gives each tile a light wash, deeper for a bigger move, and colours the change; quiet leaves the tiles plain and colours only the change line, with an arrow."
        },
        "colors": {
          "type": "object",
          "description": "The colours for up and down, by the breakdown names. Left out: green and red.",
          "properties": {
            "up": {},
            "down": {}
          },
          "additionalProperties": false
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/definitions/cardSource"
            },
            {
              "properties": {
                "map": {
                  "properties": {
                    "label": {
                      "$ref": "#/definitions/rule"
                    },
                    "items": {
                      "$ref": "#/definitions/rule"
                    },
                    "unit": {
                      "$ref": "#/definitions/rule"
                    },
                    "decimals": {
                      "$ref": "#/definitions/rule"
                    },
                    "scale": {
                      "$ref": "#/definitions/rule"
                    },
                    "max_items": {
                      "$ref": "#/definitions/rule"
                    },
                    "style": {
                      "$ref": "#/definitions/rule"
                    },
                    "colors": {
                      "$ref": "#/definitions/rule"
                    }
                  },
                  "propertyNames": {
                    "pattern": "^(?:label|items|unit|decimals|scale|max_items|style|colors)(?:\\.|\\[|$)"
                  }
                }
              }
            }
          ]
        },
        "actions": {
          "type": "array",
          "maxItems": 31,
          "items": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/definitions/action"
                  },
                  {
                    "not": {
                      "required": [
                        "body_from"
                      ]
                    }
                  }
                ]
              },
              {
                "const": "|",
                "description": "Between two buttons: starts a new run of them, drawn with a thin upright line between the runs that show. Not first, last or twice in a row."
              }
            ]
          },
          "description": "Up to six buttons (their when conditions decide which show at a time), or sixteen with actions_placement corner or rows, drawn inside this card's card: attach each to the card whose value it changes. A \"|\" between two buttons parts them into runs, such as security | climate | seats. A source is required on the same card. On a service overview, gather the buttons into one or two text cards with no body (Controls, Climate) and actions_placement corner; show one half of each on/off pair with when (https://legatobar.com/docs/design.md#controls-are-a-row-of-icons)."
        },
        "actions_align": {
          "enum": [
            "leading",
            "center"
          ],
          "default": "leading",
          "description": "How the row of buttons under the card lines up: from the leading edge (leading), or centred (center), the card's own lines staying where they are. Center suits a card that is mostly its buttons, such as a row of scenes."
        },
        "actions_placement": {
          "enum": [
            "bottom",
            "corner",
            "rows"
          ],
          "default": "bottom",
          "description": "Where the card's buttons go: in a row under its content (bottom), in its top-right corner (corner), the content taking the rest of the width, or as settings rows (rows): each button with a setting is a row named by it, a switch for an on/off pair or its menu, and the others sit in the corner. Corner suits a short card with one button at a time, such as Start or Stop climate on the cabin temperature; rows suit a Controls card on a sheet."
        },
        "periods": {
          "type": "array",
          "minItems": 1,
          "maxItems": 60,
          "description": "For a page with a period, on a card without a source: the card’s values for each choice, written by an agent or script. Each entry names its choice and the days it covers (from, and to); the entry whose from is the first day showing is used, so stepping back finds an earlier one if it was written. With nothing for the days showing, the card says so; on a new span not yet written, the last one shows with the days it covers. Fields not in an entry come from the card.",
          "items": {
            "type": "object",
            "properties": {
              "choice": {
                "type": "string",
                "description": "The id of one of the period’s choices."
              },
              "from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The first day the values cover, YYYY-MM-DD."
              },
              "to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "The last day they cover."
              },
              "updated": {
                "type": "string",
                "format": "date-time",
                "description": "When they were written."
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: tiles in a tab that already names them leave it out, and the tiles start at the top."
              },
              "items": {
                "type": "array",
                "maxItems": 60,
                "description": "Up to 60 tiles, in the order sent. An empty list says Nothing to show yet.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 16,
                      "description": "The tile's first line, in bold: a symbol, a coin, a host."
                    },
                    "value": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "maxLength": 24,
                      "description": "The second line: a price as the page writes it (\"$184.62\", \"72.15 EUR\"), a number, or what stands in for one (\"No quote\"). Missing, a dash. On a tile with no change it may take two lines."
                    },
                    "change": {
                      "type": "number",
                      "description": "How far it moved, written signed with the card's unit (+2.32%, −4.51%) and setting the tint. Leave it out when there's nothing to compare: the tile then has no change line and stays plain. A number, never a template's text."
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 80,
                      "description": "Shown when the pointer rests on the tile and read by VoiceOver, such as a company's name."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link a click on the tile opens: https, or legato://page/ID for another page, such as a symbol's page with its params."
                    }
                  },
                  "required": [
                    "label"
                  ],
                  "additionalProperties": false
                }
              },
              "unit": {
                "type": "string",
                "maxLength": 16,
                "description": "After the change: % when left out. Another unit follows after a space; an empty one shows the number alone."
              },
              "decimals": {
                "type": "integer",
                "minimum": 0,
                "maximum": 4,
                "description": "The change's decimal places, 2 when left out. A change that rounds to 0 is flat: no sign and no tint."
              },
              "scale": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "The change that gets the deepest tint, 3 when left out: a fixed scale, so a quiet day looks quiet. Use about 3 for stocks in percent and 10 for coins."
              },
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 60,
                "description": "Show the first so many tiles, in the order sent, with Show N more for the rest."
              },
              "style": {
                "enum": [
                  "heat",
                  "quiet"
                ],
                "default": "heat",
                "description": "heat (the default) gives each tile a light wash, deeper for a bigger move, and colours the change; quiet leaves the tiles plain and colours only the change line, with an arrow."
              },
              "colors": {
                "type": "object",
                "description": "The colours for up and down, by the breakdown names. Left out: green and red.",
                "properties": {
                  "up": {
                    "enum": [
                      "blue",
                      "teal",
                      "orange",
                      "purple",
                      "green",
                      "pink",
                      "yellow",
                      "red",
                      "rose",
                      "grey",
                      "slate",
                      "graphite",
                      "ink",
                      "gray"
                    ]
                  },
                  "down": {
                    "enum": [
                      "blue",
                      "teal",
                      "orange",
                      "purple",
                      "green",
                      "pink",
                      "yellow",
                      "red",
                      "rose",
                      "grey",
                      "slate",
                      "graphite",
                      "ink",
                      "gray"
                    ]
                  }
                },
                "additionalProperties": false
              }
            },
            "required": [
              "choice",
              "from"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "description": "A grid of small tiles, four across, each a label, a value and a change: a watchlist's symbols with their prices and how far each moved. By default a tile has a light green wash when its change is up and a light red one when it's down, a little deeper the further it moved, up to scale, and the change is written in that colour; a flat or missing change leaves it plain. style quiet leaves every tile plain and colours only the change, with an arrow. The card never counts toward the page's status, a section's dot or a notification. Full width.",
      "allOf": [
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^label(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60,
                "description": "Optional: tiles in a tab that already names them leave it out, and the tiles start at the top."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "items": {
                "type": "array",
                "maxItems": 60,
                "description": "Up to 60 tiles, in the order sent. An empty list says Nothing to show yet.",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 16,
                      "description": "The tile's first line, in bold: a symbol, a coin, a host."
                    },
                    "value": {
                      "type": [
                        "string",
                        "number"
                      ],
                      "maxLength": 24,
                      "description": "The second line: a price as the page writes it (\"$184.62\", \"72.15 EUR\"), a number, or what stands in for one (\"No quote\"). Missing, a dash. On a tile with no change it may take two lines."
                    },
                    "change": {
                      "type": "number",
                      "description": "How far it moved, written signed with the card's unit (+2.32%, −4.51%) and setting the tint. Leave it out when there's nothing to compare: the tile then has no change line and stays plain. A number, never a template's text."
                    },
                    "detail": {
                      "type": "string",
                      "maxLength": 80,
                      "description": "Shown when the pointer rests on the tile and read by VoiceOver, such as a company's name."
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^(https://[^\\s]+|legato://page/(?![^#?]*\\.json(?:[#?]|$))[A-Za-z0-9]([A-Za-z0-9._-]|%20){0,127}(\\?[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}(&[a-z][a-z0-9_]{0,31}=(?:\\{param\\.[a-z][a-z0-9_]{0,31}\\}|[A-Za-z0-9._~-]|%(?:2[06789cCdDeE]|3[0-9aA]|4[1-9a-fA-F]|5[0-9aAfF]|6[1-9a-fA-F]|7[0-9aAeE]|[89a-fA-F][0-9a-fA-F])){1,480}){0,3})?(#[a-z0-9][a-z0-9_-]{0,63})?)$",
                      "description": "Optional link a click on the tile opens: https, or legato://page/ID for another page, such as a symbol's page with its params."
                    }
                  },
                  "required": [
                    "label"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "items"
            ]
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^unit(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "unit": {
                "type": "string",
                "maxLength": 16,
                "description": "After the change: % when left out. Another unit follows after a space; an empty one shows the number alone."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^decimals(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "decimals": {
                "type": "integer",
                "minimum": 0,
                "maximum": 4,
                "description": "The change's decimal places, 2 when left out. A change that rounds to 0 is flat: no sign and no tint."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^scale(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "scale": {
                "type": "number",
                "exclusiveMinimum": 0,
                "description": "The change that gets the deepest tint, 3 when left out: a fixed scale, so a quiet day looks quiet. Use about 3 for stocks in percent and 10 for coins."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^max_items(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "max_items": {
                "type": "integer",
                "minimum": 1,
                "maximum": 60,
                "description": "Show the first so many tiles, in the order sent, with Show N more for the rest."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^style(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "style": {
                "enum": [
                  "heat",
                  "quiet"
                ],
                "default": "heat",
                "description": "heat (the default) gives each tile a light wash, deeper for a bigger move, and colours the change; quiet leaves the tiles plain and colours only the change line, with an arrow."
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "required": [
                      "map"
                    ],
                    "properties": {
                      "map": {
                        "not": {
                          "propertyNames": {
                            "not": {
                              "pattern": "^colors(?:\\.|\\[|$)"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              {
                "required": [
                  "periods"
                ]
              }
            ]
          },
          "then": {},
          "else": {
            "properties": {
              "colors": {
                "type": "object",
                "description": "The colours for up and down, by the breakdown names. Left out: green and red.",
                "properties": {
                  "up": {
                    "enum": [
                      "blue",
                      "teal",
                      "orange",
                      "purple",
                      "green",
                      "pink",
                      "yellow",
                      "red",
                      "rose",
                      "grey",
                      "slate",
                      "graphite",
                      "ink",
                      "gray"
                    ]
                  },
                  "down": {
                    "enum": [
                      "blue",
                      "teal",
                      "orange",
                      "purple",
                      "green",
                      "pink",
                      "yellow",
                      "red",
                      "rose",
                      "grey",
                      "slate",
                      "graphite",
                      "ink",
                      "gray"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        {
          "not": {
            "required": [
              "periods",
              "daily"
            ]
          }
        },
        {
          "if": {
            "required": [
              "actions"
            ]
          },
          "then": {
            "required": [
              "source"
            ]
          }
        },
        {
          "if": {
            "not": {
              "required": [
                "actions"
              ]
            }
          },
          "then": {
            "properties": {
              "source": {
                "anyOf": [
                  {
                    "required": [
                      "map"
                    ]
                  },
                  {
                    "required": [
                      "when"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "if": {
            "anyOf": [
              {
                "required": [
                  "periods"
                ]
              },
              {
                "required": [
                  "daily"
                ]
              }
            ]
          },
          "then": {
            "not": {
              "required": [
                "source"
              ]
            }
          }
        }
      ]
    },
    "tabs": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "const": "tabs"
        },
        "same_height": {
          "type": "boolean",
          "default": false,
          "description": "Every tab takes the tallest tab's height, its last card stretching to fill it, so switching tabs never moves the cards below. For tabs of lists that change length, such as Due, Upcoming and Inbox."
        },
        "counts": {
          "type": "boolean",
          "default": false,
          "description": "Each tab's name is followed by how many its first list holds: its total when it has one, else its lines (\"All 74,628\", \"Blocked 15,000\"), so the tabs are the totals too."
        },
        "search": {
          "type": "object",
          "description": "A search field at the end of the tab names that opens the page with the words in one of its params, such as a query log's domain. Return searches; clearing it goes back to the param's default. contains (the default) sends the words between * wildcards, exact as typed. The field shows what the param holds now.",
          "properties": {
            "param": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40,
              "description": "One of the page's params."
            },
            "prompt": {
              "type": "string",
              "minLength": 1,
              "maxLength": 24
            },
            "match": {
              "enum": [
                "contains",
                "exact"
              ],
              "default": "contains"
            }
          },
          "required": [
            "param"
          ],
          "additionalProperties": false
        },
        "tabs": {
          "type": "array",
          "minItems": 2,
          "maxItems": 5,
          "description": "The tabs, left to right. The first shows until the person picks another; each Mac remembers their choice.",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 24,
                "description": "The tab's name, like \"Hacker News\" or \"This week\"."
              },
              "cards": {
                "type": "array",
                "minItems": 1,
                "maxItems": 12,
                "description": "The cards the tab shows, laid out as a page's are. Any card type but tabs and heading; ids are unique across the whole page.",
                "items": {
                  "$ref": "#/definitions/tabbedCard"
                }
              }
            },
            "required": [
              "label",
              "cards"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "id",
        "type",
        "tabs"
      ],
      "additionalProperties": false,
      "description": "Two to five tabs in one place on the page, each with its own cards: a click on a tab's name shows its cards. For views of one thing that would otherwise stack: several feeds, today against this week, one server each. Cards in a tab that isn't showing still count toward the page's status and notifications."
    },
    "tabbedCard": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "enum": [
            "stat",
            "pacing",
            "list",
            "table",
            "sparkline",
            "status",
            "text",
            "link",
            "countdown",
            "window",
            "map",
            "facts",
            "gauge",
            "bars",
            "breakdown",
            "flow",
            "ranges",
            "columns",
            "fleet",
            "checklist",
            "agenda",
            "month",
            "timeline",
            "code",
            "strip",
            "heatmap",
            "tiles"
          ]
        }
      },
      "required": [
        "id",
        "type"
      ],
      "not": {
        "required": [
          "placement"
        ]
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "type": {
                "const": "stat"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/stat"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "pacing"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/pacing"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "list"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/list"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "table"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/table"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "sparkline"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/sparkline"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "status"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/status"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "text"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/text"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "link"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/link"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "countdown"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/countdown"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "window"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/window"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "map"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/mapCard"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "facts"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/facts"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "gauge"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/gauge"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "bars"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/bars"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "breakdown"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/breakdown"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "flow"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/flow"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "ranges"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/ranges"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "columns"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/columns"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "fleet"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/fleet"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "checklist"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/checklist"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "agenda"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/agenda"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "month"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/month"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "timeline"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/timeline"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "code"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/code"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "strip"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/strip"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "heatmap"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/heatmap"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "tiles"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/tiles"
          }
        }
      ]
    },
    "card": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        },
        "type": {
          "enum": [
            "stat",
            "pacing",
            "list",
            "table",
            "sparkline",
            "status",
            "text",
            "link",
            "countdown",
            "window",
            "map",
            "facts",
            "gauge",
            "bars",
            "breakdown",
            "flow",
            "ranges",
            "columns",
            "vehicle",
            "fleet",
            "checklist",
            "agenda",
            "month",
            "timeline",
            "code",
            "heading",
            "tabs",
            "strip",
            "heatmap",
            "tiles"
          ]
        }
      },
      "required": [
        "id",
        "type"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "type": {
                "const": "stat"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/stat"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "pacing"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/pacing"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "list"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/list"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "table"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/table"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "sparkline"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/sparkline"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "status"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/status"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "text"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/text"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "link"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/link"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "countdown"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/countdown"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "window"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/window"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "map"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/mapCard"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "facts"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/facts"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "gauge"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/gauge"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "bars"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/bars"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "breakdown"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/breakdown"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "flow"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/flow"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "ranges"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/ranges"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "columns"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/columns"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "vehicle"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/vehicle"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "fleet"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/fleet"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "checklist"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/checklist"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "agenda"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/agenda"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "month"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/month"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "timeline"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/timeline"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "code"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/code"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "heading"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/heading"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "tabs"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/tabs"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "strip"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/strip"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "heatmap"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/heatmap"
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "tiles"
              }
            },
            "required": [
              "type"
            ]
          },
          "then": {
            "$ref": "#/definitions/tiles"
          }
        }
      ]
    }
  }
}
