{
  "$defs": {
    "EventPayload": {
      "description": "Event-specific payload.",
      "properties": {
        "detail": {
          "description": "Additional event-specific data."
        },
        "entryDid": {
          "description": "DID of the affected entry.",
          "type": "string"
        },
        "entryType": {
          "description": "Entry type (when applicable).",
          "type": [
            "string",
            "null"
          ]
        },
        "publisherDid": {
          "description": "Publisher DID.",
          "type": [
            "string",
            "null"
          ]
        },
        "version": {
          "description": "Version (when applicable).",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "entryDid"
      ],
      "type": "object"
    },
    "EventType": {
      "description": "The kind of event that occurred.\nPer MARS Specification Section 13.1.",
      "oneOf": [
        {
          "const": "entry.created",
          "description": "New entry registered.",
          "type": "string"
        },
        {
          "const": "entry.updated",
          "description": "Entry version updated.",
          "type": "string"
        },
        {
          "const": "entry.revoked",
          "description": "Entry revoked.",
          "type": "string"
        },
        {
          "const": "entry.transferred",
          "description": "Ownership transferred.",
          "type": "string"
        },
        {
          "const": "entry.attested",
          "description": "New attestation attached.",
          "type": "string"
        },
        {
          "const": "entry.reported",
          "description": "Malicious report filed.",
          "type": "string"
        },
        {
          "const": "bond.slashed",
          "description": "Bond slashed.",
          "type": "string"
        },
        {
          "const": "federation.sync",
          "description": "Federation sync completed.",
          "type": "string"
        }
      ]
    }
  },
  "$id": "urn:mars:schema:v1:mars-event",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "A notification event emitted by a MARS registry.\nPer MARS Specification Section 13.3.",
  "properties": {
    "eventId": {
      "description": "Unique event identifier.",
      "type": "string"
    },
    "eventType": {
      "$ref": "#/$defs/EventType",
      "description": "The type of event."
    },
    "payload": {
      "$ref": "#/$defs/EventPayload",
      "description": "Event-specific payload."
    },
    "registryDid": {
      "description": "DID of the registry that emitted the event.",
      "type": "string"
    },
    "timestamp": {
      "description": "When the event occurred.",
      "format": "date-time",
      "type": "string"
    }
  },
  "required": [
    "eventType",
    "eventId",
    "timestamp",
    "registryDid",
    "payload"
  ],
  "title": "MarsEvent",
  "type": "object"
}
