{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:provider-publication:0.1",
  "title": "Profil publikacji providera Junexis 0.1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "provider", "artifact", "sdk", "platform", "conformance"],
  "properties": {
    "schemaVersion": { "const": "junexis.provider-publication/0.1" },
    "provider": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "version", "manifest", "releaseReceipt"],
      "properties": {
        "id": { "$ref": "#/$defs/artifactId" },
        "version": { "$ref": "#/$defs/semver" },
        "manifest": { "$ref": "#/$defs/providerManifestEvidence" },
        "releaseReceipt": { "$ref": "#/$defs/providerReleaseEvidence" }
      }
    },
    "artifact": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "mediaType", "sizeBytes", "sha256"],
      "properties": {
        "path": { "$ref": "#/$defs/path" },
        "mediaType": { "const": "application/zip" },
        "sizeBytes": { "type": "integer", "minimum": 1, "maximum": 1073741824 },
        "sha256": { "$ref": "#/$defs/sha256" }
      }
    },
    "sdk": {
      "type": "object",
      "additionalProperties": false,
      "required": ["version", "abiVersion", "release"],
      "properties": {
        "version": { "$ref": "#/$defs/semver" },
        "abiVersion": { "const": "junexis.storage.runtime/0.1" },
        "release": { "$ref": "#/$defs/sdkReleaseEvidence" }
      }
    },
    "platform": {
      "type": "object",
      "additionalProperties": false,
      "required": ["releaseVersion", "rid", "compatibilitySet", "release", "compatibility"],
      "properties": {
        "releaseVersion": { "$ref": "#/$defs/semver" },
        "rid": { "$ref": "#/$defs/rid" },
        "compatibilitySet": { "$ref": "#/$defs/compatibilitySet" },
        "release": { "$ref": "#/$defs/platformReleaseEvidence" },
        "compatibility": { "$ref": "#/$defs/platformCompatibilityEvidence" }
      }
    },
    "conformance": {
      "type": "object",
      "additionalProperties": false,
      "required": ["contract", "status", "providerId", "abiVersion", "path", "sha256"],
      "properties": {
        "contract": { "const": "junexis.sdk.provider-conformance/0.1" },
        "status": { "const": "pass" },
        "providerId": { "$ref": "#/$defs/artifactId" },
        "abiVersion": { "const": "junexis.storage.runtime/0.1" },
        "path": { "$ref": "#/$defs/path" },
        "sha256": { "$ref": "#/$defs/sha256" }
      }
    }
  },
  "$defs": {
    "providerManifestEvidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["contract", "path", "sha256"],
      "properties": {
        "contract": { "const": "junexis.provider/0.2" },
        "path": { "const": "junexis.provider.json" },
        "sha256": { "$ref": "#/$defs/sha256" }
      }
    },
    "providerReleaseEvidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["contract", "path", "sha256"],
      "properties": {
        "contract": { "const": "junexis.provider.release/0.1" },
        "path": { "const": "junexis.provider.release.json" },
        "sha256": { "$ref": "#/$defs/sha256" }
      }
    },
    "sdkReleaseEvidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["contract", "path", "sha256"],
      "properties": {
        "contract": { "const": "junexis.sdk.release/0.1" },
        "path": { "$ref": "#/$defs/path" },
        "sha256": { "$ref": "#/$defs/sha256" }
      }
    },
    "platformReleaseEvidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["contract", "path", "sha256"],
      "properties": {
        "contract": { "const": "junexis.platform-release/0.1" },
        "path": { "$ref": "#/$defs/path" },
        "sha256": { "$ref": "#/$defs/sha256" }
      }
    },
    "platformCompatibilityEvidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["contract", "path", "sha256"],
      "properties": {
        "contract": { "const": "junexis.platform-compatibility/0.1" },
        "path": { "$ref": "#/$defs/path" },
        "sha256": { "$ref": "#/$defs/sha256" }
      }
    },
    "artifactId": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*(?![\\s\\S])" },
    "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-]+)*))?(?![\\s\\S])" },
    "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}(?![\\s\\S])" },
    "rid": { "type": "string", "pattern": "^[a-z0-9]+-[a-z0-9]+(?![\\s\\S])" },
    "compatibilitySet": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{2,63}(?![\\s\\S])" },
    "path": {
      "type": "string",
      "maxLength": 1024,
      "pattern": "^(?!.*(?:^|/)\\.{1,2}(?:/|$))[A-Za-z0-9_-](?:[A-Za-z0-9._-]*[A-Za-z0-9_-])?(?:/[A-Za-z0-9_-](?:[A-Za-z0-9._-]*[A-Za-z0-9_-])?)*(?![\\s\\S])"
    }
  }
}
