{
  "$id": "https://schema.rtemis.org/artifact/record/v1/schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "rtemis record artifact",
  "description": "One immutable version of an rtemis harness artifact holding the run record a job returned. `name` and `version` say which revision of which artifact; `id` is a BLAKE3 digest over the RFC 8785 canonical form of `content`, so it says whether two versions are the same document.",
  "type": "object",
  "properties": {
    "id": {
      "description": "Digest of `content`, as `blake3:<hex>` over its RFC 8785 canonical form. The algorithm travels with the digest rather than being implied, so a later one can be introduced without rewriting what is already recorded -- the property `DataFingerprint` gets from carrying `algorithm` and `encoding` beside each hash.",
      "type": "string"
    },
    "type": {
      "description": "Which of the five this is.",
      "type": "string",
      "const": "record"
    },
    "name": {
      "description": "The artifact's name within its study, stable across versions.",
      "type": "string"
    },
    "version": {
      "description": "Which revision this is, from 1, contiguous within a name.",
      "type": "integer",
      "minimum": 1
    },
    "created": {
      "description": "When this version was written, RFC 3339 in UTC.",
      "type": "string"
    },
    "origin": {
      "description": "Who authored this version.",
      "type": "string",
      "enum": ["user_edit", "agent_revision", "applied_patch", "run_result"]
    },
    "content": {
      "description": "What a run returned.",
      "type": "object",
      "properties": {
        "plan": {
          "description": "The plan version that was run.",
          "type": "object",
          "properties": {
            "name": {
              "description": "The referenced artifact's name.",
              "type": "string"
            },
            "version": {
              "description": "Which version of it.",
              "type": "integer",
              "minimum": 1
            },
            "id": {
              "description": "What that version's content hashed to, as `blake3:<hex>`.",
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": ["name", "version", "id"]
        },
        "record": {
          "description": "The run record, as `job.result` returned it.",
          "oneOf": [
            {
              "$ref": "https://schema.rtemis.org/supervised/r/v1/record.json"
            },
            {
              "$ref": "https://schema.rtemis.org/decompose/r/v1/record.json"
            },
            {
              "$ref": "https://schema.rtemis.org/cluster/r/v1/record.json"
            }
          ]
        }
      },
      "additionalProperties": false,
      "required": ["plan", "record"]
    }
  },
  "additionalProperties": false,
  "required": ["id", "type", "name", "version", "created", "origin", "content"]
}
