{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://aiwg.io/schemas/testing/test-conformance-assessment.v1.schema.json",
  "title": "TestConformanceAssessment v1",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "apiVersion": {
      "const": "testing.aiwg.io/v1"
    },
    "kind": {
      "const": "TestConformanceAssessment"
    },
    "metadata": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "createdAt": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z$"
        },
        "toolVersion": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "name",
        "createdAt",
        "toolVersion"
      ]
    },
    "spec": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "root": {
          "type": "string",
          "minLength": 1
        },
        "protocolHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$",
          "minLength": 64,
          "maxLength": 64
        },
        "snapshotHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$",
          "minLength": 64,
          "maxLength": 64
        },
        "status": {
          "enum": [
            "conformant",
            "nonconformant",
            "unknown"
          ]
        },
        "gates": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "status": {
                "enum": [
                  "passed",
                  "failed",
                  "unknown"
                ]
              },
              "message": {
                "type": "string",
                "minLength": 1
              },
              "references": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            },
            "required": [
              "id",
              "status",
              "message",
              "references"
            ]
          },
          "minItems": 1
        },
        "summary": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "total": {
              "type": "integer",
              "minimum": 0
            },
            "passed": {
              "type": "integer",
              "minimum": 0
            },
            "failed": {
              "type": "integer",
              "minimum": 0
            },
            "unknown": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "total",
            "passed",
            "failed",
            "unknown"
          ]
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1
        },
        "comparison": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "baselineSnapshotHash": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$",
              "minLength": 64,
              "maxLength": 64
            },
            "protocolChanged": {
              "type": "boolean"
            },
            "new": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "uniqueItems": true
            },
            "resolved": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "uniqueItems": true
            },
            "unchanged": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "uniqueItems": true
            },
            "regressed": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "uniqueItems": true
            },
            "changed": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "uniqueItems": true
            },
            "removed": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "uniqueItems": true
            }
          },
          "required": [
            "baselineSnapshotHash",
            "protocolChanged",
            "new",
            "resolved",
            "unchanged",
            "regressed",
            "changed",
            "removed"
          ]
        }
      },
      "required": [
        "root",
        "protocolHash",
        "snapshotHash",
        "status",
        "gates",
        "summary",
        "limitations"
      ]
    }
  },
  "required": [
    "apiVersion",
    "kind",
    "metadata",
    "spec"
  ]
}
