{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:health-report:0.1",
  "title": "Raport zdrowia wydania Junexis 0.1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "operationId", "releaseId", "manifestSha256", "rid", "startedAt", "completedAt", "overall", "checks"],
  "properties": {
    "schemaVersion": { "const": "junexis.health-report/0.1" },
    "operationId": { "$ref": "#/$defs/identifier" },
    "releaseId": { "$ref": "#/$defs/identifier" },
    "manifestSha256": { "$ref": "#/$defs/sha256" },
    "rid": { "enum": ["win-x64", "linux-x64", "osx-arm64"] },
    "startedAt": { "$ref": "#/$defs/timestamp" },
    "completedAt": { "$ref": "#/$defs/timestamp" },
    "overall": { "enum": ["healthy", "unhealthy", "timed-out"] },
    "checks": {
      "type": "array",
      "minItems": 1,
      "maxItems": 256,
      "items": { "$ref": "#/$defs/check" }
    }
  },
  "$defs": {
    "identifier": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{1,127}$" },
    "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}(?![\\s\\S])" },
    "timestamp": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" },
    "check": {
      "type": "object",
      "additionalProperties": false,
      "required": ["component", "required", "status", "durationMs", "code", "message"],
      "properties": {
        "component": { "$ref": "#/$defs/identifier" },
        "required": { "type": "boolean" },
        "status": { "enum": ["healthy", "unhealthy", "timed-out", "skipped"] },
        "durationMs": { "type": "integer", "minimum": 0, "maximum": 3600000 },
        "code": { "$ref": "#/$defs/identifier" },
        "message": { "type": "string", "minLength": 1, "maxLength": 512 }
      }
    }
  }
}
