Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

116 KB
Raw Blame
{
  "openapi": "3.1.0",
  "info": {
    "title": "notification_service",
    "description": "",
    "termsOfService": "https://macro.com/terms",
    "license": {
      "name": ""
    },
    "version": "0.1.0"
  },
  "paths": {
    "/health": {
      "get": {
        "tags": ["health"],
        "summary": "Health check",
        "operationId": "health_handler",
        "responses": {
          "200": {
            "description": "health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          }
        }
      }
    },
    "/unsubscribe": {
      "get": {
        "tags": ["unsubscribe::get_unsubscribes"],
        "summary": "Gets the users unsubscribe items.",
        "operationId": "get_unsubscribes",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserUnsubscribe"
                  }
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/unsubscribe/email": {
      "post": {
        "tags": ["unsubscribe::unsubscribe_email"],
        "summary": "Unsubscribes a user from receiving emails",
        "operationId": "unsubscribe_email",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/unsubscribe/item/{item_type}/{item_id}": {
      "post": {
        "tags": ["unsubscribe::unsubscribe_item"],
        "summary": "Unsubscribes a user from a given item for notifications.",
        "operationId": "unsubscribe_item",
        "parameters": [
          {
            "name": "item_type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/EntityType"
            }
          },
          {
            "name": "item_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "snoozed_until",
            "in": "query",
            "description": "A future resume time. Omit to mute indefinitely.",
            "required": false,
            "schema": {
              "type": ["string", "null"],
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["unsubscribe::remove_unsubscribe_item"],
        "summary": "Removes a unsubscribe item for a user.",
        "operationId": "remove_unsubscribe_item",
        "parameters": [
          {
            "name": "item_type",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/EntityType"
            }
          },
          {
            "name": "item_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/unsubscribe/items": {
      "post": {
        "tags": ["unsubscribe::items"],
        "summary": "Atomically mute or snooze items for the authenticated user.",
        "operationId": "unsubscribe_items",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkSetItemsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["unsubscribe::items"],
        "summary": "Atomically resume delivery for the authenticated user's items.",
        "operationId": "remove_unsubscribe_items",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkRemoveItemsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/unsubscribe/mute": {
      "post": {
        "tags": ["unsubscribe::unsubscribe_all"],
        "summary": "Unsubscribes user from all notifications.",
        "operationId": "unsubscribe_all",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["unsubscribe::remove_unsubscribe_all"],
        "summary": "Unmutes all notifications.\nExisting notifications that were muted manually will remain muted.",
        "operationId": "remove_unsubscribe_all",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmptyResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications": {
      "get": {
        "tags": ["user_notification"],
        "summary": "Wrapper handler that calls the inner generic list handler with `serde_json::Value`,\nthen converts each row to [`UserNotificationRow<NotifEvent>`].",
        "description": "Rows that fail to deserialize are dropped with a warning log.",
        "operationId": "list_typed_notifications",
        "parameters": [
          {
            "name": "states",
            "in": "query",
            "description": "Comma-separated exact states: unseen,seen,done. Omitted defaults to unseen,seen; empty includes all states.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Size limit per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Cursor value. Base64 encoded timestamp and item id.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAllUserNotificationsResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/bulk": {
      "delete": {
        "tags": ["notification_crate::inbound::http"],
        "summary": "Soft-delete multiple user notifications.",
        "operationId": "bulk_delete_user_notifications_v2",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationBulkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/bulk/done": {
      "patch": {
        "tags": ["notification_crate::inbound::http"],
        "summary": "Mark notifications as done.",
        "operationId": "bulk_mark_notifications_done",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationBulkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/bulk/seen": {
      "patch": {
        "tags": ["notification_crate::inbound::http"],
        "summary": "Mark notifications as seen.",
        "operationId": "bulk_mark_notifications_seen",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationBulkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/bulk/undone": {
      "patch": {
        "tags": ["notification_crate::inbound::http"],
        "summary": "Mark notifications as not done.",
        "operationId": "bulk_mark_notifications_undone",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationBulkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/item/bulk": {
      "post": {
        "tags": ["user_notification"],
        "summary": "Wrapper handler that calls the inner generic bulk-get handler with `serde_json::Value`,\nthen converts each row to [`UserNotificationRow<NotifEvent>`].",
        "description": "Rows that fail to deserialize are dropped with a warning log.",
        "operationId": "bulk_get_typed_notifications_by_event_item_ids",
        "parameters": [
          {
            "name": "states",
            "in": "query",
            "description": "Comma-separated exact states: unseen,seen,done. Omitted defaults to unseen,seen; empty includes all states.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Size limit per page. Default 20, max 500.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Cursor value. Base64 encoded timestamp and item id.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkGetByEventItemIdsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAllUserNotificationsResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/item/{event_item_id}": {
      "get": {
        "tags": ["user_notification"],
        "summary": "Typed wrapper for getting notifications by a single event item ID.",
        "operationId": "get_typed_notifications_by_event_item_id",
        "parameters": [
          {
            "name": "states",
            "in": "query",
            "description": "Comma-separated exact states: unseen,seen,done. Omitted defaults to unseen,seen; empty includes all states.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "event_item_id",
            "in": "path",
            "description": "The event item ID",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Size limit per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Cursor value. Base64 encoded timestamp and item id.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAllUserNotificationsResponse"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/preferences": {
      "get": {
        "tags": ["notification_crate::inbound::http::preferences"],
        "summary": "Get the notification types that the user has disabled.",
        "operationId": "get_notification_type_preferences",
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetNotificationTypePreferencesResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/preferences/{notification_event_type}/disable": {
      "put": {
        "tags": ["notification_crate::inbound::http::preferences"],
        "summary": "Disable a notification type for the authenticated user.",
        "operationId": "disable_notification_type",
        "parameters": [
          {
            "name": "notification_event_type",
            "in": "path",
            "description": "The notification event type to disable",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/preferences/{notification_event_type}/enable": {
      "put": {
        "tags": ["notification_crate::inbound::http::preferences"],
        "summary": "Re-enable a notification type for the authenticated user.",
        "operationId": "enable_notification_type",
        "parameters": [
          {
            "name": "notification_event_type",
            "in": "path",
            "description": "The notification event type to enable",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/user_notifications/{notification_id}": {
      "get": {
        "tags": ["user_notification"],
        "summary": "Typed wrapper for getting a single notification by ID.",
        "operationId": "get_typed_notification_by_id",
        "parameters": [
          {
            "name": "notification_id",
            "in": "path",
            "description": "ID of the notification",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiUserNotification"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["notification_crate::inbound::http"],
        "summary": "Soft-delete a single user notification.",
        "operationId": "delete_user_notification_v2",
        "parameters": [
          {
            "name": "notification_id",
            "in": "path",
            "description": "ID of the notification",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AgentSessionMentionedMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AgentSessionNotificationRef"
          },
          {
            "type": "object",
            "required": ["actionId"],
            "properties": {
              "actionId": {
                "type": "string",
                "format": "uuid",
                "description": "The action carrying the prompt."
              },
              "mentionedBy": {
                "type": ["string", "null"],
                "description": "Who wrote the prompt, absent when a bot acted on nobody's behalf."
              }
            }
          }
        ],
        "description": "Someone named the recipient in a prompt to an agent session."
      },
      "AgentSessionNotificationRef": {
        "type": "object",
        "description": "Flattened into each agent-session kind so the wire keeps these keys at the\ntop level of the metadata, the way [`CommonChannelMetadata`] does.",
        "required": ["sessionId", "sessionName", "botId", "botName"],
        "properties": {
          "announcementMessageId": {
            "type": ["string", "null"],
            "format": "uuid",
            "description": "The magic-chip message for the turn in question, when one was posted."
          },
          "botId": {
            "type": "string",
            "description": "The bot the session runs for. A string on the wire: system bots have\nfixed ids like `00000000-0000-0000-0000-00000000a2a2`, which are not\nRFC 4122 uuids and fail a `format: uuid` check on the client."
          },
          "botName": {
            "type": "string",
            "description": "The bot's display name; agent notifications have no user sender, so\nthis is who they read as being from."
          },
          "channelId": {
            "type": ["string", "null"],
            "format": "uuid",
            "description": "The channel the session was opened from, when it was opened from a\nchannel thread."
          },
          "parent": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AgentSessionOriginParent",
                "description": "The channel or document the session was opened from, when it was."
              }
            ]
          },
          "sessionId": {
            "type": "string",
            "format": "uuid",
            "description": "The session; what a click opens."
          },
          "sessionName": {
            "type": "string",
            "description": "The session's name at the time of the event."
          },
          "threadId": {
            "type": ["string", "null"],
            "format": "uuid",
            "description": "The thread the session was opened from, when it was."
          }
        }
      },
      "AgentSessionOriginParent": {
        "type": "object",
        "description": "The session an agent-session notification is about, and where its magic\nchip lives when it was opened from a thread.\n\nThe conversation an agent session was opened from: a channel, document,\nor initiative. Spelled like the message API's parent for client routing.",
        "required": ["type", "id"],
        "properties": {
          "id": {
            "type": "string",
            "description": "The parent entity id."
          },
          "type": {
            "type": "string",
            "description": "`channel`, `document`, or `initiative`."
          }
        }
      },
      "AgentSessionSettledMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AgentSessionNotificationRef"
          },
          {
            "type": "object",
            "required": ["turn", "stopReason"],
            "properties": {
              "actor": {
                "type": ["string", "null"],
                "description": "Who prompted the turn, absent when a bot acted on nobody's behalf."
              },
              "excerpt": {
                "type": ["string", "null"],
                "description": "The agent's last prose in the turn, whole; `None` when it wrote none."
              },
              "stopReason": {
                "type": "string",
                "description": "The ACP stop reason, or `error`."
              },
              "turn": {
                "type": "integer",
                "format": "int32",
                "description": "The turn that ended.",
                "minimum": 0
              }
            }
          }
        ],
        "description": "An agent finished a turn with nothing queued behind it."
      },
      "AgentSessionWaitingForInputMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AgentSessionNotificationRef"
          },
          {
            "type": "object",
            "required": ["turn", "question"],
            "properties": {
              "question": {
                "type": "string",
                "description": "The question, as the agent phrased it."
              },
              "turn": {
                "type": "integer",
                "format": "int32",
                "description": "The turn asking.",
                "minimum": 0
              }
            }
          }
        ],
        "description": "An agent is blocked on a question only the session's owner can answer."
      },
      "AiResponseMetadata": {
        "type": "object",
        "required": ["summary", "messageId"],
        "properties": {
          "messageId": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          }
        }
      },
      "ApiUserNotification": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Entity",
            "description": "The entity the notification is about."
          },
          {
            "type": "object",
            "required": [
              "owner_id",
              "id",
              "notification_event_type",
              "sent",
              "state",
              "created_at",
              "updated_at",
              "notification_metadata"
            ],
            "properties": {
              "created_at": {
                "type": "string",
                "format": "date-time",
                "description": "When the notification was created."
              },
              "deleted_at": {
                "type": ["string", "null"],
                "format": "date-time",
                "description": "When the notification was deleted."
              },
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The notification ID."
              },
              "notification_event_type": {
                "type": "string",
                "description": "The notification event type string (e.g. \"channel_mention\").\nTODO make this a new type"
              },
              "notification_metadata": {
                "$ref": "#/components/schemas/NotifEvent",
                "description": "Deserialized notification metadata."
              },
              "owner_id": {
                "type": "string",
                "description": "The user who owns this notification."
              },
              "sender_id": {
                "type": ["string", "null"],
                "description": "The user who triggered the notification."
              },
              "sent": {
                "type": "boolean",
                "description": "Whether the notification has been sent."
              },
              "state": {
                "$ref": "#/components/schemas/NotificationState",
                "description": "The authoritative notification lifecycle state."
              },
              "updated_at": {
                "type": "string",
                "format": "date-time",
                "description": "When the notification was last updated."
              },
              "viewed_at": {
                "type": ["string", "null"],
                "format": "date-time",
                "description": "When the notification was viewed/seen."
              }
            }
          }
        ]
      },
      "BulkGetByEventItemIdsRequest": {
        "type": "object",
        "description": "Request body for bulk-fetching notifications by event item IDs.",
        "required": ["eventItemIds"],
        "properties": {
          "eventItemIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event item IDs to filter notifications by."
          }
        }
      },
      "BulkItem": {
        "type": "object",
        "required": ["item_type", "item_id"],
        "properties": {
          "item_id": {
            "type": "string"
          },
          "item_type": {
            "$ref": "#/components/schemas/EntityType"
          }
        }
      },
      "BulkRemoveItemsRequest": {
        "type": "object",
        "required": ["items"],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BulkItem"
            }
          }
        }
      },
      "BulkSetItemsRequest": {
        "type": "object",
        "required": ["items"],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BulkItem"
            }
          },
          "snoozed_until": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "A future resume time. Omit to mute indefinitely."
          }
        }
      },
      "CalendarEventJoinRequestMetadata": {
        "type": "object",
        "description": "A channel member who sees a calendar event only through a channel share\nasked the person who shared it to add them as a guest. Sent to the sharer,\nwith the requester as sender.",
        "required": ["requestId", "eventId", "title"],
        "properties": {
          "eventId": {
            "type": "string",
            "format": "uuid",
            "description": "The shared calendar event entity the request is for."
          },
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Stable request identity, answered from the event's details."
          },
          "title": {
            "type": "string",
            "description": "Event title when the request was made."
          }
        }
      },
      "CalendarEventReminderMetadata": {
        "type": "object",
        "description": "A calendar event alarm came due. Like [`ReminderMetadata`], these are\nself-notifications: `sender_id` must stay `None` or the only recipient is\nfiltered out. Everything the alert renders rides in here so the\ndispatcher never has to resolve the event again at display time.",
        "required": ["eventId", "occurrenceKey", "title", "minutesBefore"],
        "properties": {
          "endsAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "Instance end, for timed events."
          },
          "eventId": {
            "type": "string",
            "format": "uuid",
            "description": "The calendar event entity the alarm belongs to."
          },
          "minutesBefore": {
            "type": "integer",
            "format": "int32",
            "description": "Minutes before the start the alarm was configured to fire."
          },
          "occurrenceKey": {
            "type": "string",
            "description": "Stable occurrence key of the instance that is starting."
          },
          "startDate": {
            "type": ["string", "null"],
            "format": "date",
            "description": "Instance start date, for all-day events."
          },
          "startsAt": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "Instance start, for timed events."
          },
          "timeZone": {
            "type": ["string", "null"],
            "description": "IANA zone for rendering local clock times, when known."
          },
          "title": {
            "type": "string",
            "description": "Event display title at dispatch time."
          }
        }
      },
      "CallStartedMetadata": {
        "type": "object",
        "description": "Metadata for a notification that a call has started in a channel.\n\nMirrors the producer-side `CallStartedNotification` in the `call` crate:\nboth serialize the same wire shape (snake_case fields) under the same\n`call_started` [`Notification::TYPE_NAME`]. This type is the read-side\nmodel used by [`crate::NotifEvent`]; the producer keeps its own type\nbecause it additionally builds the incoming-call APNS/VoIP push.\n\nRows persisted before the type name was normalized used the kebab-case\n`call-started`; the [`crate::NotifEvent::CallStarted`] variant carries a\n`#[serde(alias = \"call-started\")]` so those rows still deserialize.",
        "properties": {
          "channel_name": {
            "type": ["string", "null"],
            "description": "The name of the channel the call started in, when available."
          },
          "sender_profile_picture_url": {
            "type": ["string", "null"],
            "description": "Profile picture URL of the user who started the call, when available."
          }
        }
      },
      "ChannelAccessRequestedMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonChannelMetadata",
            "description": "Channel the requester asked to join."
          },
          {
            "type": "object",
            "required": ["requestId"],
            "properties": {
              "requestId": {
                "type": "string",
                "format": "uuid",
                "description": "The attempt to join, which is also this notification's id."
              },
              "senderProfilePictureUrl": {
                "type": ["string", "null"],
                "description": "Optional requester profile picture URL."
              }
            }
          }
        ],
        "description": "A person asked to join a channel the recipient participates in."
      },
      "ChannelInviteMetadata": {
        "type": "object",
        "description": "Metadata for when a user is invited to a channel.",
        "required": ["invitedBy"],
        "properties": {
          "channelName": {
            "type": "string",
            "description": "The name of the channel"
          },
          "invitedBy": {
            "type": "string",
            "description": "The user who sent the invitation"
          },
          "isDirectMessage": {
            "type": "boolean",
            "description": "Whether this is a direct message rather than a channel invitation.\nOlder notification payloads retain channel-invitation wording."
          },
          "messageContent": {
            "type": ["string", "null"],
            "description": "Message content to show in the invite email, when the invite was triggered by a message."
          },
          "senderProfilePictureUrl": {
            "type": ["string", "null"],
            "description": "The sender's profile picture URL, if available."
          }
        }
      },
      "ChannelMentionMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonChannelMetadata"
          },
          {
            "type": "object",
            "required": ["messageId", "messageContent"],
            "properties": {
              "messageContent": {
                "type": "string",
                "description": "The message content"
              },
              "messageId": {
                "type": "string",
                "description": "The message you were mentioned in"
              },
              "senderDisplayName": {
                "type": ["string", "null"],
                "description": "Display name for non-user senders such as bots"
              },
              "senderProfilePictureUrl": {
                "type": ["string", "null"]
              },
              "threadId": {
                "type": ["string", "null"],
                "description": "the id of the thread"
              }
            }
          }
        ]
      },
      "ChannelMessageReactionMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonChannelMetadata"
          },
          {
            "type": "object",
            "required": ["messageId", "messageContent", "emoji"],
            "properties": {
              "emoji": {
                "type": "string",
                "description": "The emoji added by the reactor."
              },
              "messageContent": {
                "type": "string",
                "description": "The reacted-to message content."
              },
              "messageId": {
                "type": "string",
                "description": "The reacted-to message id."
              },
              "senderProfilePictureUrl": {
                "type": ["string", "null"],
                "description": "Optional reactor profile picture URL."
              },
              "threadId": {
                "type": ["string", "null"],
                "description": "The thread root id when the reacted-to message is a reply."
              }
            }
          }
        ],
        "description": "Metadata for a reaction added to one of the recipient's channel messages."
      },
      "ChannelMessageSendMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonChannelMetadata"
          },
          {
            "type": "object",
            "required": ["messageId"],
            "properties": {
              "messageContent": {
                "type": "string",
                "description": "The content of the message"
              },
              "messageId": {
                "type": "string",
                "description": "The message id"
              },
              "sender": {
                "type": ["string", "null"],
                "description": "The user who sent the message, when sent by a user"
              },
              "senderDisplayName": {
                "type": ["string", "null"],
                "description": "Display name for non-user senders such as bots"
              },
              "senderProfilePictureUrl": {
                "type": ["string", "null"]
              }
            }
          }
        ]
      },
      "ChannelReplyMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CommonChannelMetadata"
          },
          {
            "type": "object",
            "required": ["threadId", "messageId", "messageContent"],
            "properties": {
              "messageContent": {
                "type": "string",
                "description": "The message content"
              },
              "messageId": {
                "type": "string",
                "description": "The id of the new message"
              },
              "senderDisplayName": {
                "type": ["string", "null"],
                "description": "Display name for non-user senders such as bots"
              },
              "senderProfilePictureUrl": {
                "type": ["string", "null"]
              },
              "threadId": {
                "type": "string",
                "description": "The id of the thread that has the reply"
              },
              "threadParentSenderId": {
                "type": ["string", "null"],
                "description": "The user who sent the root message of the thread"
              },
              "userId": {
                "type": ["string", "null"],
                "description": "The sender id of the reply, when sent by a user"
              }
            }
          }
        ]
      },
      "ChannelType": {
        "type": "string",
        "enum": ["public", "private", "directMessage", "team"]
      },
      "CommentRef": {
        "oneOf": [
          {
            "type": "integer",
            "format": "int64",
            "description": "Legacy `Comment.id` or `Thread.id`."
          },
          {
            "type": "string",
            "format": "uuid",
            "description": "Message or root id in the shared message store."
          }
        ],
        "description": "Identity of a document comment or its thread. Comments written before the\nshared message store carry the legacy numeric ids; comments in the shared\nstore carry the message and root UUIDs."
      },
      "CommentedOnDocumentMetadata": {
        "type": "object",
        "description": "Notification sent when someone comments on a document the user owns.",
        "required": ["documentName", "owner", "commentId", "threadId", "text"],
        "properties": {
          "commentId": {
            "$ref": "#/components/schemas/CommentRef",
            "description": "the comment id"
          },
          "documentName": {
            "type": "string",
            "description": "The name of the document."
          },
          "fileType": {
            "type": ["string", "null"],
            "description": "The file type of the document."
          },
          "owner": {
            "type": "string",
            "description": "The owner of the document."
          },
          "senderDisplayName": {
            "type": ["string", "null"],
            "description": "Public bot name when the author is an agent rather than a Macro user."
          },
          "senderProfilePictureUrl": {
            "type": ["string", "null"]
          },
          "subType": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/NotificationDocumentSubType",
                "description": "The sub type of the document (e.g. task)."
              }
            ]
          },
          "text": {
            "type": "string",
            "description": "the text of the comment"
          },
          "threadId": {
            "$ref": "#/components/schemas/CommentRef",
            "description": "the thread id"
          }
        }
      },
      "CommonChannelMetadata": {
        "type": "object",
        "description": "Common metadata for notifications on channels",
        "required": ["channelType"],
        "properties": {
          "channelName": {
            "type": "string"
          },
          "channelType": {
            "$ref": "#/components/schemas/ChannelType"
          }
        }
      },
      "ConnGatewayNotificationPayload": {
        "$ref": "#/components/schemas/RealtimeNotif_TaggedContent_Value",
        "description": "Concrete schema type for [`RealtimeNotif`] with `serde_json::Value` metadata.\n\nUsed for OpenAPI schema generation — serializes identically to\n`RealtimeNotif<serde_json::Value>`."
      },
      "CreateNotification": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Entity",
            "description": "The [Entity] the notification event was created for"
          },
          {
            "type": "object",
            "required": ["notification_event_type", "service_sender"],
            "properties": {
              "metadata": {
                "description": "Custom metadata that may be needed for the notification"
              },
              "notification_event_type": {
                "type": "string",
                "description": "The type of notification"
              },
              "service_sender": {
                "type": "string",
                "description": "The service that created the notification"
              }
            }
          }
        ]
      },
      "CrmDiscussionMetadata": {
        "type": "object",
        "description": "CRM discussion metadata. The notification entity identifies the company or\ncontact; message and thread UUIDs select the discussion inside it.",
        "required": ["recordName", "reason", "messageId", "threadId", "text"],
        "properties": {
          "messageId": {
            "type": "string",
            "format": "uuid",
            "description": "Canonical shared message UUID."
          },
          "reason": {
            "$ref": "#/components/schemas/CrmDiscussionReason",
            "description": "Semantic reason selected by the message delivery domain."
          },
          "recordName": {
            "type": "string",
            "description": "Company or contact display name."
          },
          "senderDisplayName": {
            "type": ["string", "null"],
            "description": "Public display name for a bot author."
          },
          "senderProfilePictureUrl": {
            "type": ["string", "null"],
            "description": "Optional avatar for push notification attachments."
          },
          "text": {
            "type": "string",
            "description": "Posted Markdown content."
          },
          "threadId": {
            "type": "string",
            "format": "uuid",
            "description": "Canonical discussion root UUID."
          }
        }
      },
      "CrmDiscussionReason": {
        "type": "string",
        "description": "Why a CRM discussion notification was delivered.",
        "enum": ["mention", "reply", "owner"]
      },
      "DeviceRequest": {
        "type": "object",
        "description": "Request to register or unregister a device for push notifications.",
        "required": ["deviceType", "token"],
        "properties": {
          "deviceType": {
            "$ref": "#/components/schemas/DeviceType",
            "description": "The device platform type (iOS or Android)."
          },
          "nativeCallCapable": {
            "type": "boolean",
            "description": "Whether this Android binary supports native Telecom incoming calls."
          },
          "token": {
            "type": "string",
            "description": "The device push notification token."
          }
        }
      },
      "DeviceType": {
        "type": "string",
        "enum": ["ios", "android", "iosvoip"]
      },
      "DocumentMentionMetadata": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ChannelMentionMetadata"
          },
          {
            "type": "object",
            "required": ["documentName", "owner"],
            "properties": {
              "documentName": {
                "type": "string",
                "description": "The name of the document"
              },
              "fileType": {
                "type": ["string", "null"],
                "description": "The file type of the document"
              },
              "owner": {
                "type": "string",
                "description": "The owner of the document"
              },
              "subType": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/NotificationDocumentSubType",
                    "description": "The sub type of the document (e.g. task)"
                  }
                ]
              }
            }
          }
        ],
        "description": "Someone mentioned a document in a channel"
      },
      "EmptyResponse": {
        "type": "object",
        "description": "Empty response is required due to custom fetch forcing `response.json()`"
      },
      "Entity": {
        "type": "object",
        "description": "The Entity describes the minimum amount of information required to describe a unique thing in Macro\nThis contains the type of the entity [EntityType] and the string id of that entity",
        "required": ["entity_type", "entity_id"],
        "properties": {
          "entity_id": {
            "type": "string",
            "description": "The id of that entity"
          },
          "entity_type": {
            "$ref": "#/components/schemas/EntityType",
            "description": "The type of entity we are describing"
          }
        }
      },
      "EntityAccessGrantedMetadata": {
        "type": "object",
        "description": "A person granted you access to a shared entity.",
        "required": ["requestId", "revision", "entityName", "accessLevel"],
        "properties": {
          "accessLevel": {
            "$ref": "#/components/schemas/RequestedAccessLevel",
            "description": "Requested or granted permission."
          },
          "entityName": {
            "type": "string",
            "description": "Shared item's name."
          },
          "fileType": {
            "type": ["string", "null"],
            "description": "Document file type for routing."
          },
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Stable request identity."
          },
          "revision": {
            "type": "integer",
            "format": "int32",
            "description": "Revision that generated this notification."
          }
        }
      },
      "EntityAccessRequestedMetadata": {
        "type": "object",
        "description": "A person requested access to a shared entity.",
        "required": ["requestId", "revision", "entityName", "accessLevel"],
        "properties": {
          "accessLevel": {
            "$ref": "#/components/schemas/RequestedAccessLevel",
            "description": "Requested or granted permission."
          },
          "entityName": {
            "type": "string",
            "description": "Shared item's name."
          },
          "fileType": {
            "type": ["string", "null"],
            "description": "Document file type for routing."
          },
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "Stable request identity."
          },
          "revision": {
            "type": "integer",
            "format": "int32",
            "description": "Revision that generated this notification."
          }
        }
      },
      "EntityType": {
        "type": "string",
        "description": "The type of an entity in Macro",
        "enum": [
          "user",
          "chat",
          "channel",
          "channel_message",
          "document",
          "project",
          "email_thread",
          "calendar_event",
          "team",
          "call",
          "foreign_entity",
          "static_file",
          "crm_company",
          "crm_contact",
          "crm_pipeline",
          "reminder",
          "skill",
          "agent_session",
          "scheduled_action",
          "initiative",
          "database",
          "database_row",
          "form",
          "external_chat"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "description": "A plain old json error response for use with axum.\nyup, thats it.",
        "required": ["message"],
        "properties": {
          "message": {
            "type": "string",
            "description": "Message to explain failure"
          }
        }
      },
      "ExternalChatMessageMetadata": {
        "type": "object",
        "description": "A live message in an independently shared external chat.",
        "required": ["provider", "chatName", "messageId"],
        "properties": {
          "chatName": {
            "type": "string",
            "description": "The chat's name."
          },
          "messageId": {
            "type": "string",
            "format": "uuid",
            "description": "Stable message id; retries use it as their notification id."
          },
          "provider": {
            "$ref": "#/components/schemas/ExternalChatProvider",
            "description": "The messaging service the chat lives in."
          }
        }
      },
      "ExternalChatProvider": {
        "type": "string",
        "description": "The messaging service an external chat lives in.",
        "enum": ["whatsapp"]
      },
      "GetAllUserNotificationsResponse": {
        "type": "object",
        "description": "The strongly typed response for listing user notifications.",
        "required": ["items"],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiUserNotification"
            },
            "description": "The list of items returned."
          },
          "next_cursor": {
            "type": ["string", "null"],
            "description": "The next page cursor if it exists."
          }
        }
      },
      "GetNotificationTypePreferencesResponse": {
        "type": "object",
        "description": "Response for listing disabled notification types.",
        "required": ["disabled_types"],
        "properties": {
          "disabled_types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The notification types that the user has disabled."
          }
        }
      },
      "GithubPrCheckRun": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GithubPrNotificationCommon",
            "description": "Fields shared with the other GitHub pull request notifications."
          },
          {
            "type": "object",
            "required": [
              "checkRunGithubId",
              "checkName",
              "checkStatus",
              "conclusion",
              "state",
              "checkUrl",
              "completedAt"
            ],
            "properties": {
              "checkName": {
                "type": "string",
                "description": "The display name GitHub reported for the check run."
              },
              "checkRunGithubId": {
                "type": "integer",
                "format": "int64",
                "description": "The GitHub numeric id of the check run.",
                "minimum": 0
              },
              "checkStatus": {
                "type": "string",
                "description": "The raw GitHub check run status."
              },
              "checkUrl": {
                "type": "string",
                "description": "The public GitHub URL for the check run."
              },
              "completedAt": {
                "type": "string",
                "format": "date-time",
                "description": "When GitHub marked the check run as complete."
              },
              "conclusion": {
                "type": "string",
                "description": "The raw GitHub check run conclusion."
              },
              "state": {
                "$ref": "#/components/schemas/GithubPrCheckRunState",
                "description": "The normalized notification state for this check run."
              }
            }
          }
        ],
        "description": "Metadata for a notification that a GitHub pull request check run completed."
      },
      "GithubPrCheckRunState": {
        "type": "string",
        "description": "The normalized result state for a GitHub pull request check-run notification.",
        "enum": ["completed", "failed"]
      },
      "GithubPrComment": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GithubPrNotificationCommon",
            "description": "Fields shared with the other GitHub pull request notifications."
          },
          {
            "type": "object",
            "required": ["commentKind", "commentSnippet"],
            "properties": {
              "commentGithubId": {
                "type": ["integer", "null"],
                "format": "int64",
                "description": "The GitHub numeric id of the comment, when available.",
                "minimum": 0
              },
              "commentKind": {
                "$ref": "#/components/schemas/GithubPrCommentKind",
                "description": "The kind of comment that was posted."
              },
              "commentSnippet": {
                "type": "string",
                "description": "A truncated excerpt of the comment body."
              },
              "commentUrl": {
                "type": ["string", "null"],
                "description": "The public GitHub URL for the comment, when available."
              }
            }
          }
        ],
        "description": "Metadata for a notification that a GitHub pull request was commented on."
      },
      "GithubPrCommentKind": {
        "type": "string",
        "description": "The kind of GitHub comment that triggered a [`GithubPrComment`] notification.",
        "enum": ["issue", "review_comment"]
      },
      "GithubPrEventAction": {
        "type": "string",
        "description": "The GitHub pull request webhook action that triggered the notification.",
        "enum": ["opened", "reopened", "closed"]
      },
      "GithubPrEventStatus": {
        "type": "string",
        "description": "The normalized lifecycle status for a GitHub pull request notification.",
        "enum": ["open", "closed", "merged"]
      },
      "GithubPrMention": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GithubPrNotificationCommon",
            "description": "Fields shared with the other GitHub pull request notifications."
          },
          {
            "type": "object",
            "required": ["location", "textSnippet"],
            "properties": {
              "commentGithubId": {
                "type": ["integer", "null"],
                "format": "int64",
                "description": "The GitHub numeric id of the comment or review containing the mention, when available.",
                "minimum": 0
              },
              "commentUrl": {
                "type": ["string", "null"],
                "description": "The public GitHub URL for the text containing the mention, when available."
              },
              "location": {
                "$ref": "#/components/schemas/GithubPrMentionLocation",
                "description": "Where the mention appeared."
              },
              "textSnippet": {
                "type": "string",
                "description": "A truncated excerpt of the text containing the mention."
              }
            }
          }
        ],
        "description": "Metadata for a notification that the user was mentioned on a GitHub pull request."
      },
      "GithubPrMentionLocation": {
        "type": "string",
        "description": "Where in a GitHub pull request the user was mentioned.",
        "enum": ["pr_body", "comment", "review", "review_comment"]
      },
      "GithubPrNotificationCommon": {
        "type": "object",
        "description": "Fields shared by every GitHub pull request notification type.\n\nEmbedded with `#[serde(flatten)]` so the wire shape keeps these keys at the\ntop level of the metadata object.",
        "required": [
          "foreignEntityId",
          "githubKey",
          "owner",
          "repo",
          "number",
          "url",
          "displayName",
          "title"
        ],
        "properties": {
          "displayName": {
            "type": "string",
            "description": "A compact label suitable for display in the UI."
          },
          "foreignEntityId": {
            "type": "string",
            "format": "uuid",
            "description": "The source-specific internal foreign entity row id for this pull request."
          },
          "githubKey": {
            "type": "string",
            "description": "The external GitHub key, in `owner/repo/pull/number` format."
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "The GitHub pull request number.",
            "minimum": 0
          },
          "owner": {
            "type": "string",
            "description": "The GitHub repository owner or organization."
          },
          "repo": {
            "type": "string",
            "description": "The GitHub repository name."
          },
          "senderGithubAvatarUrl": {
            "type": ["string", "null"],
            "description": "The GitHub avatar URL for the sender, when available."
          },
          "senderGithubLogin": {
            "type": ["string", "null"],
            "description": "The GitHub login for the sender, when available."
          },
          "senderGithubUserId": {
            "type": ["string", "null"],
            "description": "The stable GitHub numeric user id for the sender, serialized as a string."
          },
          "title": {
            "type": "string",
            "description": "The GitHub pull request title. Falls back to `display_name` when GitHub has no title."
          },
          "url": {
            "type": "string",
            "description": "The public GitHub URL for the pull request."
          }
        }
      },
      "GithubPrReview": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GithubPrNotificationCommon",
            "description": "Fields shared with the other GitHub pull request notifications."
          },
          {
            "type": "object",
            "required": ["state"],
            "properties": {
              "reviewGithubId": {
                "type": ["integer", "null"],
                "format": "int64",
                "description": "The GitHub numeric id of the review, when available.",
                "minimum": 0
              },
              "reviewSnippet": {
                "type": ["string", "null"],
                "description": "A truncated excerpt of the review body, when any was written."
              },
              "reviewUrl": {
                "type": ["string", "null"],
                "description": "The public GitHub URL for the review, when available."
              },
              "state": {
                "$ref": "#/components/schemas/GithubPrReviewState",
                "description": "The review decision state."
              }
            }
          }
        ],
        "description": "Metadata for a notification that a review was submitted on the user's GitHub pull request."
      },
      "GithubPrReviewState": {
        "type": "string",
        "description": "The state of a submitted GitHub pull request review.",
        "enum": ["approved", "changes_requested", "commented"]
      },
      "GithubPrStatusChanged": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GithubPrNotificationCommon",
            "description": "Fields shared with the other GitHub pull request notifications."
          },
          {
            "type": "object",
            "required": ["status", "action"],
            "properties": {
              "action": {
                "$ref": "#/components/schemas/GithubPrEventAction",
                "description": "The webhook action that triggered this notification."
              },
              "baseBranch": {
                "type": ["string", "null"],
                "description": "The pull request base branch, when available."
              },
              "headBranch": {
                "type": ["string", "null"],
                "description": "The pull request head branch, when available."
              },
              "mergedAt": {
                "type": ["string", "null"],
                "format": "date-time",
                "description": "When the pull request was merged, when available."
              },
              "previousStatus": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/GithubPrEventStatus",
                    "description": "The prior normalized pull request status, when known."
                  }
                ]
              },
              "status": {
                "$ref": "#/components/schemas/GithubPrEventStatus",
                "description": "The current normalized pull request status."
              }
            }
          }
        ],
        "description": "Metadata for a GitHub pull request lifecycle notification."
      },
      "GithubReviewRequested": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GithubPrNotificationCommon",
            "description": "Fields shared with the other GitHub pull request notifications."
          },
          {
            "type": "object",
            "properties": {
              "requestedReviewerGithubLogin": {
                "type": ["string", "null"],
                "description": "The GitHub login of the requested reviewer, when available."
              },
              "requestedReviewerGithubUserId": {
                "type": ["string", "null"],
                "description": "The stable GitHub numeric user id of the requested reviewer, serialized as a string."
              }
            }
          }
        ],
        "description": "Metadata for a notification that the user's review was requested on a GitHub pull request."
      },
      "InboxReauthRequiredMetadata": {
        "type": "object",
        "description": "Metadata for a notification that a linked inbox's grant has died and the\ninbox must be reconnected. Fanned out to the inbox owner and every delegate,\nsince any of them holding the Google grant can restore sync.",
        "required": ["emailAddress"],
        "properties": {
          "emailAddress": {
            "type": "string",
            "description": "The address of the inbox that needs to be reconnected."
          }
        }
      },
      "InitiativeDiscussionMetadata": {
        "type": "object",
        "description": "Project discussion metadata. The notification entity identifies the initiative;\nmessage and thread UUIDs select the discussion inside that project.",
        "required": [
          "projectName",
          "owner",
          "reason",
          "messageId",
          "threadId",
          "text"
        ],
        "properties": {
          "messageId": {
            "type": "string",
            "format": "uuid",
            "description": "Canonical shared message UUID."
          },
          "owner": {
            "type": "string",
            "description": "Authenticated project owner."
          },
          "projectName": {
            "type": "string",
            "description": "Name displayed in the project header."
          },
          "reason": {
            "$ref": "#/components/schemas/InitiativeDiscussionReason",
            "description": "Semantic reason selected by the message delivery domain."
          },
          "senderDisplayName": {
            "type": ["string", "null"],
            "description": "Public display name for a bot author."
          },
          "senderProfilePictureUrl": {
            "type": ["string", "null"],
            "description": "Optional avatar for push notification attachments."
          },
          "text": {
            "type": "string",
            "description": "Posted Markdown content."
          },
          "threadId": {
            "type": "string",
            "format": "uuid",
            "description": "Canonical discussion root UUID."
          }
        }
      },
      "InitiativeDiscussionReason": {
        "type": "string",
        "description": "Why a project discussion notification was delivered.",
        "enum": ["mention", "reply", "assignee", "owner"]
      },
      "InviteToTeamMetadata": {
        "type": "object",
        "description": "Metadata for when a user is invited to a team.",
        "required": ["teamName", "teamId", "teamInviteId", "invitedBy"],
        "properties": {
          "invitedBy": {
            "type": "string",
            "description": "The user who sent the invitation"
          },
          "inviteePlan": {
            "$ref": "#/components/schemas/InviteePlan",
            "description": "What the invitee gets by joining, as the team stood when the invite was sent."
          },
          "inviterName": {
            "type": ["string", "null"],
            "description": "The inviter's display name, when they have set one. It is user-provided, so it is shown\non one line, capped, and escaped; the email falls back to the inviter's address."
          },
          "isAgent": {
            "type": "boolean",
            "description": "Whether the invite creates an agent account."
          },
          "reminder": {
            "type": "boolean",
            "description": "Whether this email reminds the invitee of an invite they have not answered."
          },
          "role": {
            "type": ["string", "null"],
            "description": "Role/permission level in the team"
          },
          "senderProfilePictureUrl": {
            "type": ["string", "null"],
            "description": "The sender's profile picture URL, if available."
          },
          "teamId": {
            "type": "string",
            "format": "uuid",
            "description": "The unique identifier of the team"
          },
          "teamInviteId": {
            "type": "string",
            "format": "uuid",
            "description": "The unique identifier of the team invite"
          },
          "teamName": {
            "type": "string",
            "description": "The name of the team being invited to"
          }
        }
      },
      "InviteePlan": {
        "type": "string",
        "description": "What a team invitee gets by joining.",
        "enum": ["free", "premium"]
      },
      "ItemSharedMetadata": {
        "type": "object",
        "description": "Metadata for when a item is shared with a user",
        "required": ["userIds", "itemType", "itemId", "sharedBy"],
        "properties": {
          "itemId": {
            "type": "string",
            "description": "The name/title of the shared item (optional)"
          },
          "itemName": {
            "type": ["string", "null"],
            "description": "The name/title of the shared item"
          },
          "itemType": {
            "$ref": "#/components/schemas/EntityType",
            "description": "The type of item being shared"
          },
          "permissionLevel": {
            "type": ["string", "null"],
            "description": "Permission level granted (read, write, admin, etc.)"
          },
          "sharedBy": {
            "type": "string"
          },
          "userIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of user IDs that the item is shared with"
          }
        }
      },
      "MacroUserIdStr": {
        "type": "string"
      },
      "MentionedInDocumentCommentMetadata": {
        "type": "object",
        "description": "Notification sent when a user is mentioned in a document comment.",
        "required": [
          "documentName",
          "owner",
          "mentionId",
          "commentId",
          "threadId",
          "text"
        ],
        "properties": {
          "commentId": {
            "$ref": "#/components/schemas/CommentRef",
            "description": "the comment id"
          },
          "documentName": {
            "type": "string",
            "description": "The name of the document."
          },
          "fileType": {
            "type": ["string", "null"],
            "description": "The file type of the document."
          },
          "mentionId": {
            "type": "string",
            "description": "The mention ID."
          },
          "owner": {
            "type": "string",
            "description": "The owner of the document."
          },
          "senderDisplayName": {
            "type": ["string", "null"],
            "description": "Public bot name when the author is an agent rather than a Macro user."
          },
          "senderProfilePictureUrl": {
            "type": ["string", "null"]
          },
          "subType": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/NotificationDocumentSubType",
                "description": "The sub type of the document (e.g. task)."
              }
            ]
          },
          "text": {
            "type": "string",
            "description": "the text of the comment"
          },
          "threadId": {
            "$ref": "#/components/schemas/CommentRef",
            "description": "the thread id"
          }
        }
      },
      "NewEmailMetadata": {
        "type": "object",
        "required": ["toEmail", "threadId", "subject", "snippet"],
        "properties": {
          "sender": {
            "type": ["string", "null"]
          },
          "snippet": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "threadId": {
            "type": "string"
          },
          "toEmail": {
            "type": "string"
          }
        }
      },
      "NotifEvent": {
        "oneOf": [
          {
            "type": "object",
            "description": "Someone mentioned you in a channel.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/ChannelMentionMetadata",
                "description": "Someone mentioned you in a channel."
              },
              "tag": {
                "type": "string",
                "enum": ["channel_mention"]
              }
            }
          },
          {
            "type": "object",
            "description": "Someone mentioned a document in a channel.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/DocumentMentionMetadata",
                "description": "Someone mentioned a document in a channel."
              },
              "tag": {
                "type": "string",
                "enum": ["document_mention"]
              }
            }
          },
          {
            "type": "object",
            "description": "User was mentioned in a comment in a document",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/MentionedInDocumentCommentMetadata",
                "description": "User was mentioned in a comment in a document"
              },
              "tag": {
                "type": "string",
                "enum": ["mentioned_in_document_comment"]
              }
            }
          },
          {
            "type": "object",
            "description": "Someone replied to a document comment thread the user participated in.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/RepliedToDocumentCommentThreadMetadata",
                "description": "Someone replied to a document comment thread the user participated in."
              },
              "tag": {
                "type": "string",
                "enum": ["replied_to_document_comment_thread"]
              }
            }
          },
          {
            "type": "object",
            "description": "Someone commented on a document the user owns.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/CommentedOnDocumentMetadata",
                "description": "Someone commented on a document the user owns."
              },
              "tag": {
                "type": "string",
                "enum": ["commented_on_document"]
              }
            }
          },
          {
            "type": "object",
            "description": "Someone requested more access to a shared entity.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/EntityAccessRequestedMetadata",
                "description": "Someone requested more access to a shared entity."
              },
              "tag": {
                "type": "string",
                "enum": ["entity_access_requested"]
              }
            }
          },
          {
            "type": "object",
            "description": "An owner granted requested access.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/EntityAccessGrantedMetadata",
                "description": "An owner granted requested access."
              },
              "tag": {
                "type": "string",
                "enum": ["entity_access_granted"]
              }
            }
          },
          {
            "type": "object",
            "description": "Someone commented, replied, or mentioned the recipient on a project.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/InitiativeDiscussionMetadata",
                "description": "Someone commented, replied, or mentioned the recipient on a project."
              },
              "tag": {
                "type": "string",
                "enum": ["initiative_discussion"]
              }
            }
          },
          {
            "type": "object",
            "description": "Someone commented, replied, or mentioned the recipient on a CRM company or contact.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/CrmDiscussionMetadata",
                "description": "Someone commented, replied, or mentioned the recipient on a CRM company or contact."
              },
              "tag": {
                "type": "string",
                "enum": ["crm_discussion"]
              }
            }
          },
          {
            "type": "object",
            "description": "The user was invited to a channel.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/ChannelInviteMetadata",
                "description": "The user was invited to a channel."
              },
              "tag": {
                "type": "string",
                "enum": ["channel_invite"]
              }
            }
          },
          {
            "type": "object",
            "description": "A user sent a message in a channel.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/ChannelMessageSendMetadata",
                "description": "A user sent a message in a channel."
              },
              "tag": {
                "type": "string",
                "enum": ["channel_message_send"]
              }
            }
          },
          {
            "type": "object",
            "description": "Someone replied to a thread in a channel that the user is part of.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/ChannelReplyMetadata",
                "description": "Someone replied to a thread in a channel that the user is part of."
              },
              "tag": {
                "type": "string",
                "enum": ["channel_message_reply"]
              }
            }
          },
          {
            "type": "object",
            "description": "A call has started in a channel the user is a member of.\n\nThe `call-started` alias keeps rows persisted before the type name\nwas normalized to snake_case (`call_started`) deserializable.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/CallStartedMetadata",
                "description": "A call has started in a channel the user is a member of.\n\nThe `call-started` alias keeps rows persisted before the type name\nwas normalized to snake_case (`call_started`) deserializable."
              },
              "tag": {
                "type": "string",
                "enum": ["call_started"]
              }
            }
          },
          {
            "type": "object",
            "description": "A new email has been sent to the user.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/NewEmailMetadata",
                "description": "A new email has been sent to the user."
              },
              "tag": {
                "type": "string",
                "enum": ["new_email"]
              }
            }
          },
          {
            "type": "object",
            "description": "A linked inbox's grant died and must be reconnected.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/InboxReauthRequiredMetadata",
                "description": "A linked inbox's grant died and must be reconnected."
              },
              "tag": {
                "type": "string",
                "enum": ["inbox_reauth_required"]
              }
            }
          },
          {
            "type": "object",
            "description": "A user was invited to a team.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/InviteToTeamMetadata",
                "description": "A user was invited to a team."
              },
              "tag": {
                "type": "string",
                "enum": ["invite_to_team"]
              }
            }
          },
          {
            "type": "object",
            "description": "A user was assigned to a task.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/TaskAssignedMetadata",
                "description": "A user was assigned to a task."
              },
              "tag": {
                "type": "string",
                "enum": ["task_assigned"]
              }
            }
          },
          {
            "type": "object",
            "description": "A reminder the user set for themselves came due.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/ReminderMetadata",
                "description": "A reminder the user set for themselves came due."
              },
              "tag": {
                "type": "string",
                "enum": ["reminder"]
              }
            }
          },
          {
            "type": "object",
            "description": "A live message in a shared external chat.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/ExternalChatMessageMetadata",
                "description": "A live message in a shared external chat."
              },
              "tag": {
                "type": "string",
                "enum": ["external_chat_message"]
              }
            }
          },
          {
            "type": "object",
            "description": "A calendar event alarm came due.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/CalendarEventReminderMetadata",
                "description": "A calendar event alarm came due."
              },
              "tag": {
                "type": "string",
                "enum": ["calendar_event_reminder"]
              }
            }
          },
          {
            "type": "object",
            "description": "An AI assistant responded to a chat.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/AiResponseMetadata",
                "description": "An AI assistant responded to a chat."
              },
              "tag": {
                "type": "string",
                "enum": ["ai_response"]
              }
            }
          },
          {
            "type": "object",
            "description": "A GitHub pull request changed lifecycle state.\n\nThe `github_pr_event` alias keeps rows and queue messages persisted\nbefore the rename deserializable.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/GithubPrStatusChanged",
                "description": "A GitHub pull request changed lifecycle state.\n\nThe `github_pr_event` alias keeps rows and queue messages persisted\nbefore the rename deserializable."
              },
              "tag": {
                "type": "string",
                "enum": ["github_pr_status_changed"]
              }
            }
          },
          {
            "type": "object",
            "description": "A GitHub pull request check run completed.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/GithubPrCheckRun",
                "description": "A GitHub pull request check run completed."
              },
              "tag": {
                "type": "string",
                "enum": ["github_pr_check_run"]
              }
            }
          },
          {
            "type": "object",
            "description": "The user's review was requested on a GitHub pull request.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/GithubReviewRequested",
                "description": "The user's review was requested on a GitHub pull request."
              },
              "tag": {
                "type": "string",
                "enum": ["github_review_requested"]
              }
            }
          },
          {
            "type": "object",
            "description": "A GitHub pull request was commented on.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/GithubPrComment",
                "description": "A GitHub pull request was commented on."
              },
              "tag": {
                "type": "string",
                "enum": ["github_pr_comment"]
              }
            }
          },
          {
            "type": "object",
            "description": "The user was mentioned on a GitHub pull request.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/GithubPrMention",
                "description": "The user was mentioned on a GitHub pull request."
              },
              "tag": {
                "type": "string",
                "enum": ["github_pr_mention"]
              }
            }
          },
          {
            "type": "object",
            "description": "A review was submitted on the user's GitHub pull request.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/GithubPrReview",
                "description": "A review was submitted on the user's GitHub pull request."
              },
              "tag": {
                "type": "string",
                "enum": ["github_pr_review"]
              }
            }
          },
          {
            "type": "object",
            "description": "An agent finished a turn with nothing queued behind it.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/AgentSessionSettledMetadata",
                "description": "An agent finished a turn with nothing queued behind it."
              },
              "tag": {
                "type": "string",
                "enum": ["agent_session_settled"]
              }
            }
          },
          {
            "type": "object",
            "description": "An agent is blocked on a question for the session's owner.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/AgentSessionWaitingForInputMetadata",
                "description": "An agent is blocked on a question for the session's owner."
              },
              "tag": {
                "type": "string",
                "enum": ["agent_session_waiting_for_input"]
              }
            }
          },
          {
            "type": "object",
            "description": "The user was named in a prompt to an agent session.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/AgentSessionMentionedMetadata",
                "description": "The user was named in a prompt to an agent session."
              },
              "tag": {
                "type": "string",
                "enum": ["agent_session_mentioned"]
              }
            }
          },
          {
            "type": "object",
            "description": "Someone reacted to one of the user's channel messages.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/ChannelMessageReactionMetadata",
                "description": "Someone reacted to one of the user's channel messages."
              },
              "tag": {
                "type": "string",
                "enum": ["channel_message_reaction"]
              }
            }
          },
          {
            "type": "object",
            "description": "A channel member asked to be added as a guest of an event the\nuser shared with the channel.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/CalendarEventJoinRequestMetadata",
                "description": "A channel member asked to be added as a guest of an event the\nuser shared with the channel."
              },
              "tag": {
                "type": "string",
                "enum": ["calendar_event_join_request"]
              }
            }
          },
          {
            "type": "object",
            "description": "Someone asked to join a channel the user participates in.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/ChannelAccessRequestedMetadata",
                "description": "Someone asked to join a channel the user participates in."
              },
              "tag": {
                "type": "string",
                "enum": ["channel_access_requested"]
              }
            }
          },
          {
            "type": "object",
            "description": "One of the user's routines finished a run, successfully or not.",
            "required": ["content", "tag"],
            "properties": {
              "content": {
                "$ref": "#/components/schemas/RoutineRunFinishedMetadata",
                "description": "One of the user's routines finished a run, successfully or not."
              },
              "tag": {
                "type": "string",
                "enum": ["routine_run_finished"]
              }
            }
          }
        ],
        "description": "Mirrors [`model_notifications::NotificationEvent`] but uses `tag` / `content`\nas the serde adjacently-tagged field names so it can be deserialized from the\nshape produced by [`UserNotificationRow::into_tagged`] +\n[`UserNotificationRow::into_json`].\n\nOnly includes variants whose metadata types implement the `Notification` trait."
      },
      "NotificationBulkRequest": {
        "type": "object",
        "description": "the notification ids that we are bulk updating",
        "required": ["notificationIds"],
        "properties": {
          "notificationIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The ids of the notifications to handle"
          }
        }
      },
      "NotificationDocumentSubType": {
        "oneOf": [
          {
            "type": "object",
            "required": ["type"],
            "properties": {
              "type": {
                "type": "string",
                "enum": ["task"]
              }
            }
          },
          {
            "type": "object",
            "required": ["type"],
            "properties": {
              "type": {
                "type": "string",
                "enum": ["snippet"]
              }
            }
          },
          {
            "type": "object",
            "required": ["type"],
            "properties": {
              "type": {
                "type": "string",
                "enum": ["skill"]
              }
            }
          },
          {
            "type": "object",
            "required": ["type"],
            "properties": {
              "type": {
                "type": "string",
                "enum": ["initiative_description"]
              }
            }
          }
        ],
        "description": "The sub type of a document in a notification.\nSerializes as `{ \"type\": \"task\" }` matching the storage service pattern."
      },
      "NotificationServiceApiVersion": {
        "type": "string",
        "enum": ["v1"]
      },
      "NotificationState": {
        "type": "string",
        "description": "The mutually exclusive lifecycle states of a user's notification.",
        "enum": ["unseen", "seen", "done"]
      },
      "NotificationTypeName": {
        "type": "string",
        "description": "newtype wrapper for the the typename of a Notification"
      },
      "PushNotificationData": {
        "type": "object",
        "description": "the value we send as the payload in the ios notification\nThis data is accessible to the client",
        "required": ["notificationId"],
        "properties": {
          "navigation": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PushNotificationNavigation",
                "description": "Destination to open without fetching the notification record first."
              }
            ]
          },
          "notificationId": {
            "type": "string",
            "format": "uuid",
            "description": "The id of the notification record (UserNotification.id)"
          },
          "recipientId": {
            "type": ["string", "null"],
            "description": "Account that owns the receiving device, set during per-recipient delivery."
          },
          "senderProfilePictureUrl": {
            "type": ["string", "null"],
            "description": "The sender's profile picture URL, used by the Notification Service Extension\nto download and attach as a rich notification image."
          }
        }
      },
      "PushNotificationNavigation": {
        "oneOf": [
          {
            "type": "object",
            "description": "Open a channel at a specific message.",
            "required": ["channelId", "messageId", "threadId", "type"],
            "properties": {
              "channelId": {
                "type": "string",
                "format": "uuid",
                "description": "Channel containing the message."
              },
              "messageId": {
                "type": "string",
                "format": "uuid",
                "description": "Message to highlight."
              },
              "threadId": {
                "type": ["string", "null"],
                "format": "uuid",
                "description": "Root of the message's thread; null identifies a top-level message."
              },
              "type": {
                "type": "string",
                "enum": ["channel"]
              }
            }
          }
        ],
        "description": "A destination carried by a push notification. Access is checked when opened."
      },
      "RealtimeNotif_TaggedContent_Value": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Entity",
            "description": "The entity the notification is about."
          },
          {
            "type": "object",
            "required": [
              "notification_id",
              "notification_event_type",
              "sent",
              "state",
              "created_at",
              "updated_at",
              "notification_metadata"
            ],
            "properties": {
              "created_at": {
                "type": "string",
                "format": "date-time",
                "description": "When the notification was created."
              },
              "deleted_at": {
                "type": ["string", "null"],
                "format": "date-time",
                "description": "When the notification was deleted."
              },
              "notification_event_type": {
                "type": "string",
                "description": "The notification event type string (e.g. \"channel_mention\").\nTODO make this a new type"
              },
              "notification_id": {
                "type": "string",
                "format": "uuid",
                "description": "The notification ID."
              },
              "notification_metadata": {
                "type": "object",
                "description": "A notification metadata value tagged with the notification event type.",
                "required": ["tag", "content"],
                "properties": {
                  "content": {},
                  "tag": {
                    "$ref": "#/components/schemas/NotificationTypeName"
                  }
                }
              },
              "sender_id": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/MacroUserIdStr",
                    "description": "The user who triggered the notification."
                  }
                ]
              },
              "sent": {
                "type": "boolean",
                "description": "Whether the notification has been sent."
              },
              "state": {
                "$ref": "#/components/schemas/NotificationState",
                "description": "The authoritative lifecycle state, independent of viewing timestamps."
              },
              "updated_at": {
                "type": "string",
                "format": "date-time",
                "description": "When the notification was last updated."
              },
              "viewed_at": {
                "type": ["string", "null"],
                "format": "date-time",
                "description": "When the notification was viewed/seen."
              }
            }
          }
        ],
        "description": "the value of the inner payload inside [ConnGatewayNotification]"
      },
      "ReminderMetadata": {
        "type": "object",
        "description": "Metadata for a reminder the user set for themselves coming due.\n\nThere is no sender: a reminder is self-set, so the dispatcher sends it with\n`sender_id: None` (a recipient who is also the sender is filtered out of\ntheir own notification). Every formatter here must therefore work without\none.\n\nThe associated entity, when there is one, lives on the notification row\nrather than in here, and clients resolve its name from that — so the\ndispatcher does not have to look up a name across five entity types.",
        "required": ["reminderId", "description"],
        "properties": {
          "description": {
            "type": "string",
            "description": "What the user asked to be reminded about."
          },
          "reminderId": {
            "type": "string",
            "format": "uuid",
            "description": "The reminder that fired."
          },
          "scheduledFor": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "Which firing this is — the occurrence the reminder came due for.\n\nWhat distinguishes two firings of the same recurring reminder, which are\notherwise identical: same id, same description. The collapse key is\nbuilt from it, so without it Tuesday's alert would replace Monday's\nunread one on the lock screen.\n\nOptional because notifications written before recurring dispatch existed\nhave no such field, and they still have to read back."
          }
        }
      },
      "RepliedToDocumentCommentThreadMetadata": {
        "type": "object",
        "description": "Notification sent when someone replies to a document comment thread.",
        "required": ["documentName", "owner", "commentId", "threadId", "text"],
        "properties": {
          "commentId": {
            "$ref": "#/components/schemas/CommentRef",
            "description": "the comment id"
          },
          "documentName": {
            "type": "string",
            "description": "The name of the document."
          },
          "fileType": {
            "type": ["string", "null"],
            "description": "The file type of the document."
          },
          "owner": {
            "type": "string",
            "description": "The owner of the document."
          },
          "senderDisplayName": {
            "type": ["string", "null"],
            "description": "Public bot name when the author is an agent rather than a Macro user."
          },
          "senderProfilePictureUrl": {
            "type": ["string", "null"]
          },
          "subType": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/NotificationDocumentSubType",
                "description": "The sub type of the document (e.g. task)."
              }
            ]
          },
          "text": {
            "type": "string",
            "description": "the text of the comment"
          },
          "threadId": {
            "$ref": "#/components/schemas/CommentRef",
            "description": "the thread id"
          }
        }
      },
      "RequestedAccessLevel": {
        "type": "string",
        "description": "Permission level used by an access request, excluding ownership.",
        "enum": ["view", "comment", "edit"]
      },
      "RoutineRunFinishedMetadata": {
        "type": "object",
        "description": "One of the recipient's routines finished a run. Every run notifies,\nwhether it succeeded or failed.",
        "required": ["routineId", "routineName", "outcome"],
        "properties": {
          "outcome": {
            "$ref": "#/components/schemas/RoutineRunOutcome",
            "description": "How the run ended."
          },
          "routineId": {
            "type": "string",
            "format": "uuid",
            "description": "The routine that ran."
          },
          "routineName": {
            "type": "string",
            "description": "The routine's name when it ran."
          }
        }
      },
      "RoutineRunOutcome": {
        "type": "string",
        "description": "How a routine run ended, as its notification reports it.",
        "enum": ["succeeded", "failed"]
      },
      "TaskAssignedMetadata": {
        "type": "object",
        "description": "Metadata for when a user is assigned to a task",
        "required": ["taskId", "assignedBy"],
        "properties": {
          "assignedBy": {
            "type": "string",
            "description": "The user who assigned the task"
          },
          "senderProfilePictureUrl": {
            "type": ["string", "null"]
          },
          "subType": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/NotificationDocumentSubType",
                "description": "The sub type of the backing document (task)."
              }
            ]
          },
          "taskId": {
            "type": "string",
            "description": "The unique identifier of the task"
          },
          "taskName": {
            "type": ["string", "null"],
            "description": "The name of the task (optional)"
          }
        }
      },
      "UnsubscribeItemPathParams": {
        "type": "object",
        "required": ["item_type", "item_id"],
        "properties": {
          "item_id": {
            "type": "string"
          },
          "item_type": {
            "$ref": "#/components/schemas/EntityType"
          }
        }
      },
      "UserUnsubscribe": {
        "type": "object",
        "required": ["item_id", "item_type"],
        "properties": {
          "item_id": {
            "type": "string",
            "description": "The item id"
          },
          "item_type": {
            "type": "string",
            "description": "The item type"
          },
          "snoozed_until": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "None for permanent mutes; notifications resume automatically at this deadline."
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "notification service",
      "description": "Macro Notification Service"
    }
  ]
}