{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "rubricType": {
      "description": "The type of rubric. Different rubric types have different shapes.",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "simple",
            "analytical",
            "holistic",
            "exact-values"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "criteria": {
      "description": "The criteria for scoring the question. For 'simple' rubric type, criteria have no levels, and their points stack (total = sum of points for all criteria that apply). For 'analytical' rubric type, there should be at least one criteria, with levels. For each criteria, a matching level is picked. For 'holistic' rubric type, there should be multiple criteria, without levels (score = single selected criteria). For 'exact-values' rubric type, each criteria represents a specific value that must be matched exactly.",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "description": "The title of the scoring criterion or level. Only applies to analytical levels and holistic criteria.",
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "description": "The description of the scoring criterion or level. For analytical levels, this describes the specific requirements to earn the points for that level. For holistic criteria, this describes the overall requirement to earn the points for that criterion.",
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "points": {
                "description": "The default amount of points to assign if this criterion or level is selected.",
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "minPoints": {
                "description": "The minimum amount of points that can be assigned if this criterion or level is selected.",
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "maxPoints": {
                "description": "The maximum amount of points that can be assigned if this criterion or level is selected.",
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "levels": {
                "description": "The levels of a analytical rubric criterion. Each level represents a different point value and description for the same criterion.",
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "title": {
                          "description": "The title of the scoring criterion or level. Only applies to analytical levels and holistic criteria.",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "description": {
                          "description": "The description of the scoring criterion or level. For analytical levels, this describes the specific requirements to earn the points for that level. For holistic criteria, this describes the overall requirement to earn the points for that criterion.",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "points": {
                          "description": "The default amount of points to assign if this criterion or level is selected.",
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "minPoints": {
                          "description": "The minimum amount of points that can be assigned if this criterion or level is selected.",
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "maxPoints": {
                          "description": "The maximum amount of points that can be assigned if this criterion or level is selected.",
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id"
                      ],
                      "additionalProperties": false
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id"
            ],
            "additionalProperties": false
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "exactValuesCaseInsensitive": {
      "description": "Whether exact values matching should be case insensitive. Only applicable for 'exact-values' rubric type.",
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ]
    },
    "guidance": {
      "description": "Optional additional grading guidance text.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "modelAnswer": {
      "description": "Optional example model answer text to show to graders.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "templateId": {
      "description": "The ID of the scoring template applied, if any.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "additionalProperties": false
}