{
  "$id": "freeresponse-upload.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Free Response Question (Upload Mode)",
  "description": "ItemEngine free response question configured for file upload 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": "upload",
      "description": "Should always be set to 'upload' for this question type"
    },
    "scoring": {
      "type": "object",
      "additionalProperties": true,
      "required": [ "points", "scoringType" ],
      "properties": {
        "points": { "type": "integer" },
        "scoringType": {
          "type": "string",
          "enum": [ "manual-scored" ]
        },
        "scoringGuidance": { "type": "string" },
        "scoringResources": {
          "type": "array",
          "items": { "type": "object" }
        },
        "sampleResponseDetails": { "type": "string" },
        "uploadSampleResponse": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true,
            "required": [ "fileName", "url" ],
            "properties": {
              "fileName": { "type": "string" },
              "url": { "type": "string", "format": "uri" },
              "description": { "type": "string" }
            }
          }
        }
      }
    },
    "settings": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "studentViewSettings": {
          "type": "object",
          "additionalProperties": true,
          "properties": {
            "maxNumOfFiles": { "type": "integer" },
            "allowAddDescription": { "type": "boolean" },
            "allowEditFileName": { "type": "boolean" },
            "showFileSizeLimit": { "type": "boolean" },
            "uploadControls": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [ "capturePhoto", "googleDrive", "dragAndDropFiles" ]
              }
            },
            "supportedFileType": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "CSV", "Excel", "GIF", "JPG", "PDF", "PNG", "Powerpoint",
                  "Publisher", "RTF", "TXT", "Word", "XPS", "ZIP", "Open Office"
                ]
              }
            }
          }
        },
        "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" }
          }
        }
      }
    }
  }
}
