{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "required": [
    "statVersion",
    "process"
  ],
  "properties": {
    "statVersion": {
      "type": "string"
    },
    "process": {
      "$ref": "#/definitions/process"
    },
    "findings": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/finding"
      },
      "_uniqueItems": true
    }
  },
  "definitions": {
    "process": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "maintainer": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "website": {
          "type": "string"
        },
        "repeatability": {
          "type": "string",
          "enum": [
            "Volatile",
            "Repeatable",
            "Associative"
          ]
        }
      },
      "required": [
        "name"
      ]
    },
    "finding": {
      "type": "object",
      "properties": {
        "failure": {
          "type": "boolean"
        },
        "rule": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "detail": {
          "$ref": "#/definitions/detail"
        },
        "categories": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/definitions/category"
          },
          "_uniqueItems": true
        },
        "location": {
          "$ref": "#/definitions/location"
        },
        "timeToFix": {
          "type": "integer"
        },
        "recommendation": {
          "type": "string"
        },
        "fixes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/definitions/fix"
          },
          "_uniqueItems": true
        }
      },
      "required": [
        "failure",
        "rule",
        "description"
      ]
    },
    "category": {
      "enum": [
        "Bug Risk",
        "Clarity",
        "Compatibility",
        "Complexity",
        "Duplication",
        "Performance",
        "Security",
        "Style"
      ]
    },
    "detail": {
      "type": "object",
      "properties": {
        "body": {
          "type": "string"
        },
        "trace": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/definitions/location"
          },
          "_uniqueItems": true
        }
      },
      "required": [
        "body"
      ]
    },
    "fix": {
      "type": "object",
      "properties": {
        "location": {
          "$ref": "#/definitions/location"
        },
        "newText": {
          "type": "string"
        }
      },
      "required": [
        "location"
      ]
    },
    "location": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "beginLine": {
          "type": "integer"
        },
        "beginColumn": {
          "type": "integer"
        },
        "endLine": {
          "type": "integer"
        },
        "endColumn": {
          "type": "integer"
        }
      },
      "required": [
        "path"
      ]
    }
  }
}