{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://logicsrc.com/schemas/openontology/event.schema.json",
  "title": "LogicSRC OpenOntology Event",
  "description": "An append-only audit record. Every applied change emits at least one event, attributable to an actor, a policy decision, and a resulting revision.",
  "type": "object",
  "required": ["openontology", "kind", "id", "type", "at", "actor"],
  "additionalProperties": false,
  "properties": {
    "openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
    "kind": { "const": "Event" },
    "id": { "type": "string", "minLength": 1 },
    "type": {
      "type": "string",
      "enum": [
        "package.validated",
        "entity.proposed",
        "entity.added",
        "entity.merged",
        "entity.archived",
        "claim.proposed",
        "claim.asserted",
        "claim.disputed",
        "claim.retracted",
        "claim.superseded",
        "changeset.created",
        "changeset.reviewed",
        "changeset.approved",
        "changeset.rejected",
        "changeset.applied",
        "import.completed",
        "export.completed",
        "constraint.violated",
        "action.executed",
        "schema.migrated"
      ]
    },
    "ontology": { "type": "string" },
    "at": { "type": "string", "format": "date-time" },
    "actor": { "type": "string", "minLength": 1 },
    "actorType": { "type": "string", "enum": ["human", "service", "agent"] },
    "client": { "type": "string" },
    "requestId": { "type": "string" },
    "runId": { "type": "string" },
    "changeSet": { "type": "string" },
    "subject": { "type": "string", "description": "Primary object id the event concerns." },
    "revision": { "type": "string" },
    "policyDecision": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "rule": { "type": "string" },
        "decision": { "type": "string", "enum": ["allow", "deny", "require-approval"] },
        "reason": { "type": "string" }
      }
    },
    "data": { "type": "object", "description": "Event-specific payload. Redacted per policy." },
    "extensions": { "type": "object" }
  }
}
