{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opentine.com/schemas/opentine-merge-1.schema.json",
  "title": "opentine.merge (merge_version 1)",
  "description": "A signed merge attestation (SPEC 4.19): the merged run, its parents (ours first), the target ref and fencing token it landed under, and the digest of every gate piece that admitted it. `signature` is a tine-sig/3 block over `opentine.merge.v1:` + JCS({body, header}).",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "kind",
    "merge_version",
    "run",
    "parents",
    "target",
    "fencing",
    "gates",
    "conflicts",
    "actor",
    "merged_at",
    "signature"
  ],
  "properties": {
    "kind": {
      "const": "opentine.merge"
    },
    "merge_version": {
      "const": 1
    },
    "run": {
      "type": "string",
      "pattern": "^run:sha256:[0-9a-f]{64}$"
    },
    "parents": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^run:sha256:[0-9a-f]{64}$"
      },
      "minItems": 2,
      "maxItems": 64
    },
    "target": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^[A-Za-z0-9_.:/@+-]{1,256}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "fencing": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0
        },
        {
          "type": "null"
        }
      ]
    },
    "gates": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "gate",
          "digest"
        ],
        "properties": {
          "gate": {
            "enum": [
              "vsa",
              "eval",
              "approval"
            ]
          },
          "digest": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        }
      },
      "maxItems": 256
    },
    "conflicts": {
      "type": "integer",
      "minimum": 0
    },
    "actor": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_.:/@+-]{1,256}$"
    },
    "merged_at": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "signature": {
      "$ref": "tine-sig-3.schema.json"
    }
  }
}
