{
  "$id": "shorttext.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ShortText Question Schema",
  "description": "Schema for ShortText question type, supporting short text input responses.",
  "type": "object",
  "required": ["type", "stimulus", "validation"],
  "properties": {
    "type": { "const": "shorttext" },
    "stimulus": {
      "type": "string",
      "description": "The question prompt or stimulus."
    },
    "case_sensitive": {
      "type": "boolean",
      "description": "Whether responses should be case sensitive"
    },
    "max_length": {
      "type": "integer",
      "minimum": 1,
      "description": "Maximum number of characters allowed in response"
    },
    "min_length": {
      "type": "integer",
      "minimum": 0,
      "description": "Minimum number of characters required in response"
    },
    "placeholder": {
      "type": "string",
      "description": "Placeholder text shown in input field"
    },
    "feedback_attempts": {
      "type": ["integer", "string"],
      "description": "Number of attempts before showing feedback"
    },
    "ui_style": {
      "allOf": [
        { "$ref": "ui_style.schema.json" }
      ]
    },
    "validation": {
      "type": "object",
      "required": ["scoring_type", "valid_response"],
      "properties": {
        "scoring_type": {
          "type": "string",
          "enum": ["exactMatch", "partialMatch"],
          "description": "Scoring logic for the question"
        },
        "valid_response": {
          "type": "object",
          "required": ["score", "value"],
          "properties": {
            "score": {
              "type": "number",
              "minimum": 0,
              "description": "Points awarded for correct answer"
            },
            "value": {
              "type": "string",
              "description": "Correct answer as a string for shorttext questions"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}