{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vpntestor.com/data/vpn-test-result.schema.json",
  "title": "VPNTestor VPN test result",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "protocol", "run", "subject", "environment", "scenarioId", "status", "measurements", "evidence", "limitations", "reviewer"],
  "properties": {
    "schemaVersion": { "const": "1.0.0" },
    "protocol": {
      "type": "object",
      "required": ["id", "version"],
      "properties": {
        "id": { "enum": ["kill-switch", "dns", "webrtc", "ipv6"] },
        "version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" }
      }
    },
    "run": {
      "type": "object",
      "required": ["id", "startedAt", "completedAt", "repetitions", "operator"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "startedAt": { "type": "string" },
        "completedAt": { "type": "string" },
        "repetitions": { "type": "integer", "minimum": 0 },
        "operator": { "type": "string" }
      }
    },
    "subject": {
      "type": "object",
      "required": ["provider", "appVersion", "buildIdentifier", "operatingSystem", "operatingSystemVersion", "device", "vpnProtocol", "serverClaim"],
      "properties": {
        "provider": { "type": "string" },
        "appVersion": { "type": "string" },
        "buildIdentifier": { "type": "string" },
        "operatingSystem": { "type": "string" },
        "operatingSystemVersion": { "type": "string" },
        "device": { "type": "string" },
        "vpnProtocol": { "type": "string" },
        "serverClaim": { "type": "string" }
      }
    },
    "environment": {
      "type": "object",
      "required": ["networkType", "ipv4Available", "ipv6Available", "resolverMode", "notes"],
      "properties": {
        "networkType": { "type": "string" },
        "ipv4Available": { "type": "boolean" },
        "ipv6Available": { "type": "boolean" },
        "resolverMode": { "type": "string" },
        "notes": { "type": "string" }
      }
    },
    "scenarioId": { "type": "string" },
    "status": { "enum": ["pass", "fail", "inconclusive", "not-applicable", "not-tested"] },
    "measurements": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "value"],
        "properties": {
          "name": { "type": "string" },
          "value": { "type": ["string", "number", "boolean"] },
          "unit": { "type": "string" }
        }
      }
    },
    "evidence": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["kind", "path", "sha256", "public", "redactions"],
        "properties": {
          "kind": { "enum": ["pcapng", "text-log", "screenshot", "video", "json", "other"] },
          "path": { "type": "string" },
          "sha256": { "type": "string", "pattern": "^$|^[a-fA-F0-9]{64}$" },
          "public": { "type": "boolean" },
          "redactions": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "limitations": { "type": "array", "items": { "type": "string" } },
    "reviewer": {
      "type": "object",
      "required": ["name", "reviewedAt", "decision"],
      "properties": {
        "name": { "type": "string" },
        "reviewedAt": { "type": "string" },
        "decision": { "enum": ["pass", "fail", "inconclusive", "not-applicable", "not-tested"] }
      }
    }
  }
}
