{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:release-file-inventory:0.1",
  "title": "Inwentarz plików wydania Junexis 0.1",
  "description": "Lista plików składników, umieszczana w archiwum manifestu objętym podpisanym katalogiem wydania.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "releaseVersion", "rid", "manifestSha256", "components"],
  "properties": {
    "schemaVersion": { "const": "junexis.release-file-inventory/0.1" },
    "releaseVersion": { "$ref": "#/$defs/semver" },
    "rid": { "enum": ["win-x64", "linux-x64", "osx-arm64"] },
    "manifestSha256": { "$ref": "#/$defs/sha256" },
    "components": {
      "type": "array",
      "maxItems": 256,
      "items": { "$ref": "#/$defs/component" }
    }
  },
  "$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])" },
    "path": {
      "type": "string",
      "maxLength": 1024,
      "pattern": "^(?!.*(?:^|/)\\.\\.?(?:/|$))[A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*$"
    },
    "file": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "sizeBytes", "sha256"],
      "properties": {
        "path": { "$ref": "#/$defs/path" },
        "sizeBytes": { "type": "integer", "minimum": 0, "maximum": 268435456 },
        "sha256": { "$ref": "#/$defs/sha256" }
      }
    },
    "component": {
      "type": "object",
      "additionalProperties": false,
      "required": ["component", "version", "artifactSha256", "files"],
      "properties": {
        "component": { "$ref": "#/$defs/identifier" },
        "version": { "$ref": "#/$defs/semver" },
        "artifactSha256": { "$ref": "#/$defs/sha256" },
        "files": {
          "type": "array",
          "minItems": 1,
          "maxItems": 4096,
          "items": { "$ref": "#/$defs/file" }
        }
      }
    }
  }
}
