{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:provider-release:0.1",
  "title": "Rachunek wydania dostawcy Junexis 0.1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "platformVersion", "provider", "sdk", "source", "files"],
  "properties": {
    "schemaVersion": { "const": "junexis.provider.release/0.1" },
    "platformVersion": { "$ref": "#/$defs/semver" },
    "provider": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "version", "manifest", "manifestSha256"],
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
        "version": { "$ref": "#/$defs/semver" },
        "manifest": { "const": "junexis.provider.json" },
        "manifestSha256": { "$ref": "#/$defs/sha256" }
      }
    },
    "sdk": {
      "type": "object",
      "additionalProperties": false,
      "required": ["packageId", "packageVersion", "abiVersion"],
      "properties": {
        "packageId": { "const": "Junexis.Storage.Runtime.Abstractions" },
        "packageVersion": { "$ref": "#/$defs/semver" },
        "abiVersion": { "const": "junexis.storage.runtime/0.1" }
      }
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": ["repository", "revision", "state"],
      "properties": {
        "repository": { "const": "junexis-storage-providers" },
        "revision": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
        "state": { "enum": ["clean", "dirty"] }
      }
    },
    "files": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["path", "sizeBytes", "sha256"],
        "properties": {
          "path": { "type": "string", "minLength": 1 },
          "sizeBytes": { "type": "integer", "minimum": 1 },
          "sha256": { "$ref": "#/$defs/sha256" }
        }
      }
    }
  },
  "$defs": {
    "semver": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?$"
    },
    "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
  }
}
