{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:intergraph:relationship:v1:record",
  "title": "Relationship Protocol record (authorized read projection)",
  "type": "object",
  "required": [
    "id",
    "workspace_id",
    "collection_id",
    "namespace",
    "version",
    "type",
    "kind",
    "revision",
    "data",
    "participants",
    "archived"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "workspace_id": {
      "type": "string",
      "format": "uuid"
    },
    "collection_id": {
      "type": "string",
      "format": "uuid"
    },
    "namespace": {
      "type": "string"
    },
    "version": {
      "type": "integer",
      "minimum": 1
    },
    "type": {
      "type": "string"
    },
    "kind": {
      "enum": [
        "entity",
        "relationship"
      ]
    },
    "revision": {
      "type": "integer",
      "minimum": 1
    },
    "data": {
      "type": "object"
    },
    "participants": {
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "additionalProperties": false
            },
            {
              "type": "object",
              "required": [
                "restricted"
              ],
              "properties": {
                "restricted": {
                  "const": true
                }
              },
              "additionalProperties": false
            }
          ]
        }
      }
    },
    "state": {
      "type": [
        "string",
        "null"
      ]
    },
    "archived": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false
}
