{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/muse-space/json-schema/muse-space-events-poll-output-schema.json",
  "title": "events_poll_output",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/muse-space-openapi.json#/components/schemas/events_poll_output",
  "type": "object",
  "properties": {
    "events": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "instance": {
                "type": "string"
              },
              "at": {
                "type": "string",
                "format": "date-time"
              },
              "type": {
                "type": "string",
                "const": "mail.received"
              },
              "message": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "date": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "from": {
                    "type": "string"
                  },
                  "to": {
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "subject": {
                    "type": "string"
                  },
                  "unread": {
                    "type": "boolean"
                  },
                  "flagged": {
                    "type": "boolean"
                  },
                  "has_attachments": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id",
                  "date",
                  "from",
                  "to",
                  "subject",
                  "unread",
                  "flagged",
                  "has_attachments"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "instance",
              "at",
              "type",
              "message"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "instance": {
                "type": "string"
              },
              "at": {
                "type": "string",
                "format": "date-time"
              },
              "type": {
                "type": "string",
                "const": "webhook.received"
              },
              "delivery": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string"
                  },
                  "content_type": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "preview": {
                    "type": "string"
                  },
                  "verified": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "bytes",
                  "preview",
                  "verified"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "instance",
              "at",
              "type",
              "delivery"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "more": {
      "type": "boolean"
    }
  },
  "required": [
    "events",
    "more"
  ],
  "additionalProperties": false
}