{
  "$schema": "https://json-schema.org/draft/2019-09/schema#",
  "$id": "http://purl.imsglobal.org/spec/ob-assessment/v2p0/schema/",
  "type": "object",
  "properties": {
    "credentialSubject": {
      "type": "object",
      "properties": {
        "achievement": {
          "type": "object",
          "properties": {
            "resultDescription": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/AssessmentResultDescription"
              }
            }
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true,
  "$defs": {
    "AssessmentResultDescription": {
      "type": "object",
      "properties": {
        "description": {
          "description": " A description of the assessment.",
          "type": "string"
        },
        "assessmentType": {
          "description": "The method used to conduct the assessment being referenced. Allowed values are Exam, Performance or Artifact.",
          "type": "string",
          "enum": ["Exam", "Performance", "Artifact"]
        },
        "assessmentOutput": {
          "description": "This field provides additional details about the assessment type. Values for assessmentOutput are expected to be words or phrases that describe the key features of the evidence that are produced in earning the badge.",
          "type": "string"
        },
        "hasGroupParticipation": {
          "description": "Completing the assessment activity being referenced requires two or more participants.",
          "type": "boolean"
        },
        "hasGroupEvaluation": {
          "description": "Participants in the assessment activity being referenced are scored as a group. ",
          "type": "boolean"
        },
        "evaluationMethod": {
          "description": "Information about how the assessment is scored. What do the scores represent in a range of scores? If a rubric was used, what are the score ranges for each criteria?",
          "type": "string"
        },
        "assessmentExample": {
          "description": "An example based on the assessment type.",
          "type": "string",
          "format": "uri"
        },
        "scoringMethodExampleDescription": {
          "description": "The text of an example of the method or tool used to score the assessment.",
          "type": "string"
        },
        "assessmentEvaluation": {
          "description": "Link to studies or other information about research or calculations of reliability and validity for the assessment or the scoring methods.",
          "type": "string",
          "format": "uri"
        },
        "sections": {
          "oneOf": [
            {
              "$ref": "#/definitions/Section"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Section"
              }
            }
          ]
        }
      },
      "required": [
        "description",
        "assessmentType",
        "assessmentOutput",
        "hasGroupParticipation",
        "hasGroupEvaluation",
        "evaluationMethod"
      ]
    },
    "Section": {
      "description": "A set of questions that make up part of an assessment",
      "type": "object",
      "properties": {
        "type": {
          "type": "array",
          "minItems": 1,
          "contains": {
            "enum": ["extensions:assessmentSections"]
          },
          "items": {
            "description": "The value of the type property MUST be an unordered set. One of the items MUST be the URI 'extensions:assessmentSections'",
            "$comment": "Origin: IRI (DerivedType); A `NormalizedString` that represents an Internationalized Resource Identifier (IRI), which extends the ASCII characters subset of the Uniform Resource Identifier (URI).",
            "type": "string"
          }
        },
        "questions": {
          "oneOf": [
            {
              "$ref": "#/definitions/Question"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Question"
              }
            }
          ]
        },
        "title": {
          "description": "The name of the section.",
          "type": "string"
        },
        "description": {
          "description": "A short description of the section.",
          "type": "string"
        },
        "url": {
          "description": "An external URL that represents this section",
          "type": "string",
          "format": "uri"
        },
        "required": {
          "description": "Indicates whether this section is required to be completed. If false, no questions in this section should be considered required.",
          "type": "boolean",
          "default": true
        }
      }
    },
    "Question": {
      "description": "A question that may be asked as part of an assessment",
      "type": "object",
      "properties": {
        "type": {
          "type": "array",
          "minItems": 1,
          "contains": {
            "enum": ["extensions:assessmentQuestions"]
          },
          "items": {
            "description": "The value of the type property MUST be an unordered set. One of the items MUST be the URI 'extensions:assessmentQuestions'",
            "$comment": "Origin: IRI (DerivedType); A `NormalizedString` that represents an Internationalized Resource Identifier (IRI), which extends the ASCII characters subset of the Uniform Resource Identifier (URI).",
            "type": "string"
          }
        },
        "questionType": {
          "description": "Identifies the type of question that this is, a hint for how it should be displayed. More question types may be added later.",
          "type": "string",
          "enum": ["ExternalQuestion", "FileQuestion", "TextQuestion"]
        },
        "text": {
          "description": "The actual text of the question that should be presented to the assessment subject",
          "type": "string"
        },
        "url": {
          "description": "An external URL that represents this question.",
          "type": "string",
          "format": "uri"
        },
        "required": {
          "description": "Indicates whether this question is required to be completed.",
          "type": "boolean",
          "default": true
        },
        "wordLimit": {
          "description": "For TextQuestions, specifies a maximum length in words that may be enforced as a suggestion or requirement, depending on the application.",
          "type": "number"
        },
        "characterLimit": {
          "description": "For TextQuestions, specifies a maximium length in characters that may be enforced as a suggestion or requirement, depending on the application.",
          "type": "number"
        }
      },
      "required": ["questionType", "text"]
    }
  }
}
