{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://trooids.com/schema/trace-entry.v1.json",
 "title": "TrooIDs trace entry v1",
 "description": "One decision of the permission engine (the nine-field exposure-ledger schema described on trooids.com, plus seq and t). Written BEFORE data is returned or a refusal is thrown.",
 "type": "object",
 "required": [
  "seq",
  "t",
  "used",
  "permitted",
  "objective",
  "actor",
  "action",
  "contacted",
  "why",
  "rule",
  "result"
 ],
 "additionalProperties": false,
 "properties": {
  "seq": {
   "type": "integer",
   "minimum": 1
  },
  "t": {
   "type": "string",
   "format": "date-time"
  },
  "used": {
   "type": "string",
   "description": "the field that was read, or \"none\" when refused",
   "enum": [
    "calendar.availability",
    "calendar.titles",
    "notes.private",
    "contacts.list",
    "none"
   ]
  },
  "permitted": {
   "type": "string",
   "description": "the rule id that permitted the read, or \"no\"",
   "pattern": "^(R-[0-9]+|no)$"
  },
  "objective": {
   "type": "string"
  },
  "actor": {
   "type": "string",
   "description": "the function id (the actor)"
  },
  "action": {
   "type": "string",
   "enum": [
    "read",
    "propose",
    "compose"
   ]
  },
  "contacted": {
   "type": "string",
   "const": "nobody \u2014 fixture; no external communication"
  },
  "why": {
   "type": "string"
  },
  "rule": {
   "type": "string",
   "description": "R-<n>, R-none, or R-<n> revoked",
   "pattern": "^(R-[0-9]+( revoked)?|R-none)$"
  },
  "result": {
   "type": "string",
   "pattern": "^(allowed|refused): (calendar\\.availability|calendar\\.titles|notes\\.private|contacts\\.list) \u2014 .+"
  }
 }
}