{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:hayat:schema:artifact:vNEXT-D",
  "oneOf": [
    {
      "title": "HAYAT source \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "source"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "observed_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "origin_ref": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1,
          "uniqueItems": true
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "observed_at",
        "origin_ref",
        "provenance_limitations"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT project \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "project_manifest"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "version_id": {
          "type": "string",
          "format": "uuid"
        },
        "purpose": {
          "type": "string",
          "minLength": 1
        },
        "owner_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "participant_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "participant_labels": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "label": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "id",
              "label"
            ],
            "additionalProperties": false
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "shared_location": {
          "type": "string",
          "minLength": 1
        },
        "allowed_readers": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "allowed_writers": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "private_location_policy": {
          "type": "string",
          "minLength": 1
        },
        "status_pointer": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        },
        "backup_policy": {
          "type": "object",
          "properties": {
            "coverage": {
              "type": "string",
              "minLength": 1
            },
            "verified": {
              "type": "boolean"
            },
            "next_step": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "coverage",
            "verified",
            "next_step"
          ],
          "additionalProperties": false
        },
        "adapters": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "authority_policy": {
          "type": "object",
          "properties": {
            "mode": {
              "const": "human-single-writer"
            },
            "human_id": {
              "type": "string",
              "format": "uuid"
            },
            "sharing_requires_explicit_approval": {
              "const": true
            }
          },
          "required": [
            "mode",
            "human_id",
            "sharing_requires_explicit_approval"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "version_id",
        "purpose",
        "owner_ids",
        "participant_ids",
        "participant_labels",
        "shared_location",
        "allowed_readers",
        "allowed_writers",
        "private_location_policy",
        "status_pointer",
        "backup_policy",
        "adapters",
        "authority_policy"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT bootstrap \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "bootstrap"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "manifest_ref": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        },
        "status_ref": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        },
        "authoritative_source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "decision_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "unresolved_questions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "next_action": {
          "type": "string",
          "minLength": 1
        },
        "known_missing_context": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "capability_ref": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "manifest_ref",
        "status_ref",
        "authoritative_source_refs",
        "decision_refs",
        "unresolved_questions",
        "next_action",
        "known_missing_context",
        "capability_ref"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT status \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "status"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "version_id": {
          "type": "string",
          "format": "uuid"
        },
        "previous_version_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "task_state": {
          "enum": [
            "draft",
            "active",
            "blocked",
            "completed",
            "cancelled"
          ]
        },
        "completed_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "blocked_reasons": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "next_action": {
          "type": "string",
          "minLength": 1
        },
        "decision_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "updated_by": {
          "type": "string",
          "format": "uuid"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "version_id",
        "previous_version_id",
        "task_state",
        "completed_refs",
        "blocked_reasons",
        "next_action",
        "decision_refs",
        "updated_by",
        "updated_at"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT current-pointer \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "current_pointer"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "status_version_id": {
          "type": "string",
          "format": "uuid"
        },
        "status_ref": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        },
        "previous_pointer_version": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "pointer_version": {
          "type": "string",
          "format": "uuid"
        },
        "writer_id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "status_version_id",
        "status_ref",
        "previous_pointer_version",
        "pointer_version",
        "writer_id"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT conflict \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "conflict"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "conflict_id": {
          "type": "string",
          "format": "uuid"
        },
        "base_version": {
          "type": "string",
          "format": "uuid"
        },
        "competing_artifact_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 2,
          "uniqueItems": true
        },
        "detected_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "resolver_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "resolution_state": {
          "enum": [
            "unassigned",
            "pending",
            "resolved"
          ]
        },
        "resolution_ref": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "artifact_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "sha256": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "location": {
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                }
              },
              "required": [
                "artifact_id",
                "sha256"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "conflict_id",
        "base_version",
        "competing_artifact_refs",
        "detected_at",
        "resolver_id",
        "resolution_state",
        "resolution_ref"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "resolution_state": {
                "const": "resolved"
              }
            }
          },
          "then": {
            "properties": {
              "resolver_id": {
                "type": "string",
                "format": "uuid"
              },
              "resolution_ref": {
                "type": "object",
                "properties": {
                  "artifact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "location": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                  }
                },
                "required": [
                  "artifact_id",
                  "sha256"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT action \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "action"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "action_id": {
          "type": "string",
          "format": "uuid"
        },
        "actor_id": {
          "type": "string",
          "format": "uuid"
        },
        "operation": {
          "type": "string",
          "minLength": 1
        },
        "target": {
          "type": "string",
          "minLength": 1
        },
        "recipient_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "payload_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "capability_ref": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        },
        "expected_resource_version": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "payload_ref": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "action_id",
        "actor_id",
        "operation",
        "target",
        "recipient_ids",
        "payload_sha256",
        "capability_ref",
        "expected_resource_version",
        "payload_ref",
        "expires_at"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "operation": {
                "pattern": "^message\\."
              }
            }
          },
          "then": {
            "properties": {
              "recipient_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "minItems": 1,
                "uniqueItems": true
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT approval \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "approval"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "action_id": {
          "type": "string",
          "format": "uuid"
        },
        "actor_id": {
          "type": "string",
          "format": "uuid"
        },
        "operation": {
          "type": "string",
          "minLength": 1
        },
        "target": {
          "type": "string",
          "minLength": 1
        },
        "recipient_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "payload_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "capability_ref": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        },
        "expected_resource_version": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "approval_id": {
          "type": "string",
          "format": "uuid"
        },
        "approver_id": {
          "type": "string",
          "format": "uuid"
        },
        "issued_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "evidence_ref": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        },
        "authority_scope": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "action_id",
        "actor_id",
        "operation",
        "target",
        "recipient_ids",
        "payload_sha256",
        "capability_ref",
        "expected_resource_version",
        "approval_id",
        "approver_id",
        "issued_at",
        "expires_at",
        "evidence_ref",
        "authority_scope"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "operation": {
                "pattern": "^message\\."
              }
            }
          },
          "then": {
            "properties": {
              "recipient_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "minItems": 1,
                "uniqueItems": true
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT receipt \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "receipt"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "receipt_id": {
          "type": "string",
          "format": "uuid"
        },
        "action_id": {
          "type": "string",
          "format": "uuid"
        },
        "stored_artifact_ref": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "artifact_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "sha256": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "location": {
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                }
              },
              "required": [
                "artifact_id",
                "sha256"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "payload_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "adapter_id": {
          "type": "string",
          "format": "uuid"
        },
        "observed_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "outcome": {
          "enum": [
            "stored",
            "rejected",
            "uncertain"
          ]
        },
        "remote_result_ref": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "failure_reason": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "receipt_id",
        "action_id",
        "stored_artifact_ref",
        "payload_sha256",
        "adapter_id",
        "observed_at",
        "outcome",
        "remote_result_ref",
        "failure_reason"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "outcome": {
                "const": "stored"
              }
            }
          },
          "then": {
            "properties": {
              "stored_artifact_ref": {
                "type": "object",
                "properties": {
                  "artifact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "location": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                  }
                },
                "required": [
                  "artifact_id",
                  "sha256"
                ],
                "additionalProperties": false
              },
              "remote_result_ref": {
                "type": "string",
                "minLength": 1
              },
              "failure_reason": {
                "type": "null"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "outcome": {
                "const": "rejected"
              }
            }
          },
          "then": {
            "properties": {
              "stored_artifact_ref": {
                "type": "null"
              },
              "remote_result_ref": {
                "type": "null"
              },
              "failure_reason": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "outcome": {
                "const": "uncertain"
              }
            }
          },
          "then": {
            "properties": {
              "failure_reason": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT message \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "message"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "message_id": {
          "type": "string",
          "format": "uuid"
        },
        "action_id": {
          "type": "string",
          "format": "uuid"
        },
        "sender_id": {
          "type": "string",
          "format": "uuid"
        },
        "recipient_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "in_reply_to": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "artifact_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "sha256": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "location": {
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                }
              },
              "required": [
                "artifact_id",
                "sha256"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "approval_ref": {
          "type": "object",
          "properties": {
            "artifact_id": {
              "type": "string",
              "format": "uuid"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "location": {
              "type": "string",
              "minLength": 1,
              "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
            }
          },
          "required": [
            "artifact_id",
            "sha256"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "message_id",
        "action_id",
        "sender_id",
        "recipient_ids",
        "in_reply_to",
        "approval_ref"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT action-event \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "action_event"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "event_id": {
          "type": "string",
          "format": "uuid"
        },
        "action_id": {
          "type": "string",
          "format": "uuid"
        },
        "previous_event_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "from_state": {
          "anyOf": [
            {
              "enum": [
                "draft",
                "approved",
                "executing",
                "uncertain"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "to_state": {
          "enum": [
            "draft",
            "approved",
            "executing",
            "stored",
            "rejected",
            "uncertain",
            "cancelled",
            "revoked",
            "expired"
          ]
        },
        "actor_id": {
          "type": "string",
          "format": "uuid"
        },
        "occurred_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "approval_ref": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "artifact_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "sha256": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "location": {
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                }
              },
              "required": [
                "artifact_id",
                "sha256"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "receipt_ref": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "artifact_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "sha256": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "location": {
                  "type": "string",
                  "minLength": 1,
                  "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                }
              },
              "required": [
                "artifact_id",
                "sha256"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "event_id",
        "action_id",
        "previous_event_id",
        "from_state",
        "to_state",
        "actor_id",
        "occurred_at",
        "approval_ref",
        "receipt_ref",
        "reason"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "draft"
              }
            }
          },
          "then": {
            "properties": {
              "from_state": {
                "type": "null"
              },
              "previous_event_id": {
                "type": "null"
              },
              "approval_ref": {
                "type": "null"
              },
              "receipt_ref": {
                "type": "null"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "approved"
              }
            }
          },
          "then": {
            "properties": {
              "approval_ref": {
                "type": "object",
                "properties": {
                  "artifact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "location": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                  }
                },
                "required": [
                  "artifact_id",
                  "sha256"
                ],
                "additionalProperties": false
              },
              "from_state": {
                "type": "string",
                "minLength": 1
              },
              "previous_event_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "executing"
              }
            }
          },
          "then": {
            "properties": {
              "approval_ref": {
                "type": "object",
                "properties": {
                  "artifact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "location": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                  }
                },
                "required": [
                  "artifact_id",
                  "sha256"
                ],
                "additionalProperties": false
              },
              "from_state": {
                "type": "string",
                "minLength": 1
              },
              "previous_event_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "stored"
              }
            }
          },
          "then": {
            "properties": {
              "approval_ref": {
                "type": "object",
                "properties": {
                  "artifact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "location": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                  }
                },
                "required": [
                  "artifact_id",
                  "sha256"
                ],
                "additionalProperties": false
              },
              "from_state": {
                "type": "string",
                "minLength": 1
              },
              "previous_event_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "rejected"
              }
            }
          },
          "then": {
            "properties": {
              "approval_ref": {
                "type": "object",
                "properties": {
                  "artifact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "location": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                  }
                },
                "required": [
                  "artifact_id",
                  "sha256"
                ],
                "additionalProperties": false
              },
              "from_state": {
                "type": "string",
                "minLength": 1
              },
              "previous_event_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "uncertain"
              }
            }
          },
          "then": {
            "properties": {
              "approval_ref": {
                "type": "object",
                "properties": {
                  "artifact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "location": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                  }
                },
                "required": [
                  "artifact_id",
                  "sha256"
                ],
                "additionalProperties": false
              },
              "from_state": {
                "type": "string",
                "minLength": 1
              },
              "previous_event_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "stored"
              }
            }
          },
          "then": {
            "properties": {
              "receipt_ref": {
                "type": "object",
                "properties": {
                  "artifact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "location": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                  }
                },
                "required": [
                  "artifact_id",
                  "sha256"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "rejected"
              }
            }
          },
          "then": {
            "properties": {
              "receipt_ref": {
                "type": "object",
                "properties": {
                  "artifact_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "location": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
                  }
                },
                "required": [
                  "artifact_id",
                  "sha256"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "approved"
              }
            }
          },
          "then": {
            "properties": {
              "receipt_ref": {
                "type": "null"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "executing"
              }
            }
          },
          "then": {
            "properties": {
              "receipt_ref": {
                "type": "null"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "cancelled"
              }
            }
          },
          "then": {
            "properties": {
              "receipt_ref": {
                "type": "null"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "revoked"
              }
            }
          },
          "then": {
            "properties": {
              "receipt_ref": {
                "type": "null"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "to_state": {
                "const": "expired"
              }
            }
          },
          "then": {
            "properties": {
              "receipt_ref": {
                "type": "null"
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT capability \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "capability"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "adapter_id": {
          "type": "string",
          "format": "uuid"
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "checked_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "status": {
          "enum": [
            "verified",
            "unverified",
            "unavailable"
          ]
        },
        "operations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "resource_version_policies": {
          "type": "object",
          "additionalProperties": {
            "enum": [
              "required",
              "inapplicable"
            ]
          }
        },
        "authentication_method": {
          "type": "string",
          "minLength": 1
        },
        "resource_scope": {
          "type": "string",
          "minLength": 1
        },
        "content_types": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "limits": {
          "type": "object",
          "properties": {
            "remote_writes": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "remote_writes"
          ],
          "additionalProperties": false
        },
        "idempotency": {
          "type": "string",
          "minLength": 1
        },
        "receipt_semantics": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "adapter_id",
        "version",
        "checked_at",
        "status",
        "operations",
        "resource_version_policies",
        "authentication_method",
        "resource_scope",
        "content_types",
        "limits",
        "idempotency",
        "receipt_semantics"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT decision \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "decision"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "decision_id": {
          "type": "string",
          "format": "uuid"
        },
        "decider_id": {
          "type": "string",
          "format": "uuid"
        },
        "decision": {
          "type": "string",
          "minLength": 1
        },
        "decision_status": {
          "enum": [
            "proposed",
            "accepted",
            "rejected",
            "simulated"
          ]
        },
        "evidence_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "decision_id",
        "decider_id",
        "decision",
        "decision_status",
        "evidence_refs"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    },
    {
      "title": "HAYAT recovery-report \u2014 vNEXT-D draft",
      "type": "object",
      "properties": {
        "protocol_version": {
          "const": "vNEXT-D"
        },
        "project_id": {
          "type": "string",
          "format": "uuid"
        },
        "artifact_id": {
          "type": "string",
          "format": "uuid"
        },
        "record_type": {
          "const": "recovery_report"
        },
        "author_id": {
          "type": "string",
          "format": "uuid"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "visibility": {
          "enum": [
            "local-example",
            "public",
            "shared",
            "private"
          ]
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "payload_location": {
          "type": "string",
          "minLength": 1
        },
        "provenance_limitation": {
          "type": "string"
        },
        "simulation": {
          "type": "boolean"
        },
        "recovery_id": {
          "type": "string",
          "format": "uuid"
        },
        "coverage": {
          "type": "string",
          "minLength": 1
        },
        "verified_refs": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "artifact_id": {
                "type": "string",
                "format": "uuid"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "location": {
                "type": "string",
                "minLength": 1,
                "pattern": "^(?!/)(?!.*(?:\\.\\.|:)).+$"
              }
            },
            "required": [
              "artifact_id",
              "sha256"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "missing_context": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 0,
          "uniqueItems": true
        },
        "outcome": {
          "enum": [
            "complete",
            "partial",
            "failed"
          ]
        },
        "observed_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        }
      },
      "required": [
        "protocol_version",
        "project_id",
        "artifact_id",
        "record_type",
        "author_id",
        "created_at",
        "visibility",
        "source_refs",
        "content_sha256",
        "payload_location",
        "provenance_limitation",
        "simulation",
        "recovery_id",
        "coverage",
        "verified_refs",
        "missing_context",
        "outcome",
        "observed_at"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "source_refs": {
                "maxItems": 0
              }
            }
          },
          "then": {
            "properties": {
              "provenance_limitation": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      ]
    }
  ]
}
