{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "version": {
      "type": "number",
      "const": 1
    },
    "kind": {
      "type": "string",
      "enum": ["line", "weekly_volume", "rep_ranges", "heat_map"]
    },
    "exercise_id": {
      "type": "string",
      "minLength": 1
    },
    "variant_id": {
      "type": "string",
      "minLength": 1
    },
    "metric": {
      "type": "string",
      "enum": ["weight", "e1rm", "volume", "reps", "duration", "distance"]
    },
    "range": {
      "type": "string",
      "enum": ["4w", "3m", "6m", "1y", "all"]
    },
    "convention": {
      "type": "string"
    },
    "unit": {
      "type": "string",
      "enum": ["lb", "kg"]
    },
    "rolling_days": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "start_date": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "end_date": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
    },
    "weight_kg": {
      "type": "string",
      "pattern": "^\\d+(?:\\.\\d+)?$"
    }
  },
  "required": ["version", "kind", "exercise_id", "metric", "range"],
  "additionalProperties": false,
  "$id": "https://docs.sendtopigeon.com/schemas/wn-chart-definition@1.schema.json",
  "title": "Pigeon Open Data: wn-chart-definition@1",
  "$comment": "Apache-2.0. Structural schema; use Zod/parseRecord for semantic invariants. This published schema URL is immutable.",
  "examples": [
    {
      "version": 1,
      "kind": "line",
      "exercise_id": "demo-bench",
      "metric": "weight",
      "range": "3m",
      "unit": "kg",
      "variant_id": "demo-close-grip",
      "start_date": "2026-08-16",
      "end_date": "2026-11-16"
    }
  ]
}
