Skip to main content

systemprompt_models/notifications/
simulate.rs

1//! Dry-run routing: what an event would do, recipient by recipient.
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::{NotificationRuleId, UserId};
9
10use super::attention::{Attention, AttentionReason};
11use super::event::NotificationEvent;
12use super::route::RoutePlan;
13
14/// An event to route without persisting or delivering anything.
15#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
16pub struct SimulateRequest {
17    pub event: NotificationEvent,
18}
19
20/// The router plan plus the final per-recipient outcome.
21#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
22pub struct SimulateResponse {
23    pub plan: RoutePlan,
24    pub decisions: Vec<SimulatedRecipient>,
25}
26
27/// One recipient's simulated outcome; `attention: None` means withheld.
28#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
29pub struct SimulatedRecipient {
30    pub user: UserId,
31    pub attention: Option<Attention>,
32    pub reason: AttentionReason,
33    pub matched_rules: Vec<NotificationRuleId>,
34    pub withheld_reason: Option<String>,
35}