{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://computerkeyboardtest.com/schemas/computer-keyboard-test-report-1.0.0.schema.json",
  "title": "Computer Keyboard Test report 1.0.0",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "app",
    "appVersion",
    "engineVersion",
    "reportVersion",
    "generatedAt",
    "captureStatus",
    "diagram",
    "summary",
    "outsideDiagramCodes",
    "keys",
    "limitations"
  ],
  "properties": {
    "app": {
      "const": "Computer Keyboard Test"
    },
    "appVersion": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
    },
    "engineVersion": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
    },
    "reportVersion": {
      "const": "1.0.0"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
    },
    "captureStatus": {
      "const": "paused"
    },
    "diagram": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "profileId",
        "label",
        "keyCount",
        "keyNames",
        "observedCodes",
        "notYetObservedCodes"
      ],
      "properties": {
        "profileId": {
          "enum": [
            "full-104",
            "tkl-87",
            "compact-61"
          ]
        },
        "label": {
          "enum": [
            "Full size",
            "Without numpad",
            "Compact"
          ]
        },
        "keyCount": {
          "enum": [
            104,
            87,
            61
          ]
        },
        "keyNames": {
          "enum": [
            "Windows",
            "Mac"
          ]
        },
        "observedCodes": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Za-z][A-Za-z0-9]{0,47}$",
            "not": {
              "const": "Unidentified"
            }
          },
          "uniqueItems": true,
          "maxItems": 256
        },
        "notYetObservedCodes": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Za-z][A-Za-z0-9]{0,47}$",
            "not": {
              "const": "Unidentified"
            }
          },
          "uniqueItems": true,
          "maxItems": 256
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "profileId": {
                "const": "full-104"
              }
            }
          },
          "then": {
            "properties": {
              "label": {
                "const": "Full size"
              },
              "keyCount": {
                "const": 104
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "profileId": {
                "const": "tkl-87"
              }
            }
          },
          "then": {
            "properties": {
              "label": {
                "const": "Without numpad"
              },
              "keyCount": {
                "const": 87
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "profileId": {
                "const": "compact-61"
              }
            }
          },
          "then": {
            "properties": {
              "label": {
                "const": "Compact"
              },
              "keyCount": {
                "const": 61
              }
            }
          }
        }
      ]
    },
    "summary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "observedCodeCount",
        "diagramObservedCount",
        "diagramKeyCount",
        "heldNowCount",
        "maxHeldTogether",
        "totalPresses",
        "totalRepeats",
        "totalReleases",
        "totalInterruptedHolds",
        "unmappedEvents",
        "suppressedRepeats"
      ],
      "properties": {
        "observedCodeCount": {
          "type": "integer",
          "minimum": 1,
          "maximum": 256
        },
        "diagramObservedCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        "diagramKeyCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        "heldNowCount": {
          "const": 0
        },
        "maxHeldTogether": {
          "type": "integer",
          "minimum": 1,
          "maximum": 256
        },
        "totalPresses": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        "totalRepeats": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        "totalReleases": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        "totalInterruptedHolds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        "unmappedEvents": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        "suppressedRepeats": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        }
      }
    },
    "outsideDiagramCodes": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z][A-Za-z0-9]{0,47}$",
        "not": {
          "const": "Unidentified"
        }
      },
      "uniqueItems": true,
      "maxItems": 256
    },
    "keys": {
      "type": "array",
      "minItems": 1,
      "maxItems": 256,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "presses",
          "repeats",
          "releases",
          "interruptedHolds"
        ],
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[A-Za-z][A-Za-z0-9]{0,47}$",
            "not": {
              "const": "Unidentified"
            }
          },
          "presses": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000
          },
          "repeats": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "releases": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          },
          "interruptedHolds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000
          }
        }
      }
    },
    "limitations": {
      "type": "array",
      "minItems": 2,
      "maxItems": 8,
      "items": {
        "type": "string",
        "maxLength": 500
      }
    }
  },
  "description": "Initial standalone report contract for Computer Keyboard Test. Distinct from the native Mycelgrid Keyboard Tester report namespace. App and engine versions may change while the report format remains compatible."
}
