{
  "$id": "numberline.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Numberline Question Schema",
  "description": "Schema for Numberline question type, consistent with Learnosity standards.",
  "$ref": "learnosity-question-base.schema.json",
  "type": "object",
  "required": ["stimulus", "labels", "line", "points", "snap_to_ticks", "ticks", "feedback_attempts"],
  "properties": {
    "type": {
      "type": "string",
      "const": "numberline",
      "description": "Question type identifier. Must be 'numberline'."
    },
    "stimulus": {
      "type": "string",
      "description": "The question prompt or stimulus."
    },
    "labels": {
      "type": "object",
      "properties": {
        "frequency": { "type": "number", "minimum": 1 },
        "show_max": { "type": "boolean" },
        "show_min": { "type": "boolean" }
      },
      "required": ["frequency", "show_max", "show_min"],
      "additionalProperties": false,
      "description": "Configuration for number line labels."
    },
    "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."
    },
    "points": {
      "type": "array",
      "items": { "type": "string" },
      "minItems": 1,
      "description": "Array of points to be plotted on the number line."
    },
    "snap_to_ticks": {
      "type": "boolean",
      "description": "Whether points should snap to tick marks."
    },
    "ticks": {
      "type": "object",
      "properties": {
        "distance": { "type": "number", "minimum": 0 },
        "show": { "type": "boolean" },
        "fractions": { 
          "type": "string",
          "enum": ["normalized-fractions", "mixed-numbers", "decimals"]
        }
      },
      "required": ["distance", "show", "fractions"],
      "additionalProperties": false,
      "description": "Configuration for tick marks on the number line."
    },
    "feedback_attempts": {
      "type": ["integer", "string"],
      "description": "Number of attempts before showing feedback"
    },
    "ui_style": {
      "allOf": [
        { "$ref": "ui_style.schema.json" }
      ]
    },
    "is_math": {
      "type": "boolean",
      "description": "Indicates if the question is math-related."
    }
  },
  "additionalProperties": true
}