{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://quant.example.invalid/v1/charts/slope/schema.json",
  "properties": {
    "kind": {
      "const": "slope"
    },
    "title": {
      "type": "string",
      "title": "Title"
    },
    "unit": {
      "type": "string",
      "title": "Unit"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description"
    },
    "x_label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "X Label"
    },
    "y_label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Y Label"
    },
    "x_reference": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "X Reference"
    },
    "y_reference": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Y Reference"
    },
    "x_domain": {
      "anyOf": [
        {
          "items": {
            "type": "number"
          },
          "type": "array",
          "maxItems": 2,
          "minItems": 2
        },
        {
          "type": "null"
        }
      ],
      "title": "X Domain"
    },
    "y_domain": {
      "anyOf": [
        {
          "items": {
            "type": "number"
          },
          "type": "array",
          "maxItems": 2,
          "minItems": 2
        },
        {
          "type": "null"
        }
      ],
      "title": "Y Domain"
    },
    "x": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "maxItems": 20000,
      "title": "X"
    },
    "y": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "maxItems": 500,
      "title": "Y"
    },
    "series": {
      "items": {
        "$ref": "#/$defs/Series"
      },
      "type": "array",
      "maxItems": 48,
      "title": "Series"
    },
    "points": {
      "items": {
        "$ref": "#/$defs/Point"
      },
      "type": "array",
      "maxItems": 20000,
      "title": "Points"
    },
    "rows": {
      "items": {
        "allOf": [
          {
            "$ref": "#/$defs/Measure"
          },
          {
            "type": "object",
            "required": [
              "start",
              "end"
            ]
          }
        ]
      },
      "type": "array",
      "maxItems": 1000,
      "title": "Rows",
      "minItems": 1
    },
    "matrix": {
      "items": {
        "items": {
          "type": "number"
        },
        "type": "array",
        "maxItems": 3,
        "minItems": 3
      },
      "type": "array",
      "maxItems": 20000,
      "title": "Matrix"
    },
    "forecast_start": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Forecast Start"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "kind",
    "title",
    "unit",
    "rows"
  ],
  "title": "기울기 차트",
  "$defs": {
    "Series": {
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$",
          "title": "Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "values": {
          "items": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": "array",
          "maxItems": 20000,
          "title": "Values"
        },
        "color": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^#[0-9a-fA-F]{6}$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Color"
        },
        "role": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "observed",
                "forecast",
                "actual",
                "benchmark"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Role"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "name",
        "values"
      ],
      "title": "Series"
    },
    "Point": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "x": {
          "type": "number",
          "title": "X"
        },
        "y": {
          "type": "number",
          "title": "Y"
        },
        "group": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Group"
        },
        "id": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "x",
        "y"
      ],
      "title": "Point"
    },
    "Measure": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Value"
        },
        "id": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Id"
        },
        "start": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Start"
        },
        "end": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "End"
        },
        "low": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Low"
        },
        "high": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "High"
        },
        "target": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Target"
        },
        "type": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "delta",
                "total"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Type"
        },
        "values": {
          "anyOf": [
            {
              "items": {
                "type": "number"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Values"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "value"
      ],
      "title": "Measure"
    }
  }
}
