{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:provider:0.2",
  "title": "Junexis provider author manifest 0.2",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "id", "packageId", "version", "abiVersion", "factoryType", "resourceKind", "capabilities", "sdk", "artifact", "distribution"],
  "properties": {
    "schemaVersion": { "const": "junexis.provider/0.2" },
    "id": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$" },
    "packageId": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)+$" },
    "version": { "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-]+)*)?$" },
    "abiVersion": { "const": "junexis.storage.runtime/0.1" },
    "factoryType": { "type": "string", "minLength": 3 },
    "resourceKind": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
    "capabilities": {
      "type": "array", "uniqueItems": true,
      "items": { "enum": ["read", "write", "transactions", "health", "native-sql", "migrations", "query-plan", "mutation-plan"] }
    },
    "sdk": {
      "type": "object", "additionalProperties": false,
      "required": ["packageId", "version"],
      "properties": {
        "packageId": { "const": "Junexis.Storage.Runtime.Abstractions" },
        "version": { "const": "0.1.0" }
      }
    },
    "artifact": {
      "type": "object", "additionalProperties": false,
      "required": ["project", "assembly", "targetFramework"],
      "properties": {
        "project": { "type": "string", "pattern": "^[^/\\\\].*\\.csproj$" },
        "assembly": { "type": "string", "pattern": "^[A-Za-z0-9_.-]+\\.dll$" },
        "targetFramework": { "const": "net10.0" }
      }
    },
    "distribution": {
      "type": "object", "additionalProperties": false,
      "required": ["storageContract", "databaseCompatibility", "runtime", "driver", "files", "configuration"],
      "properties": {
        "storageContract": { "const": "junexis.storage/0.1" },
        "databaseCompatibility": { "type": "string", "minLength": 1 },
        "runtime": {
          "type": "object", "additionalProperties": false,
          "required": ["kind", "entrypoint"],
          "properties": { "kind": { "const": "dotnet" }, "entrypoint": { "type": "string", "pattern": "^runtime/.+\\.dll$" } }
        },
        "driver": {
          "type": "object", "additionalProperties": false,
          "required": ["id", "version"],
          "properties": { "id": { "type": "string", "minLength": 1 }, "version": { "type": "string", "minLength": 1 } }
        },
        "files": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
        "configuration": {
          "type": "object", "additionalProperties": false,
          "required": ["required", "optional", "secret"],
          "properties": {
            "required": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
            "optional": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
            "secret": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
          }
        }
      }
    }
  }
}
