{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:platform-release-catalog:0.1",
  "title": "Podpisany katalog wydań platformy Junexis 0.1",
  "description": "Katalog składników jednego kanału wydania, podpisany rolą platform-release z magazynu zaufania. Źródło Centrum pobierania (M18.10) i diagnostyki zaufania Instalatora (M18.11).",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "channel", "issuedAt", "expiresAt", "entries", "algorithm", "keyId", "signature"],
  "properties": {
    "schemaVersion": { "const": "junexis.platform-release-catalog/0.1" },
    "channel": { "enum": ["dev", "preview", "stable"] },
    "issuedAt": { "$ref": "#/$defs/timestamp" },
    "expiresAt": { "$ref": "#/$defs/timestamp" },
    "entries": {
      "type": "array",
      "minItems": 1,
      "maxItems": 4096,
      "items": { "$ref": "#/$defs/entry" }
    },
    "algorithm": { "const": "ecdsa-p256-sha256-der" },
    "keyId": { "$ref": "#/$defs/keyId" },
    "signature": { "type": "string", "minLength": 1, "contentEncoding": "base64" }
  },
  "$defs": {
    "identifier": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{1,127}$" },
    "semver": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:[-+][0-9A-Za-z.-]+)?$" },
    "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}(?![\\s\\S])" },
    "keyId": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
    "timestamp": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" },
    "entry": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "component", "system", "architecture", "version",
        "sizeBytes", "sha256", "provenanceSha256", "sbomSha256",
        "minimumSupportedVersion", "revoked"
      ],
      "properties": {
        "component": { "$ref": "#/$defs/identifier" },
        "system": { "enum": ["windows", "linux", "macos"] },
        "architecture": { "enum": ["x64", "arm64"] },
        "version": { "$ref": "#/$defs/semver" },
        "sizeBytes": { "type": "integer", "minimum": 1 },
        "sha256": { "$ref": "#/$defs/sha256" },
        "provenanceSha256": { "$ref": "#/$defs/sha256" },
        "sbomSha256": { "$ref": "#/$defs/sha256" },
        "minimumSupportedVersion": { "$ref": "#/$defs/semver" },
        "revoked": { "type": "boolean" }
      }
    }
  }
}
