Skip to main content

systemprompt_models/notifications/
realtime.rs

1//! Realtime event names and payloads pushed to connected readers.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use schemars::JsonSchema;
7use serde::{Deserialize, Serialize};
8use systemprompt_identifiers::NotificationId;
9
10use super::attention::Attention;
11use super::notification::Notification;
12
13pub const NOTIFICATION_CREATED: &str = "notification.created";
14pub const NOTIFICATION_READ: &str = "notification.read";
15pub const NOTIFICATION_ESCALATED: &str = "notification.escalated";
16
17/// Payload of [`NOTIFICATION_CREATED`].
18#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
19pub struct NotificationCreatedPayload {
20    pub notification: Notification,
21    pub unread: i64,
22}
23
24/// Payload of [`NOTIFICATION_READ`].
25#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
26pub struct NotificationReadPayload {
27    pub ids: Vec<NotificationId>,
28    pub unread: i64,
29}
30
31/// Payload of [`NOTIFICATION_ESCALATED`].
32#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
33pub struct NotificationEscalatedPayload {
34    pub id: NotificationId,
35    pub attention: Attention,
36}