{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://cdn.jsdelivr.net/npm/@pie-element/charting@13.0.6/dist/schemas/session.schema.json",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Identifier of the session"
    },
    "element": {
      "type": "string",
      "description": "The element the session belongs to"
    },
    "answer": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/ChartingCategory"
      },
      "description": "The student's categories; the initial chart is scored when absent"
    }
  },
  "definitions": {
    "ChartingCategory": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string",
          "description": "Indicates category label"
        },
        "value": {
          "type": "number",
          "description": "Indicates category value"
        },
        "interactive": {
          "type": "boolean",
          "description": "Indicates if category value is interactive"
        },
        "editable": {
          "type": "boolean",
          "description": "Indicates if category label is editable"
        },
        "deletable": {
          "type": "boolean",
          "description": "Indicates if category is deletable"
        },
        "index": {
          "type": "number",
          "description": "Position of the category in the author's chart; scoring reports it with each correct category"
        },
        "correctness": {
          "$ref": "#/definitions/ChartingCategoryCorrectness",
          "description": "Indicates correctness for a category"
        }
      },
      "required": [
        "label",
        "value"
      ],
      "description": "A category on the chart: a bar, a point on a line or a column of a plot"
    },
    "ChartingCategoryCorrectness": {
      "type": "object",
      "properties": {
        "value": {
          "type": "string",
          "enum": [
            "correct",
            "incorrect"
          ]
        },
        "label": {
          "type": "string",
          "enum": [
            "correct",
            "incorrect"
          ]
        }
      },
      "required": [
        "value",
        "label"
      ],
      "description": "Whether a category's value or label matches the correct answer; the controller sets it when scoring"
    }
  }
}
