{
  "$id": "numberlineplot.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "NumberlinePlot Question Schema",
  "description": "Schema for NumberlinePlot question type, consistent with Learnosity standards.",
  "$ref": "learnosity-question-base.schema.json",
  "type": "object",
  "required": ["stimulus", "stacked", "stacked_elements", "line", "ticks", "toolbar", "feedback_attempts", "ui_style"],
  "properties": {
    "type": {
      "type": "string",
      "const": "numberlineplot",
      "description": "Question type identifier. Must be 'numberlineplot'."
    },
    "stimulus": {
      "type": "string",
      "description": "The question prompt or stimulus."
    },
    "stacked": {
      "type": "boolean",
      "description": "Whether multiple number lines are stacked."
    },
    "stacked_elements": {
      "type": "integer",
      "minimum": 1,
      "description": "Number of stacked number line elements."
    },
    "line": {
      "type": "object",
      "properties": {
        "max": { "type": "number" },
        "min": { "type": "number" },
        "left_arrow": { "type": "boolean" },
        "right_arrow": { "type": "boolean" }
      },
      "required": ["max", "min", "left_arrow", "right_arrow"],
      "additionalProperties": false,
      "description": "Configuration for the number line range and arrows."
    },
    "ticks": {
      "type": "object",
      "properties": {
        "base": { 
          "type": "string",
          "enum": ["zero-based", "min-based", "max-based"]
        },
        "distance": { "type": "number", "minimum": 0 },
        "minor_ticks": { "type": "integer", "minimum": 0 },
        "show": { "type": "boolean" },
        "show_min": { "type": "boolean" },
        "show_max": { "type": "boolean" }
      },
      "required": ["base", "distance", "minor_ticks", "show", "show_min", "show_max"],
      "additionalProperties": false,
      "description": "Configuration for tick marks on the number line plot."
    },
    "toolbar": {
      "type": "array",
      "items": { 
        "type": "string"
      },
      "minItems": 1,
      "description": "Array of available tools for plotting on the number line."
    },
    "feedback_attempts": {
      "type": ["integer", "string"],
      "description": "Number of attempts before showing feedback"
    },
    "ui_style": {
      "allOf": [
        { "$ref": "ui_style.schema.json" },
        { "required": ["layout"] }
      ]
    },
    "is_math": {
      "type": "boolean",
      "description": "Indicates if the question is math-related."
    }
  },
  "additionalProperties": true
}