{
  "$id": "simplechart.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "SimpleChart Question Schema",
  "description": "Schema for SimpleChart question type, supporting histogram and bar chart data visualization.",
  "$ref": "learnosity-question-base.schema.json",
  "type": "object",
  "required": ["stimulus", "chart_data", "max_y_value", "feedback_attempts", "ui_style", "multicolour", "show_gridlines", "stacked_fraction"],
  "properties": {
    "type": { "const": "simplechart" },
    "stimulus": { "type": "string" },
    "chart_data": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "x": { "type": "string" },
              "y": { "type": "number" }
            },
            "required": ["x", "y"],
            "additionalProperties": false
          },
          "minItems": 1
        },
        "name": { "type": "string" }
      },
      "required": ["data", "name"],
      "additionalProperties": false
    },
    "max_y_value": { "type": "number" },
    "multicolour": { "type": "boolean" },
    "show_gridlines": { "type": "string", "enum": ["none", "x_only", "y_only", "both"] },
    "stacked_fraction": { "type": "boolean" },
    "feedback_attempts": { "type": "integer", "minimum": 0 },
    "ui_style": {
      "allOf": [
        { "$ref": "ui_style.schema.json" },
        { "required": ["chart_type", "validation_stem_numeration"] }
      ]
    }
  },
  "additionalProperties": true
}
