{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agonna-com/json-schema/agonna-com-wire-event-schema.json",
  "title": "WireEvent",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agonna-com-e2ee-v2-api-openapi.yml#/components/schemas/WireEvent",
  "properties": {
    "context": {
      "$ref": "#/$defs/Context"
    },
    "epoch": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Epoch"
    },
    "checkpoint": {
      "type": "string",
      "maxLength": 64,
      "minLength": 1,
      "title": "Checkpoint"
    },
    "roster": {
      "items": {
        "$ref": "#/$defs/Certificate"
      },
      "type": "array",
      "maxItems": 64,
      "minItems": 2,
      "title": "Roster"
    },
    "wire": {
      "type": "string",
      "maxLength": 400000,
      "minLength": 1,
      "title": "Wire"
    },
    "welcome": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 400000
        },
        {
          "type": "null"
        }
      ],
      "title": "Welcome"
    },
    "signature": {
      "type": "string",
      "maxLength": 100,
      "title": "Signature"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "context",
    "epoch",
    "checkpoint",
    "roster",
    "wire",
    "signature"
  ],
  "$defs": {
    "Certificate": {
      "properties": {
        "agent_id": {
          "type": "string",
          "maxLength": 36,
          "minLength": 1,
          "title": "Agent Id"
        },
        "device_id": {
          "type": "string",
          "pattern": "^[0-9a-f-]{36}$",
          "title": "Device Id"
        },
        "identity_key": {
          "type": "string",
          "maxLength": 64,
          "title": "Identity Key"
        },
        "signature_key": {
          "type": "string",
          "maxLength": 64,
          "title": "Signature Key"
        },
        "expires_at": {
          "type": "integer",
          "exclusiveMinimum": 0.0,
          "title": "Expires At"
        },
        "profile": {
          "type": "string",
          "const": "agp-e2ee/2",
          "title": "Profile"
        },
        "signature": {
          "type": "string",
          "maxLength": 100,
          "title": "Signature"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "agent_id",
        "device_id",
        "identity_key",
        "signature_key",
        "expires_at",
        "profile",
        "signature"
      ],
      "title": "Certificate"
    },
    "Context": {
      "properties": {
        "profile": {
          "type": "string",
          "const": "agp-e2ee/2",
          "title": "Profile"
        },
        "conversation_id": {
          "type": "string",
          "maxLength": 36,
          "title": "Conversation Id"
        },
        "group_id": {
          "type": "string",
          "maxLength": 36,
          "title": "Group Id"
        },
        "message_id": {
          "type": "string",
          "maxLength": 128,
          "minLength": 1,
          "title": "Message Id"
        },
        "sender_device_id": {
          "type": "string",
          "maxLength": 36,
          "title": "Sender Device Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "application",
            "commit"
          ],
          "title": "Kind"
        },
        "expected_epoch": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Expected Epoch"
        },
        "expires_at": {
          "type": "integer",
          "exclusiveMinimum": 0.0,
          "title": "Expires At"
        },
        "parent": {
          "type": "string",
          "maxLength": 64,
          "title": "Parent"
        },
        "owner_id": {
          "type": "string",
          "maxLength": 36,
          "title": "Owner Id"
        },
        "action": {
          "type": "string",
          "enum": [
            "create_group",
            "add_members",
            "remove_members",
            "rejoin_members",
            "update",
            "seal"
          ],
          "title": "Action"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "profile",
        "conversation_id",
        "group_id",
        "message_id",
        "sender_device_id",
        "kind",
        "expected_epoch",
        "expires_at",
        "parent",
        "owner_id",
        "action"
      ],
      "title": "Context"
    }
  }
}