{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:packages-lock:0.1",
  "title": "Blokada pakietów projektu Junexis 0.1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "packages"],
  "properties": {
    "schemaVersion": { "const": "junexis.packages.lock/0.1" },
    "packages": {
      "type": "array",
      "maxItems": 10000,
      "uniqueItems": true,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "version", "namespace", "source", "manifestSha256", "artifactSha256", "dependencies"],
        "properties": {
          "id": { "$ref": "#/$defs/packageId" },
          "version": { "$ref": "#/$defs/semver" },
          "namespace": { "$ref": "#/$defs/moduleIdentity" },
          "source": { "type": "string", "pattern": "^registry:[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*@[0-9A-Za-z.+-]+$" },
          "manifestSha256": { "$ref": "#/$defs/sha256" },
          "artifactSha256": { "$ref": "#/$defs/sha256" },
          "dependencies": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["id", "version"],
              "properties": {
                "id": { "$ref": "#/$defs/packageId" },
                "version": { "$ref": "#/$defs/semver" }
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "packageId": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$" },
    "moduleIdentity": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*(?:::[A-Za-z_][A-Za-z0-9_]*)*$" },
    "semver": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-((?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$"
    },
    "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
  }
}