{
  "$id": "freeresponse-record.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Free Response Question (Record Mode)",
  "description": "ItemEngine free response question configured for record (audio/video) responses",
  "type": "object",
  "additionalProperties": true,
  "required": [ "reference", "type", "content", "responseMode", "scoring", "settings" ],
  "properties": {
    "reference": {
      "type": "string",
      "description": "Unique reference identifier for the question"
    },
    "type": {
      "type": "string",
      "const": "free response",
      "description": "Should always be set to 'free response'"
    },
    "content": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "instruction": { "type": "string" },
        "acknowledgements": { "type": "string" },
        "sampleAnswer": { "type": "string" }
      }
    },
    "responseMode": {
      "type": "string",
      "const": "record",
      "description": "Should always be set to 'record' for this question type"
    },
    "scoring": {
      "type": "object",
      "additionalProperties": true,
      "required": [ "points", "scoringType" ],
      "properties": {
        "points": { "type": "integer" },
        "scoringType": {
          "type": "string"
        },
        "scoringGuidance": { "type": "string" },
        "scoringResources": {
          "type": "array",
          "items": { "type": "object" }
        },
        "allowDownload": {
          "type": "boolean",
          "description": "Whether the student's recorded response can be downloaded"
        },
        "sampleResponseDetails": { "type": "string" },
        "recordSampleResponse": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true,
            "required": [ "fileName", "url" ],
            "properties": {
              "fileName": { "type": "string" },
              "url": { "type": "string", "format": "uri" }
            }
          }
        }
      }
    },
    "settings": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "studentViewSettings": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "maxAllowedFiles": { "type": "integer" },
            "maxRecordingLength": {
              "type": "integer",
              "description": "Maximum recording length in seconds"
            },
            "playbackControls": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "toolSettings": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true,
            "required": [ "resource", "enabled" ],
            "properties": {
              "resource": { "type": "string" },
              "enabled": { "type": "boolean" }
            }
          }
        },
        "additionalSettings": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "hint": { "type": "string" }
          }
        }
      }
    }
  }
}
