{
  "$id": "imageclozeformulaV2.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ImageClozeFormulaV2 Question Schema",
  "description": "Schema for ImageClozeFormulaV2 question type, supporting image-based mathematical formula input with positioned response containers.",
  "$ref": "learnosity-question-base.schema.json",
  "type": "object",
  "required": ["stimulus", "image", "response_containers", "response_positions", "response_container"],
  "properties": {
    "type": { "const": "imageclozeformulaV2" },
    "stimulus": {
      "type": "string",
      "description": "The question prompt or stimulus."
    },
    "image": {
      "type": "object",
      "properties": {
        "src": {
          "type": "string",
          "description": "URL or path to the image source"
        }
      },
      "required": ["src"],
      "additionalProperties": false
    },
    "response_container": {
      "type": "object",
      "properties": {
        "vertical_top": {
          "type": "boolean",
          "description": "Whether to align response container to top vertically"
        }
      },
      "additionalProperties": true
    },
    "response_containers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string",
            "description": "Template for response container layout"
          },
          "width": {
            "type": "string",
            "description": "Width of the response container"
          }
        },
        "required": ["template"],
        "additionalProperties": false
      },
      "minItems": 1,
      "description": "Array of response container configurations"
    },
    "response_positions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "x": {
            "type": "number",
            "minimum": 0,
            "description": "X coordinate position for the formula input"
          },
          "y": {
            "type": "number",
            "minimum": 0,
            "description": "Y coordinate position for the formula input"
          }
        },
        "required": ["x", "y"],
        "additionalProperties": false
      },
      "minItems": 1,
      "description": "Array of position coordinates for formula input placement"
    },
    "is_math": {
      "type": "boolean",
      "description": "Whether this question involves mathematical content"
    },
    "show_hints_button": {
      "type": "boolean",
      "description": "Whether to show hints button for formula input"
    },
    "ui_style": {
      "allOf": [
        { "$ref": "ui_style.schema.json" }
      ]
    },
    "validation": {
      "$ref": "clozeformula-validation.schema.json"
    }
  },
  "additionalProperties": true
}