{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://www.edikka.com/docbd/data/back-office-control-v1/journal.schema.json",
  "title": "Back-office suggestion decision event / Événement de décision",
  "description": "Metadata-only journal of a synthetic control bench. Review and execution are distinct. The journal is not tamper-proof.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "event_id",
    "occurred_at",
    "actor",
    "action",
    "outcome",
    "policy_version",
    "suggestion_id",
    "record_id",
    "record_version",
    "proposal_revision",
    "proposal_digest",
    "review_state",
    "execution_state"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0.0"
    },
    "event_id": {
      "type": "string",
      "minLength": 1
    },
    "occurred_at": {
      "type": "string",
      "format": "date-time"
    },
    "actor": {
      "type": "string"
    },
    "action": {
      "enum": [
        "propose",
        "edit",
        "accept",
        "reject",
        "apply",
        "undo",
        "manual"
      ]
    },
    "outcome": {
      "type": "string",
      "minLength": 1
    },
    "policy_version": {
      "const": "1.0.0"
    },
    "suggestion_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "record_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "record_version": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1
    },
    "proposal_revision": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1
    },
    "proposal_digest": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[a-f0-9]{64}$"
    },
    "review_state": {
      "enum": [
        null,
        "proposed",
        "edited",
        "accepted",
        "rejected",
        "expired"
      ]
    },
    "execution_state": {
      "enum": [
        null,
        "pending",
        "applied",
        "blocked",
        "conflict"
      ]
    }
  }
}
