{
  "$defs": {
    "DistributionSummary": {
      "description": "A distribution in business units: mean, sd and named quantiles (``\"0.05\"`` \u2026).",
      "examples": [
        {
          "mean": 2.6,
          "quantiles": {
            "0.05": 1.5,
            "0.5": 2.5,
            "0.95": 4.1
          },
          "sd": 0.8
        }
      ],
      "properties": {
        "mean": {
          "title": "Mean",
          "type": "number"
        },
        "quantiles": {
          "additionalProperties": {
            "type": "number"
          },
          "maxProperties": 32,
          "title": "Quantiles",
          "type": "object"
        },
        "sd": {
          "minimum": 0,
          "title": "Sd",
          "type": "number"
        },
        "units": {
          "anyOf": [
            {
              "maxLength": 64,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Units"
        }
      },
      "required": [
        "mean",
        "sd"
      ],
      "title": "DistributionSummary",
      "type": "object"
    },
    "FanChart": {
      "description": "Quantile bands of a series along one dim (a KPI fan): ``values[i][j]`` is quantile\n``quantiles[i]`` at ``coords[j]``. ``observed`` (if any) is the data over ``coords``.",
      "examples": [
        {
          "coords": [
            "2026-01-04",
            "2026-01-11"
          ],
          "dim": "time",
          "observed": [
            101.0,
            99.5
          ],
          "quantiles": [
            0.05,
            0.5,
            0.95
          ],
          "units": "kEUR",
          "values": [
            [
              80.0,
              82.0
            ],
            [
              100.0,
              103.0
            ],
            [
              125.0,
              129.0
            ]
          ]
        }
      ],
      "properties": {
        "coords": {
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              },
              {
                "type": "number"
              }
            ]
          },
          "maxItems": 10000,
          "title": "Coords",
          "type": "array"
        },
        "dim": {
          "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
          "title": "Dim",
          "type": "string"
        },
        "observed": {
          "anyOf": [
            {
              "items": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Observed"
        },
        "quantiles": {
          "items": {
            "type": "number"
          },
          "maxItems": 16,
          "minItems": 1,
          "title": "Quantiles",
          "type": "array"
        },
        "units": {
          "anyOf": [
            {
              "maxLength": 64,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Units"
        },
        "values": {
          "items": {
            "items": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array"
          },
          "maxItems": 16,
          "title": "Values",
          "type": "array"
        }
      },
      "required": [
        "dim",
        "coords",
        "quantiles",
        "values"
      ],
      "title": "FanChart",
      "type": "object"
    },
    "ForecastView": {
      "additionalProperties": true,
      "description": "``ui/guided/forecast.json``: the KPI of a ``forecast`` score run for Guided mode.\n\n``fan.coords`` are the last ``history`` fitted periods followed by the forecast periods;\n``fan.observed`` holds the actual KPI over the history (``null`` after it) and\n``fan.values`` the forecast quantiles (``null`` over the history), so the split line sits\nat ``split_at``, the first forecast period. The KPI is summed over ``summed_over``\n(geos, stores, ...) per posterior draw before the quantiles are taken; ``total`` is the\nKPI summed over the whole horizon.",
      "properties": {
        "dim": {
          "maxLength": 128,
          "title": "Dim",
          "type": "string"
        },
        "fan": {
          "$ref": "#/$defs/FanChart"
        },
        "format": {
          "const": "mapi.forecast/v1",
          "default": "mapi.forecast/v1",
          "title": "Format",
          "type": "string"
        },
        "history": {
          "default": 0,
          "minimum": 0,
          "title": "History",
          "type": "integer"
        },
        "kind": {
          "default": "expected",
          "enum": [
            "expected",
            "predictive"
          ],
          "title": "Kind",
          "type": "string"
        },
        "kpi": {
          "maxLength": 128,
          "title": "Kpi",
          "type": "string"
        },
        "split_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Split At"
        },
        "summed_over": {
          "items": {
            "type": "string"
          },
          "maxItems": 32,
          "title": "Summed Over",
          "type": "array"
        },
        "total": {
          "anyOf": [
            {
              "$ref": "#/$defs/DistributionSummary"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "units": {
          "anyOf": [
            {
              "maxLength": 64,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Units"
        }
      },
      "required": [
        "kpi",
        "dim",
        "fan"
      ],
      "title": "ForecastView",
      "type": "object"
    }
  },
  "$id": "https://schemas.mapi.dev/v1/explore-forecast.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": true,
  "description": "``forecast``: forecast fans after the fitted history (see :class:`ForecastView`).",
  "properties": {
    "caption_plain": {
      "anyOf": [
        {
          "maxLength": 1000,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Caption Plain"
    },
    "forecasts": {
      "items": {
        "$ref": "#/$defs/ForecastView"
      },
      "maxItems": 200,
      "title": "Forecasts",
      "type": "array"
    },
    "format": {
      "const": "mapi.model-explorer.forecast/v1",
      "default": "mapi.model-explorer.forecast/v1",
      "title": "Format",
      "type": "string"
    },
    "node": {
      "anyOf": [
        {
          "pattern": "^/(?:[A-Za-z_][A-Za-z0-9_.\\-]{0,63}(?:/[A-Za-z_][A-Za-z0-9_.\\-]{0,63}){0,7})?$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "M4: the node of a tree dataset the view describes (absent for a flat dataset)",
      "title": "Node"
    },
    "warnings_plain": {
      "items": {
        "type": "string"
      },
      "maxItems": 50,
      "title": "Warnings Plain",
      "type": "array"
    }
  },
  "title": "ModelForecastView",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
