{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hanria.ai/skill/schema/action-outcome.schema.json",
  "title": "HANRIA action outcome",
  "type": "object",
  "required": [
    "schema_version",
    "outcome",
    "reason"
  ],
  "additionalProperties": false,
  "properties": {
    "schema_version": {
      "const": "0.1-draft"
    },
    "outcome": {
      "enum": [
        "permit",
        "deny",
        "escalate",
        "error"
      ]
    },
    "reason": {
      "type": "string",
      "minLength": 1,
      "description": "Why. Always present."
    },
    "mandate_ref": {
      "type": "string"
    },
    "clause": {
      "type": "string",
      "description": "Identifier of the clause that decided. Present whenever a clause matched."
    },
    "clause_note": {
      "type": "string",
      "description": "The clause's note, carried verbatim so a reviewer sees why the clause exists."
    },
    "action_digest": {
      "type": "string",
      "minLength": 64,
      "description": "Digest of the action request this outcome was produced for. Present whenever a request was evaluated; absent on an error raised before any request was considered, such as an unreadable or non-conforming mandate. A recorder must refuse to store an outcome that lacks it or whose digest names a different action."
    }
  },
  "$comment": "An outcome is a local decision record. There is no signature, no verifier and no third-party acceptance: do not present one as evidence that an action was authorized."
}
