{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://law.arxo.io/schema/derived-facts.schema.json",
  "title": "Arxo Fact Protocol derived facts 0.1",
  "description": "The settled conclusions of one evaluation document, published as events for a bus or a database. A fact is the literal of a PROPOSITION result computed TRUE_ONLY (as asked) or FALSE_ONLY (polarity flipped), with derived origin; BOTH, NEITHER, and other result kinds yield no fact. evaluation pins the document by its hashes. Each event id has the form urn:derived: followed by the hash of the canonical result pair, and stays stable across re-publication. Facts order by the UTF-8 bytes of the result id. The contentHash self-pin excludes its own field; no time or host is stored inside.", "$comment": "SPEC §73; SPEC §208; SPEC §256.1; DECISION-0422",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "evaluation", "facts", "contentHash"],
  "properties": {
    "schemaVersion": {"const": "law.derived-facts/0.1"},
    "evaluation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["resultHash", "semantics", "semanticHash", "caseHash", "programHash", "legalTime"],
      "properties": {
        "resultHash": {"$ref": "#/$defs/Digest"},
        "semantics": {"type": "string", "minLength": 1},
        "semanticHash": {"$ref": "#/$defs/Digest"},
        "caseHash": {"$ref": "#/$defs/Digest"},
        "programHash": {"$ref": "#/$defs/Digest"},
        "legalTime": {"type": ["string", "null"]}
      }
    },
    "facts": {"type": "array", "items": {"$ref": "#/$defs/DerivedFact"}},
    "contentHash": {"$ref": "#/$defs/Digest"}
  },
  "$defs": {
    "Digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"},
    "DerivedFact": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "result", "proof", "literal", "origin"],
      "properties": {
        "id": {"type": "string", "pattern": "^urn:derived:[0-9a-f]{64}$"},
        "result": {"type": "string", "minLength": 1},
        "proof": {"type": "string", "minLength": 1},
        "literal": {"$ref": "legal-ir.schema.json#/$defs/Literal"},
        "origin": {"const": "derived"}
      }
    }
  }
}
