{
  "$defs": {
    "barChartSpec": {
      "additionalProperties": false,
      "description": "BarChart: categorical bars from time-series queries (value/percentage, optional stack).",
      "properties": {
        "calculation": {
          "type": "string"
        },
        "format": {
          "$ref": "#/$defs/valueFormatOptions"
        },
        "groupBy": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "header": {
          "$ref": "#/$defs/headerHide"
        },
        "isStacked": {
          "type": "boolean"
        },
        "mode": {
          "enum": [
            "value",
            "percentage"
          ],
          "type": "string"
        },
        "orientation": {
          "enum": [
            "horizontal",
            "vertical"
          ],
          "type": "string"
        },
        "sort": {
          "enum": [
            "asc",
            "desc"
          ],
          "type": "string"
        }
      },
      "type": "object"
    },
    "builtinVariables": {
      "additionalProperties": false,
      "description": "Built-in interpolation variables provided by the UI at render time. They are NOT listed in spec.variables. Reference them in PromQL, markdown, and other strings as $__from or ${__from}. Do not declare user variables with these names. When ListVariable.allowAllValue is true, the all-selection sentinel is $__all.",
      "properties": {
        "__dashboard": {
          "description": "The name of the current dashboard (spec.display.name)",
          "type": "string"
        },
        "__from": {
          "description": "Start time of the current time range in unix millisecond epoch",
          "type": "string"
        },
        "__interval": {
          "description": "Auto-calculated step between range query data points (Prom duration)",
          "type": "string"
        },
        "__interval_ms": {
          "description": "Auto-calculated step between range query data points in milliseconds",
          "type": "string"
        },
        "__range": {
          "description": "The range for the current dashboard in human readable format (e.g. 1h, 6h)",
          "type": "string"
        },
        "__range_ms": {
          "description": "The range for the current dashboard in milliseconds",
          "type": "string"
        },
        "__range_s": {
          "description": "The range for the current dashboard in seconds",
          "type": "string"
        },
        "__rate_interval": {
          "description": "Recommended range for rate() and increase() — at least 4× scrape interval",
          "type": "string"
        },
        "__to": {
          "description": "End time of the current time range in unix millisecond epoch",
          "type": "string"
        }
      },
      "type": "object"
    },
    "dashboardDisplay": {
      "additionalProperties": false,
      "description": "Dashboard title/description. name is required and projected to API Dashboard.name (max 255). description projects to Dashboard.description (max 1000).",
      "properties": {
        "description": {
          "maxLength": 1000,
          "type": "string"
        },
        "name": {
          "maxLength": 255,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "digitalOceanLogTableQueryDefinition": {
      "additionalProperties": false,
      "description": "LogQuery for LogTable panels (plugin DigitalOceanLogTableQuery).",
      "properties": {
        "kind": {
          "const": "LogQuery"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "plugin": {
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "DigitalOceanLogTableQuery"
                },
                "spec": {
                  "$ref": "#/$defs/digitalOceanLogTableQuerySpec"
                }
              },
              "required": [
                "kind",
                "spec"
              ],
              "type": "object"
            }
          },
          "required": [
            "plugin"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "digitalOceanLogTableQuerySpec": {
      "additionalProperties": false,
      "description": "Log table query; table must be logs.",
      "properties": {
        "table": {
          "const": "logs",
          "type": "string"
        }
      },
      "required": [
        "table"
      ],
      "type": "object"
    },
    "durationString": {
      "description": "Single-unit Prometheus-style duration (e.g. 1h). Prefer this over concatenated units.",
      "examples": [
        "1h",
        "30m",
        "6h",
        "24h",
        "30s"
      ],
      "pattern": "^(\\d+)(ms|s|m|h|d|w|y)$",
      "type": "string"
    },
    "gaugeSpec": {
      "additionalProperties": false,
      "description": "GaugeChart: radial gauge for a calculated value from time-series queries.",
      "properties": {
        "calculation": {
          "type": "string"
        },
        "format": {
          "$ref": "#/$defs/valueFormatOptions"
        },
        "header": {
          "$ref": "#/$defs/headerHide"
        },
        "legend": {
          "additionalProperties": false,
          "properties": {
            "show": {
              "type": "boolean"
            }
          },
          "type": "object"
        },
        "max": {
          "type": "number"
        },
        "name": {
          "type": "string"
        },
        "thresholds": {
          "type": "object"
        }
      },
      "type": "object"
    },
    "gridItemDefinition": {
      "additionalProperties": false,
      "properties": {
        "content": {
          "additionalProperties": false,
          "properties": {
            "$ref": {
              "description": "Reference to a panel key, e.g. #/spec/panels/cpu-usage",
              "pattern": "^#/spec/panels/[a-zA-Z0-9_-]+$",
              "type": "string"
            }
          },
          "required": [
            "$ref"
          ],
          "type": "object"
        },
        "height": {
          "description": "Row span",
          "minimum": 1,
          "type": "integer"
        },
        "width": {
          "description": "Column span (e.g. 12 = full width)",
          "minimum": 1,
          "type": "integer"
        },
        "x": {
          "description": "Grid column position (0-based)",
          "minimum": 0,
          "type": "integer"
        },
        "y": {
          "description": "Grid row position (0-based)",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "x",
        "y",
        "width",
        "height",
        "content"
      ],
      "type": "object"
    },
    "headerHide": {
      "additionalProperties": false,
      "properties": {
        "hide": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "labelNamesListVariablePlugin": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "LabelNamesListVariable"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "metric": {
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "labelValuesListVariablePlugin": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "LabelValuesListVariable"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "label": {
              "minLength": 1,
              "type": "string"
            },
            "metric": {
              "type": "string"
            }
          },
          "required": [
            "label"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "layoutDefinition": {
      "additionalProperties": false,
      "description": "A Grid layout group. kind must be Grid.",
      "properties": {
        "kind": {
          "const": "Grid"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "display": {
              "additionalProperties": false,
              "description": "Group header (shown when there are multiple layouts).",
              "properties": {
                "collapse": {
                  "additionalProperties": false,
                  "properties": {
                    "open": {
                      "default": true,
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                },
                "title": {
                  "examples": [
                    "New group",
                    "Overview"
                  ],
                  "type": "string"
                }
              },
              "type": "object"
            },
            "items": {
              "description": "Grid cells; each content.$ref must match a key in spec.panels.",
              "items": {
                "$ref": "#/$defs/gridItemDefinition"
              },
              "type": "array"
            },
            "repeatVariable": {
              "type": "string"
            }
          },
          "required": [
            "items"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "link": {
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "renderVariables": {
          "type": "boolean"
        },
        "targetBlank": {
          "type": "boolean"
        },
        "tooltip": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "listVariableAllSentinel": {
      "const": "$__all",
      "description": "Sentinel value used when a ListVariable has allowAllValue and the user selects All."
    },
    "listVariableDefinition": {
      "additionalProperties": false,
      "description": "List variable. Required: name, allowMultiple, allowAllValue, defaultValue, plugin.",
      "properties": {
        "kind": {
          "const": "ListVariable"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "allowAllValue": {
              "type": "boolean"
            },
            "allowMultiple": {
              "type": "boolean"
            },
            "capturingRegexp": {
              "type": "string"
            },
            "customAllValue": {
              "type": "string"
            },
            "defaultValue": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string"
                },
                {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                }
              ]
            },
            "display": {
              "$ref": "#/$defs/variableDisplay"
            },
            "name": {
              "type": "string"
            },
            "plugin": {
              "$ref": "#/$defs/listVariablePlugin"
            },
            "sort": {
              "enum": [
                "none",
                "alphabetical-asc",
                "alphabetical-desc",
                "alphabetical-ci-asc",
                "alphabetical-ci-desc",
                "numerical-asc",
                "numerical-desc"
              ],
              "type": "string"
            }
          },
          "required": [
            "name",
            "allowMultiple",
            "allowAllValue",
            "defaultValue",
            "plugin"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "listVariablePlugin": {
      "oneOf": [
        {
          "$ref": "#/$defs/resourceListVariablePlugin"
        },
        {
          "$ref": "#/$defs/staticListVariablePlugin"
        },
        {
          "$ref": "#/$defs/labelNamesListVariablePlugin"
        },
        {
          "$ref": "#/$defs/labelValuesListVariablePlugin"
        }
      ]
    },
    "logTableSpec": {
      "additionalProperties": false,
      "description": "Log table chart: columns, filters, row limit, optional header.",
      "properties": {
        "activeColumns": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "label": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            },
            "required": [
              "value",
              "label"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "filters": {
          "items": {
            "type": "object"
          },
          "type": "array"
        },
        "header": {
          "$ref": "#/$defs/headerHide"
        },
        "maxLogEntries": {
          "type": "number"
        }
      },
      "type": "object"
    },
    "markdownSpec": {
      "additionalProperties": false,
      "description": "Markdown panel: static documentation text. No queries. text is required.",
      "properties": {
        "header": {
          "$ref": "#/$defs/headerHide"
        },
        "text": {
          "description": "Markdown body",
          "type": "string"
        }
      },
      "required": [
        "text"
      ],
      "type": "object"
    },
    "metricLabelFilter": {
      "additionalProperties": false,
      "properties": {
        "key": {
          "type": "string"
        },
        "namespace": {
          "enum": [
            "attributes",
            "resource_attributes"
          ],
          "type": "string"
        },
        "operator": {
          "enum": [
            "=",
            "!=",
            "=~",
            "!~"
          ],
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "key",
        "namespace",
        "operator",
        "value"
      ],
      "type": "object"
    },
    "metricsTimeSeriesQueryDefinition": {
      "additionalProperties": false,
      "description": "Prom structured time series query: kind TimeSeriesQuery, plugin kind MetricsTimeSeriesQuery.",
      "properties": {
        "kind": {
          "const": "TimeSeriesQuery"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "plugin": {
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "MetricsTimeSeriesQuery"
                },
                "spec": {
                  "$ref": "#/$defs/metricsTimeSeriesQuerySpec"
                }
              },
              "required": [
                "kind",
                "spec"
              ],
              "type": "object"
            }
          },
          "required": [
            "plugin"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "metricsTimeSeriesQuerySpec": {
      "additionalProperties": false,
      "description": "Prom structured metrics query (compiled to PromQL client-side). Required: metricName, kind, filters, groupBy.",
      "properties": {
        "aggregateAs": {
          "enum": [
            "none",
            "sum",
            "avg",
            "min",
            "max"
          ],
          "type": "string"
        },
        "calculateOver": {
          "enum": [
            "1m",
            "2m",
            "5m",
            "10m"
          ],
          "type": "string"
        },
        "filters": {
          "items": {
            "$ref": "#/$defs/metricLabelFilter"
          },
          "type": "array"
        },
        "groupBy": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "histCalculate": {
          "enum": [
            "avg",
            "percentile"
          ],
          "type": "string"
        },
        "histInterval": {
          "enum": [
            "1m",
            "2m",
            "5m",
            "10m"
          ],
          "type": "string"
        },
        "kind": {
          "enum": [
            "counter",
            "gauge",
            "histogram"
          ],
          "type": "string"
        },
        "metricName": {
          "type": "string"
        },
        "minStep": {
          "$ref": "#/$defs/durationString",
          "description": "Minimum step between range-query data points (Prom duration)."
        },
        "percentile": {
          "type": "number"
        },
        "queryMode": {
          "description": "Resolve instant vs range automatically; omit or set auto to derive from the panel.",
          "enum": [
            "auto",
            "instant",
            "range"
          ],
          "type": "string"
        },
        "seriesNameFormat": {
          "description": "Optional legend/tooltip label template. Use {{label_name}} to interpolate Prom label values.",
          "type": "string"
        }
      },
      "required": [
        "metricName",
        "kind",
        "filters",
        "groupBy"
      ],
      "type": "object"
    },
    "panelDefinition": {
      "additionalProperties": false,
      "description": "A single chart: plugin kind selects visualization; queries supply data. Markdown needs no queries; LogTable uses LogQuery; other charts use TimeSeriesQuery (prefer MetricsTimeSeriesQuery).",
      "properties": {
        "kind": {
          "const": "Panel"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "display": {
              "$ref": "#/$defs/panelDisplay"
            },
            "links": {
              "items": {
                "$ref": "#/$defs/link"
              },
              "type": "array"
            },
            "plugin": {
              "$ref": "#/$defs/pluginDefinition"
            },
            "queries": {
              "description": "Query definitions: MetricsTimeSeriesQuery (preferred structured Prom query), PrometheusTimeSeriesQuery (raw PromQL), or LogQuery for LogTable. The first query drives the chart.",
              "items": {
                "oneOf": [
                  {
                    "$ref": "#/$defs/metricsTimeSeriesQueryDefinition"
                  },
                  {
                    "$ref": "#/$defs/prometheusTimeSeriesQueryDefinition"
                  },
                  {
                    "$ref": "#/$defs/digitalOceanLogTableQueryDefinition"
                  }
                ]
              },
              "type": "array"
            }
          },
          "required": [
            "plugin"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "panelDisplay": {
      "additionalProperties": false,
      "description": "Chart display name and description. Header visibility lives on the plugin spec header.",
      "properties": {
        "description": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "pieChartSpec": {
      "additionalProperties": false,
      "description": "PieChart: part-to-whole visualization from time-series queries.",
      "properties": {
        "calculation": {
          "type": "string"
        },
        "format": {
          "$ref": "#/$defs/valueFormatOptions"
        },
        "header": {
          "$ref": "#/$defs/headerHide"
        },
        "legend": {
          "additionalProperties": false,
          "properties": {
            "mode": {
              "enum": [
                "list",
                "table"
              ],
              "type": "string"
            },
            "position": {
              "enum": [
                "bottom",
                "right"
              ],
              "type": "string"
            },
            "size": {
              "enum": [
                "small",
                "medium"
              ],
              "type": "string"
            },
            "values": {
              "items": {
                "enum": [
                  "abs",
                  "relative"
                ],
                "type": "string"
              },
              "type": "array"
            }
          },
          "type": "object"
        },
        "mode": {
          "enum": [
            "value",
            "percentage"
          ],
          "type": "string"
        },
        "showLabels": {
          "type": "boolean"
        },
        "sort": {
          "enum": [
            "asc",
            "desc"
          ],
          "type": "string"
        }
      },
      "type": "object"
    },
    "pluginDefinition": {
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "kind": {
                "const": "Markdown"
              }
            }
          },
          "then": {
            "properties": {
              "spec": {
                "$ref": "#/$defs/markdownSpec"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "StatChart"
              }
            }
          },
          "then": {
            "properties": {
              "spec": {
                "$ref": "#/$defs/statChartSpec"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "TimeSeriesChart"
              }
            }
          },
          "then": {
            "properties": {
              "spec": {
                "$ref": "#/$defs/timeSeriesChartSpec"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "BarChart"
              }
            }
          },
          "then": {
            "properties": {
              "spec": {
                "$ref": "#/$defs/barChartSpec"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "PieChart"
              }
            }
          },
          "then": {
            "properties": {
              "spec": {
                "$ref": "#/$defs/pieChartSpec"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "GaugeChart"
              }
            }
          },
          "then": {
            "properties": {
              "spec": {
                "$ref": "#/$defs/gaugeSpec"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "LogTable"
              }
            }
          },
          "then": {
            "properties": {
              "spec": {
                "$ref": "#/$defs/logTableSpec"
              }
            }
          }
        }
      ],
      "description": "Visualization plugin. kind selects the chart type; spec must match that kind.",
      "properties": {
        "kind": {
          "description": "Chart visualization type.",
          "enum": [
            "Markdown",
            "StatChart",
            "TimeSeriesChart",
            "BarChart",
            "PieChart",
            "GaugeChart",
            "LogTable"
          ],
          "type": "string"
        },
        "spec": {
          "description": "Plugin-specific spec; structure depends on plugin kind",
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "prometheusTimeSeriesQueryDefinition": {
      "additionalProperties": false,
      "description": "Raw PromQL time series query: kind TimeSeriesQuery, plugin kind PrometheusTimeSeriesQuery.",
      "properties": {
        "kind": {
          "const": "TimeSeriesQuery"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "plugin": {
              "additionalProperties": false,
              "properties": {
                "kind": {
                  "const": "PrometheusTimeSeriesQuery"
                },
                "spec": {
                  "$ref": "#/$defs/prometheusTimeSeriesQuerySpec"
                }
              },
              "required": [
                "kind",
                "spec"
              ],
              "type": "object"
            }
          },
          "required": [
            "plugin"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "prometheusTimeSeriesQuerySpec": {
      "additionalProperties": false,
      "description": "Raw PromQL expression executed via the Prom proxy.",
      "properties": {
        "minStep": {
          "$ref": "#/$defs/durationString",
          "description": "Minimum step between range-query data points (Prom duration)."
        },
        "query": {
          "description": "PromQL expression.",
          "type": "string"
        },
        "queryMode": {
          "description": "Resolve instant vs range automatically; omit or set auto to derive from the panel.",
          "enum": [
            "auto",
            "instant",
            "range"
          ],
          "type": "string"
        },
        "seriesNameFormat": {
          "description": "Optional legend/tooltip label template. Use {{label_name}} to interpolate Prom label values.",
          "type": "string"
        }
      },
      "required": [
        "query"
      ],
      "type": "object"
    },
    "refreshIntervalString": {
      "description": "Auto-refresh interval: a durationString, or \"0\" to disable refresh.",
      "examples": [
        "30s",
        "1m",
        "0"
      ],
      "pattern": "^(0|(\\d+)(ms|s|m|h|d|w|y))$",
      "type": "string"
    },
    "resourceListVariablePlugin": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "ResourceListVariable"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "resource_type": {
              "enum": [
                "apps",
                "container_registry",
                "databases",
                "droplets",
                "functions",
                "kubernetes",
                "load_balancers",
                "managed_agent_sessions",
                "managed_agents",
                "microvms",
                "spaces",
                "uptime"
              ],
              "type": "string"
            }
          },
          "required": [
            "resource_type"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "statChartSpec": {
      "additionalProperties": false,
      "description": "StatChart: single calculated value (optional sparkline) from time-series queries.",
      "properties": {
        "calculation": {
          "type": "string"
        },
        "colorMode": {
          "enum": [
            "none",
            "value",
            "background_solid"
          ],
          "type": "string"
        },
        "format": {
          "$ref": "#/$defs/valueFormatOptions"
        },
        "header": {
          "$ref": "#/$defs/headerHide"
        },
        "legendMode": {
          "enum": [
            "auto",
            "on",
            "off"
          ],
          "type": "string"
        },
        "mappings": {
          "items": {
            "type": "object"
          },
          "type": "array"
        },
        "metricLabel": {
          "type": "string"
        },
        "sparkline": {
          "additionalProperties": false,
          "properties": {
            "color": {
              "type": "string"
            },
            "width": {
              "type": "number"
            }
          },
          "type": "object"
        },
        "thresholds": {
          "type": "object"
        },
        "valueFontSize": {
          "type": "number"
        }
      },
      "type": "object"
    },
    "staticListVariablePlugin": {
      "additionalProperties": false,
      "properties": {
        "kind": {
          "const": "StaticListVariable"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "values": {
              "items": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "$ref": "#/$defs/staticListVariableValue"
                  }
                ]
              },
              "type": "array"
            }
          },
          "required": [
            "values"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "staticListVariableValue": {
      "additionalProperties": false,
      "properties": {
        "label": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "label",
        "value"
      ],
      "type": "object"
    },
    "textVariableDefinition": {
      "additionalProperties": false,
      "description": "Fixed or editable text variable.",
      "properties": {
        "kind": {
          "const": "TextVariable"
        },
        "spec": {
          "additionalProperties": false,
          "properties": {
            "constant": {
              "type": "boolean"
            },
            "display": {
              "$ref": "#/$defs/variableDisplay"
            },
            "name": {
              "type": "string"
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "name",
            "value"
          ],
          "type": "object"
        }
      },
      "required": [
        "kind",
        "spec"
      ],
      "type": "object"
    },
    "timeSeriesChartLegendSpec": {
      "additionalProperties": false,
      "description": "Legend placement and layout for time series charts.",
      "properties": {
        "mode": {
          "description": "List or table layout",
          "enum": [
            "list",
            "table"
          ],
          "type": "string"
        },
        "position": {
          "description": "Where the legend appears relative to the chart",
          "enum": [
            "bottom",
            "right"
          ],
          "type": "string"
        },
        "size": {
          "description": "Legend size preset",
          "enum": [
            "small",
            "medium"
          ],
          "type": "string"
        },
        "values": {
          "description": "When mode is table, which summary columns to show",
          "items": {
            "enum": [
              "mean",
              "first",
              "first-number",
              "last",
              "last-number",
              "min",
              "max",
              "sum",
              "abs",
              "relative"
            ],
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "position"
      ],
      "type": "object"
    },
    "timeSeriesChartQuerySettingsItem": {
      "additionalProperties": false,
      "description": "Per-query styling and formatting overrides for time series charts.",
      "properties": {
        "areaOpacity": {
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "colorMode": {
          "enum": [
            "fixed",
            "fixed-single"
          ],
          "type": "string"
        },
        "colorValue": {
          "type": "string"
        },
        "format": {
          "$ref": "#/$defs/valueFormatOptions"
        },
        "lineStyle": {
          "description": "Line dash style for this query’s series",
          "enum": [
            "solid",
            "dashed",
            "dotted"
          ],
          "type": "string"
        },
        "queryIndex": {
          "minimum": 0,
          "type": "integer"
        },
        "scale": {
          "enum": [
            "linear",
            "logarithmic"
          ],
          "type": "string"
        }
      },
      "required": [
        "queryIndex"
      ],
      "type": "object"
    },
    "timeSeriesChartSpec": {
      "additionalProperties": false,
      "description": "TimeSeriesChart: primary metrics visualization (legend, yAxis, tooltip, per-query settings).",
      "properties": {
        "header": {
          "$ref": "#/$defs/headerHide"
        },
        "legend": {
          "$ref": "#/$defs/timeSeriesChartLegendSpec"
        },
        "querySettings": {
          "items": {
            "$ref": "#/$defs/timeSeriesChartQuerySettingsItem"
          },
          "type": "array"
        },
        "thresholds": {
          "type": "object"
        },
        "tooltip": {
          "$ref": "#/$defs/timeSeriesChartTooltipSpec"
        },
        "visual": {
          "type": "object"
        },
        "yAxis": {
          "$ref": "#/$defs/timeSeriesChartYAxisSpec"
        }
      },
      "type": "object"
    },
    "timeSeriesChartTooltipSpec": {
      "additionalProperties": false,
      "description": "Tooltip behavior for time series charts.",
      "properties": {
        "enablePinning": {
          "type": "boolean"
        }
      },
      "required": [
        "enablePinning"
      ],
      "type": "object"
    },
    "timeSeriesChartYAxisSpec": {
      "additionalProperties": false,
      "description": "Y-axis display and scale for time series charts.",
      "properties": {
        "format": {
          "$ref": "#/$defs/valueFormatOptions"
        },
        "label": {
          "type": "string"
        },
        "logBase": {
          "description": "Logarithmic base when using a log scale; omit for a linear axis",
          "enum": [
            2,
            10
          ],
          "type": "number"
        },
        "max": {
          "type": "number"
        },
        "min": {
          "type": "number"
        },
        "show": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "valueFormatOptions": {
      "additionalProperties": false,
      "description": "Number and value display format. Which optional fields apply depends on the chosen unit.",
      "properties": {
        "decimalPlaces": {
          "type": "number"
        },
        "locale": {
          "type": "string"
        },
        "referenceTime": {
          "type": "number"
        },
        "shortValues": {
          "type": "boolean"
        },
        "timeZone": {
          "type": "string"
        },
        "unit": {
          "description": "Unit or format kind (must be a supported formatter unit id)",
          "enum": [
            "%",
            "aud",
            "bits",
            "bits/sec",
            "bytes",
            "bytes/sec",
            "cad",
            "celsius",
            "chf",
            "cny",
            "counts/sec",
            "date-iso",
            "date-local",
            "date-us",
            "datetime-iso",
            "datetime-local",
            "datetime-us",
            "days",
            "decbits",
            "decbits/sec",
            "decbytes",
            "decbytes/sec",
            "decimal",
            "eur",
            "events/sec",
            "fahrenheit",
            "gbp",
            "hkd",
            "hours",
            "inr",
            "jpy",
            "krw",
            "messages/sec",
            "microseconds",
            "milliseconds",
            "minutes",
            "months",
            "nanoseconds",
            "nok",
            "nzd",
            "ops/sec",
            "packets/sec",
            "percent",
            "percent-decimal",
            "reads/sec",
            "records/sec",
            "relative-time",
            "requests/sec",
            "rows/sec",
            "seconds",
            "sek",
            "sgd",
            "time-iso",
            "time-local",
            "time-us",
            "unix-timestamp",
            "unix-timestamp-ms",
            "usd",
            "weeks",
            "writes/sec",
            "years"
          ],
          "type": "string"
        }
      },
      "type": "object"
    },
    "variableDefinition": {
      "description": "Dashboard variable definition (TextVariable or ListVariable). Names must not collide with built-in tokens in $defs.builtinVariables.",
      "oneOf": [
        {
          "$ref": "#/$defs/textVariableDefinition"
        },
        {
          "$ref": "#/$defs/listVariableDefinition"
        }
      ]
    },
    "variableDisplay": {
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string"
        },
        "hidden": {
          "type": "boolean"
        },
        "name": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "$id": "https://api.digitalocean.com/v2/insights/dashboards/schema",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "DigitalOcean Insights dashboard schema.",
  "properties": {
    "apiVersion": {
      "const": "perses.dev/v1alpha1",
      "description": "API version"
    },
    "kind": {
      "const": "Dashboard",
      "description": "Resource kind; must be Dashboard."
    },
    "spec": {
      "additionalProperties": false,
      "description": "Dashboard body: display, duration, variables, layouts, panels.",
      "properties": {
        "display": {
          "$ref": "#/$defs/dashboardDisplay"
        },
        "duration": {
          "$ref": "#/$defs/durationString",
          "description": "Default time range (e.g. 1h, 30m)."
        },
        "layouts": {
          "description": "Each layout is a group. When multiple layouts exist, each shows a group header (title, collapse).",
          "items": {
            "$ref": "#/$defs/layoutDefinition"
          },
          "minItems": 1,
          "type": "array"
        },
        "links": {
          "items": {
            "$ref": "#/$defs/link"
          },
          "type": "array"
        },
        "panels": {
          "additionalProperties": {
            "$ref": "#/$defs/panelDefinition"
          },
          "description": "Map of chart key to panel definition. Keys are referenced in layout items via $ref.",
          "type": "object"
        },
        "refreshInterval": {
          "$ref": "#/$defs/refreshIntervalString",
          "description": "Auto-refresh interval; durationString or \"0\" to disable."
        },
        "variables": {
          "description": "User-defined dashboard variables (may be empty). Do not use built-in names; see $defs.builtinVariables. Reference builtins in queries as $__from / ${__from}.",
          "items": {
            "$ref": "#/$defs/variableDefinition"
          },
          "type": "array"
        }
      },
      "required": [
        "display",
        "duration",
        "variables",
        "layouts",
        "panels"
      ],
      "type": "object"
    }
  },
  "required": [
    "kind",
    "spec"
  ],
  "title": "Dashboard",
  "type": "object"
}
