{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:orbiplex:schema:sensorium-interface-invoke-request:v1",
  "title": "Sensorium Interface Invoke Request v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "schema/v", "operation/id", "idempotency/key", "interface/id", "caller/ref", "grant/id", "source/generation-ref", "operational/context", "coordination/mode", "method/name", "input/schema-ref", "payload", "deadline/at", "classification", "causal/context"],
  "properties": {
    "schema": { "const": "sensorium-interface-invoke-request.v1" },
    "schema/v": { "const": 1 },
    "operation/id": { "type": "string", "pattern": "^sensorium-operation:[^\\s]+$", "maxLength": 512 },
    "idempotency/key": { "type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\s]+$" },
    "interface/id": { "type": "string", "pattern": "^sensorium-interface:[^\\s]+$", "maxLength": 512 },
    "caller/ref": { "$ref": "#/$defs/ref" },
    "grant/id": { "$ref": "#/$defs/ref" },
    "source/generation-ref": { "$ref": "#/$defs/ref" },
    "operational/context": { "$ref": "sensorium-operational-context.v1.schema.json" },
    "coordination/mode": { "enum": ["shared", "exclusive-lease"] },
    "lease/id": { "type": "string", "pattern": "^sensorium-control-lease:[^\\s]+$", "maxLength": 512 },
    "lease/epoch": { "type": "integer", "minimum": 1 },
    "caller/sequence": { "type": "integer", "minimum": 1 },
    "method/name": { "type": "string", "pattern": "^[a-z][a-z0-9.-]{0,127}$" },
    "input/schema-ref": { "$ref": "#/$defs/ref" },
    "payload": {},
    "deadline/at": { "type": "string", "format": "date-time" },
    "classification": { "$ref": "classification.v1.schema.json" },
    "causal/context": { "$ref": "causal-context.v1.schema.json" }
  },
  "allOf": [
    { "if": { "properties": { "coordination/mode": { "const": "exclusive-lease" } }, "required": ["coordination/mode"] }, "then": { "required": ["lease/id", "lease/epoch", "caller/sequence"] }, "else": { "not": { "anyOf": [{ "required": ["lease/id"] }, { "required": ["lease/epoch"] }, { "required": ["caller/sequence"] }] } } }
  ],
  "$defs": {
    "ref": { "type": "string", "minLength": 1, "maxLength": 512, "pattern": "^[^\\s]+$" }
  }
}
