pidgr_proto/pidgr/v1/pidgr.v1.rs
1// @generated
2// This file is @generated by prost-build.
3// ─── Messages ───────────────────────────────────────────────────────────────
4
5/// Request to submit a user action on a delivered message.
6#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7pub struct SubmitActionRequest {
8 /// ID of the delivery the user is acting on.
9 /// Constraints: UUID format (36 characters).
10 #[prost(string, tag="1")]
11 pub delivery_id: ::prost::alloc::string::String,
12 /// ID of the action being performed (matches MessageAction.id).
13 /// Constraints: Max length 100 characters.
14 #[prost(string, tag="2")]
15 pub action_id: ::prost::alloc::string::String,
16 /// Optional action-specific payload (e.g. poll response data). Empty for ACK.
17 /// Constraints: Max size 10000 bytes.
18 #[prost(bytes="vec", tag="3")]
19 pub payload: ::prost::alloc::vec::Vec<u8>,
20}
21/// Response after submitting an action.
22#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
23pub struct SubmitActionResponse {
24 /// Whether the action was successfully recorded and forwarded to the workflow.
25 #[prost(bool, tag="1")]
26 pub success: bool,
27}
28// ─── Messages ───────────────────────────────────────────────────────────────
29
30/// A single channel dispatch event for the audit trail. Append-only; the
31/// receiver enforces idempotency on terminal states via a partial unique index
32/// on (campaign_id, recipient_user_id, channel, step_kind).
33#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
34pub struct ChannelEvent {
35 #[prost(string, tag="1")]
36 pub org_id: ::prost::alloc::string::String,
37 #[prost(string, tag="2")]
38 pub campaign_id: ::prost::alloc::string::String,
39 #[prost(string, tag="3")]
40 pub recipient_user_id: ::prost::alloc::string::String,
41 #[prost(enumeration="ChannelName", tag="4")]
42 pub channel: i32,
43 #[prost(enumeration="ChannelStepKind", tag="5")]
44 pub step_kind: i32,
45 #[prost(enumeration="ChannelEventStatus", tag="6")]
46 pub status: i32,
47 /// Set only when status = SKIPPED. UNSPECIFIED in all other cases.
48 #[prost(enumeration="ChannelSkipReason", tag="7")]
49 pub skip_reason: i32,
50 /// Provider's identifier for this dispatch. Empty for SKIPPED events.
51 #[prost(string, tag="8")]
52 pub provider_message_id: ::prost::alloc::string::String,
53 /// Cost in micros (1/1000000 of a USD). Zero for absorbed channels.
54 /// Negative is invalid.
55 #[prost(int64, tag="9")]
56 pub cost_micros: i64,
57 /// Free-form provider error payload on FAILED. JSON-encoded; opaque to
58 /// the platform.
59 #[prost(string, tag="10")]
60 pub metadata_json: ::prost::alloc::string::String,
61 #[prost(message, optional, tag="11")]
62 pub occurred_at: ::core::option::Option<::prost_types::Timestamp>,
63}
64#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
65pub struct RecordChannelEventRequest {
66 #[prost(message, optional, tag="1")]
67 pub event: ::core::option::Option<ChannelEvent>,
68}
69#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
70pub struct RecordChannelEventResponse {
71 /// True if the row was inserted. False if rejected as a duplicate of an
72 /// existing terminal-state row.
73 #[prost(bool, tag="1")]
74 pub accepted: bool,
75 /// "duplicate" when accepted=false and the partial unique index rejected
76 /// the insert. Empty when accepted=true.
77 #[prost(string, tag="2")]
78 pub reason: ::prost::alloc::string::String,
79}
80#[derive(Clone, PartialEq, ::prost::Message)]
81pub struct RecordChannelEventBatchRequest {
82 #[prost(message, repeated, tag="1")]
83 pub events: ::prost::alloc::vec::Vec<ChannelEvent>,
84}
85/// Per-event result inside a batch. Order matches the request's events list.
86#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
87pub struct RecordChannelEventBatchResult {
88 #[prost(bool, tag="1")]
89 pub accepted: bool,
90 #[prost(string, tag="2")]
91 pub reason: ::prost::alloc::string::String,
92}
93#[derive(Clone, PartialEq, ::prost::Message)]
94pub struct RecordChannelEventBatchResponse {
95 #[prost(message, repeated, tag="1")]
96 pub results: ::prost::alloc::vec::Vec<RecordChannelEventBatchResult>,
97}
98// ─── Enums ──────────────────────────────────────────────────────────────────
99
100/// Third-party notification channel for reminder + escalation dispatch.
101///
102/// Push is intentionally NOT in this enum. Push is the primary channel; it
103/// always fires alongside any third-party channels. The third-party channels
104/// here are additive. Channels carry only a deeplink notification — message
105/// content stays in the platform.
106#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
107#[repr(i32)]
108pub enum ChannelName {
109 Unspecified = 0,
110 Email = 1,
111 Webhook = 2,
112 Telegram = 3,
113 Slack = 4,
114 Sms = 5,
115 Whatsapp = 6,
116 MicrosoftTeams = 7,
117 Line = 8,
118 GoogleChat = 9,
119}
120impl ChannelName {
121 /// String value of the enum field names used in the ProtoBuf definition.
122 ///
123 /// The values are not transformed in any way and thus are considered stable
124 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
125 pub fn as_str_name(&self) -> &'static str {
126 match self {
127 Self::Unspecified => "CHANNEL_NAME_UNSPECIFIED",
128 Self::Email => "CHANNEL_NAME_EMAIL",
129 Self::Webhook => "CHANNEL_NAME_WEBHOOK",
130 Self::Telegram => "CHANNEL_NAME_TELEGRAM",
131 Self::Slack => "CHANNEL_NAME_SLACK",
132 Self::Sms => "CHANNEL_NAME_SMS",
133 Self::Whatsapp => "CHANNEL_NAME_WHATSAPP",
134 Self::MicrosoftTeams => "CHANNEL_NAME_MICROSOFT_TEAMS",
135 Self::Line => "CHANNEL_NAME_LINE",
136 Self::GoogleChat => "CHANNEL_NAME_GOOGLE_CHAT",
137 }
138 }
139 /// Creates an enum from field names used in the ProtoBuf definition.
140 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
141 match value {
142 "CHANNEL_NAME_UNSPECIFIED" => Some(Self::Unspecified),
143 "CHANNEL_NAME_EMAIL" => Some(Self::Email),
144 "CHANNEL_NAME_WEBHOOK" => Some(Self::Webhook),
145 "CHANNEL_NAME_TELEGRAM" => Some(Self::Telegram),
146 "CHANNEL_NAME_SLACK" => Some(Self::Slack),
147 "CHANNEL_NAME_SMS" => Some(Self::Sms),
148 "CHANNEL_NAME_WHATSAPP" => Some(Self::Whatsapp),
149 "CHANNEL_NAME_MICROSOFT_TEAMS" => Some(Self::MicrosoftTeams),
150 "CHANNEL_NAME_LINE" => Some(Self::Line),
151 "CHANNEL_NAME_GOOGLE_CHAT" => Some(Self::GoogleChat),
152 _ => None,
153 }
154 }
155}
156/// Workflow step kind that triggered the channel dispatch. Different step
157/// kinds for the same (campaign, recipient, channel) tuple are treated as
158/// distinct dispatch events for idempotency purposes.
159#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
160#[repr(i32)]
161pub enum ChannelStepKind {
162 Unspecified = 0,
163 Reminder = 1,
164 Escalation = 2,
165}
166impl ChannelStepKind {
167 /// String value of the enum field names used in the ProtoBuf definition.
168 ///
169 /// The values are not transformed in any way and thus are considered stable
170 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
171 pub fn as_str_name(&self) -> &'static str {
172 match self {
173 Self::Unspecified => "CHANNEL_STEP_KIND_UNSPECIFIED",
174 Self::Reminder => "CHANNEL_STEP_KIND_REMINDER",
175 Self::Escalation => "CHANNEL_STEP_KIND_ESCALATION",
176 }
177 }
178 /// Creates an enum from field names used in the ProtoBuf definition.
179 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
180 match value {
181 "CHANNEL_STEP_KIND_UNSPECIFIED" => Some(Self::Unspecified),
182 "CHANNEL_STEP_KIND_REMINDER" => Some(Self::Reminder),
183 "CHANNEL_STEP_KIND_ESCALATION" => Some(Self::Escalation),
184 _ => None,
185 }
186 }
187}
188/// Status of a channel dispatch attempt. The table is append-only — each state
189/// transition (e.g. SENT → DELIVERED via provider webhook) is its own row keyed
190/// off provider_message_id, not an UPDATE.
191#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
192#[repr(i32)]
193pub enum ChannelEventStatus {
194 Unspecified = 0,
195 Sent = 1,
196 Delivered = 2,
197 Opened = 3,
198 Clicked = 4,
199 Bounced = 5,
200 Failed = 6,
201 Skipped = 7,
202}
203impl ChannelEventStatus {
204 /// String value of the enum field names used in the ProtoBuf definition.
205 ///
206 /// The values are not transformed in any way and thus are considered stable
207 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
208 pub fn as_str_name(&self) -> &'static str {
209 match self {
210 Self::Unspecified => "CHANNEL_EVENT_STATUS_UNSPECIFIED",
211 Self::Sent => "CHANNEL_EVENT_STATUS_SENT",
212 Self::Delivered => "CHANNEL_EVENT_STATUS_DELIVERED",
213 Self::Opened => "CHANNEL_EVENT_STATUS_OPENED",
214 Self::Clicked => "CHANNEL_EVENT_STATUS_CLICKED",
215 Self::Bounced => "CHANNEL_EVENT_STATUS_BOUNCED",
216 Self::Failed => "CHANNEL_EVENT_STATUS_FAILED",
217 Self::Skipped => "CHANNEL_EVENT_STATUS_SKIPPED",
218 }
219 }
220 /// Creates an enum from field names used in the ProtoBuf definition.
221 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
222 match value {
223 "CHANNEL_EVENT_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
224 "CHANNEL_EVENT_STATUS_SENT" => Some(Self::Sent),
225 "CHANNEL_EVENT_STATUS_DELIVERED" => Some(Self::Delivered),
226 "CHANNEL_EVENT_STATUS_OPENED" => Some(Self::Opened),
227 "CHANNEL_EVENT_STATUS_CLICKED" => Some(Self::Clicked),
228 "CHANNEL_EVENT_STATUS_BOUNCED" => Some(Self::Bounced),
229 "CHANNEL_EVENT_STATUS_FAILED" => Some(Self::Failed),
230 "CHANNEL_EVENT_STATUS_SKIPPED" => Some(Self::Skipped),
231 _ => None,
232 }
233 }
234}
235/// Reason a dispatch was SKIPPED rather than attempted. Set when status is
236/// CHANNEL_EVENT_STATUS_SKIPPED; UNSPECIFIED otherwise.
237#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
238#[repr(i32)]
239pub enum ChannelSkipReason {
240 Unspecified = 0,
241 OptedOut = 1,
242 RegionBlocked = 2,
243 CostCapExceeded = 3,
244 NoIdentifier = 4,
245}
246impl ChannelSkipReason {
247 /// String value of the enum field names used in the ProtoBuf definition.
248 ///
249 /// The values are not transformed in any way and thus are considered stable
250 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
251 pub fn as_str_name(&self) -> &'static str {
252 match self {
253 Self::Unspecified => "CHANNEL_SKIP_REASON_UNSPECIFIED",
254 Self::OptedOut => "CHANNEL_SKIP_REASON_OPTED_OUT",
255 Self::RegionBlocked => "CHANNEL_SKIP_REASON_REGION_BLOCKED",
256 Self::CostCapExceeded => "CHANNEL_SKIP_REASON_COST_CAP_EXCEEDED",
257 Self::NoIdentifier => "CHANNEL_SKIP_REASON_NO_IDENTIFIER",
258 }
259 }
260 /// Creates an enum from field names used in the ProtoBuf definition.
261 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
262 match value {
263 "CHANNEL_SKIP_REASON_UNSPECIFIED" => Some(Self::Unspecified),
264 "CHANNEL_SKIP_REASON_OPTED_OUT" => Some(Self::OptedOut),
265 "CHANNEL_SKIP_REASON_REGION_BLOCKED" => Some(Self::RegionBlocked),
266 "CHANNEL_SKIP_REASON_COST_CAP_EXCEEDED" => Some(Self::CostCapExceeded),
267 "CHANNEL_SKIP_REASON_NO_IDENTIFIER" => Some(Self::NoIdentifier),
268 _ => None,
269 }
270 }
271}
272/// A named role within an organization with a set of permissions.
273#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
274pub struct Role {
275 /// Unique identifier for the role.
276 #[prost(string, tag="1")]
277 pub id: ::prost::alloc::string::String,
278 /// URL-safe slug (unique within the organization, e.g. "admin", "manager").
279 #[prost(string, tag="2")]
280 pub slug: ::prost::alloc::string::String,
281 /// Human-readable display name.
282 #[prost(string, tag="3")]
283 pub name: ::prost::alloc::string::String,
284 /// Whether this role was seeded by the system on organization creation.
285 #[prost(bool, tag="4")]
286 pub is_default: bool,
287 /// Permissions granted to users with this role.
288 #[prost(enumeration="Permission", repeated, tag="5")]
289 pub permissions: ::prost::alloc::vec::Vec<i32>,
290 /// Whether this role is system-managed and immutable (e.g. super_admin).
291 #[prost(bool, tag="6")]
292 pub is_system: bool,
293}
294// ─── Pagination ─────────────────────────────────────────────────────────────
295
296/// Cursor-based pagination parameters for list requests.
297#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
298pub struct Pagination {
299 /// Maximum number of items to return per page.
300 #[prost(int32, tag="1")]
301 pub page_size: i32,
302 /// Opaque token from a previous response to fetch the next page.
303 #[prost(string, tag="2")]
304 pub page_token: ::prost::alloc::string::String,
305}
306/// Pagination metadata returned alongside list responses.
307#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
308pub struct PaginationMeta {
309 /// Token to pass in the next request to get the following page. Empty if no more pages.
310 #[prost(string, tag="1")]
311 pub next_page_token: ::prost::alloc::string::String,
312 /// Total number of items matching the query (across all pages).
313 #[prost(int32, tag="2")]
314 pub total_count: i32,
315}
316// ─── Message & Action Model ─────────────────────────────────────────────────
317
318/// An action button attached to a message that a recipient can interact with.
319#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
320pub struct MessageAction {
321 /// Unique identifier for this action within the message.
322 #[prost(string, tag="1")]
323 pub id: ::prost::alloc::string::String,
324 /// The type of action (e.g. ACK).
325 #[prost(enumeration="ActionType", tag="2")]
326 pub r#type: i32,
327 /// Display label shown to the recipient (e.g. "Got it").
328 /// Constraints: Max length 50 characters.
329 #[prost(string, tag="3")]
330 pub label: ::prost::alloc::string::String,
331}
332/// Canonical message type used across rendering, inbox, and delivery.
333/// Represents the fully rendered content delivered to a recipient.
334#[derive(Clone, PartialEq, ::prost::Message)]
335pub struct Message {
336 /// SHA-256 hash of the rendered content, used as a content-addressable ID.
337 #[prost(string, tag="1")]
338 pub content_id: ::prost::alloc::string::String,
339 /// ID of the campaign this message belongs to.
340 #[prost(string, tag="2")]
341 pub campaign_id: ::prost::alloc::string::String,
342 /// Display name of the sender (e.g. organization or campaign name).
343 /// Constraints: Max length 200 characters.
344 #[prost(string, tag="3")]
345 pub sender_name: ::prost::alloc::string::String,
346 /// Short one-line summary shown in notification banners.
347 /// Constraints: Max length 500 characters.
348 #[prost(string, tag="4")]
349 pub summary: ::prost::alloc::string::String,
350 /// Preview text shown in inbox list views.
351 /// Constraints: Max length 500 characters.
352 #[prost(string, tag="5")]
353 pub preview: ::prost::alloc::string::String,
354 /// Full message body content.
355 /// Constraints: Max length 100000 characters.
356 #[prost(string, tag="6")]
357 pub body: ::prost::alloc::string::String,
358 /// Whether this message requires immediate attention from the recipient.
359 #[prost(bool, tag="7")]
360 pub critical: bool,
361 /// Actions available to the recipient (e.g. acknowledge button).
362 #[prost(message, repeated, tag="8")]
363 pub actions: ::prost::alloc::vec::Vec<MessageAction>,
364 /// Timestamp when the message was created.
365 #[prost(message, optional, tag="9")]
366 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
367 /// User-facing title of the message (resolved from campaign or template).
368 /// Constraints: Max length 200 characters.
369 #[prost(string, tag="10")]
370 pub title: ::prost::alloc::string::String,
371}
372// ─── Workflow Definition Model ──────────────────────────────────────────────
373
374/// A data-driven workflow represented as a directed acyclic graph (DAG) of steps.
375/// Defines the automation logic for a campaign's lifecycle.
376/// Backend MUST validate the graph is a DAG (no cycles) before execution.
377#[derive(Clone, PartialEq, ::prost::Message)]
378pub struct WorkflowDefinition {
379 /// Ordered list of steps in the workflow DAG.
380 /// Constraints: Max 100 steps. Backend MUST validate the graph is a DAG (no cycles).
381 #[prost(message, repeated, tag="1")]
382 pub steps: ::prost::alloc::vec::Vec<WorkflowStep>,
383}
384/// A single step in a workflow DAG with typed configuration and transitions.
385#[derive(Clone, PartialEq, ::prost::Message)]
386pub struct WorkflowStep {
387 /// Unique identifier for this step within the workflow.
388 #[prost(string, tag="1")]
389 pub id: ::prost::alloc::string::String,
390 /// The type of operation this step performs.
391 #[prost(enumeration="StepType", tag="2")]
392 pub r#type: i32,
393 /// Map of outcome labels to the next step ID (e.g. "completed" -> "step_3").
394 /// Constraints: Max 10 transitions per step.
395 #[prost(map="string, string", tag="7")]
396 pub transitions: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
397 /// Step-specific configuration — exactly one must be set, matching the type.
398 #[prost(oneof="workflow_step::Config", tags="3, 4, 5, 6, 8")]
399 pub config: ::core::option::Option<workflow_step::Config>,
400}
401/// Nested message and enum types in `WorkflowStep`.
402pub mod workflow_step {
403 /// Step-specific configuration — exactly one must be set, matching the type.
404 #[derive(Clone, PartialEq, ::prost::Oneof)]
405 pub enum Config {
406 /// Configuration for SEND_NOTIFICATION steps.
407 #[prost(message, tag="3")]
408 SendNotification(super::SendNotificationConfig),
409 /// Configuration for DEADLINE_CHECK steps.
410 #[prost(message, tag="4")]
411 DeadlineCheck(super::DeadlineCheckConfig),
412 /// Configuration for SEND_REMINDER steps.
413 #[prost(message, tag="5")]
414 SendReminder(super::SendReminderConfig),
415 /// Configuration for CALL_WEBHOOK steps.
416 #[prost(message, tag="6")]
417 CallWebhook(super::CallWebhookConfig),
418 /// Configuration for STEP_TYPE_ESCALATE steps.
419 #[prost(message, tag="8")]
420 EscalateConfig(super::EscalateConfig),
421 }
422}
423/// Configuration for a step that sends the initial push notification.
424#[derive(Clone, PartialEq, ::prost::Message)]
425pub struct SendNotificationConfig {
426 /// Notification delivery type (e.g. "push").
427 /// Constraints: Accepted values: "push". Max length 50 characters.
428 #[prost(string, tag="1")]
429 pub r#type: ::prost::alloc::string::String,
430 /// ID of the template to use for this step's notification.
431 /// Empty falls back to campaign-level template_id.
432 /// Constraints: Max length 36 characters (UUID).
433 #[prost(string, tag="2")]
434 pub template_id: ::prost::alloc::string::String,
435 /// Pinned template version for this step.
436 /// 0 falls back to campaign-level template_version.
437 #[prost(int32, tag="3")]
438 pub template_version: i32,
439 /// Display label for the action button (e.g. "Acknowledge", "Got it").
440 /// Constraints: Max length 50 characters.
441 #[prost(string, tag="4")]
442 pub action_label: ::prost::alloc::string::String,
443 /// Action type for this step's message button.
444 #[prost(enumeration="ActionType", tag="5")]
445 pub action_type: i32,
446 /// Values for custom-sourced template variables specific to this step.
447 /// Constraints: Max 100 entries. Key max length 100 characters, value max length 10000 characters.
448 #[prost(map="string, string", tag="6")]
449 pub custom_variables: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
450}
451/// Configuration for a deadline-based timer step that sleeps for a configured
452/// delay before proceeding. Acknowledgments happen independently at the delivery
453/// level and are evaluated by subsequent steps (e.g. SEND_REMINDER).
454#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
455pub struct DeadlineCheckConfig {
456 /// Duration string for the deadline delay (e.g. "120h", "72h").
457 /// Constraints: Valid range 1m to 8760h (1 year).
458 #[prost(string, tag="1")]
459 pub delay: ::prost::alloc::string::String,
460}
461/// Configuration for a step that sends a one-time reminder to non-responsive recipients.
462#[derive(Clone, PartialEq, ::prost::Message)]
463pub struct SendReminderConfig {
464 /// Reminder delivery type (e.g. "push").
465 /// Constraints: Accepted values: "push". Max length 50 characters.
466 #[prost(string, tag="1")]
467 pub r#type: ::prost::alloc::string::String,
468 /// Additional third-party channels to dispatch the reminder through
469 /// alongside the primary push notification. Empty = push-only behaviour
470 /// (the platform's historical default; no surprise for existing
471 /// workflows). Each entry produces an independent dispatch attempt
472 /// recorded in `channel_events`; per-org configuration in
473 /// pidgr-integrations decides which channels are eligible at runtime.
474 #[prost(enumeration="ChannelName", repeated, tag="4")]
475 pub third_party_channels: ::prost::alloc::vec::Vec<i32>,
476 /// Third parties to loop in when this reminder fires. Each resolved
477 /// target receives a passive inbox delivery (no action button) plus a
478 /// fan-out via the same `third_party_channels` list as the employee
479 /// reminder. The delivery auto-dismisses when the original recipient
480 /// acknowledges the campaign.
481 ///
482 /// Each entry reuses the existing `EscalationTarget` shape
483 /// (USER / GROUP / MANAGER / ROLE). When `type` is MANAGER, `target_id`
484 /// is empty and is resolved at runtime from the original recipient's
485 /// `manager_id`. Self-targets (resolved user_id == original recipient)
486 /// are dropped at dispatch time.
487 /// Constraints: Max 5 entries.
488 #[prost(message, repeated, tag="5")]
489 pub notify_targets: ::prost::alloc::vec::Vec<EscalationTarget>,
490}
491/// Configuration for a step that calls an external webhook.
492#[derive(Clone, PartialEq, ::prost::Message)]
493pub struct CallWebhookConfig {
494 /// Human-readable name for this webhook (for logging/display).
495 /// Constraints: Max length 200 characters.
496 #[prost(string, tag="1")]
497 pub name: ::prost::alloc::string::String,
498 /// URL to POST campaign context to.
499 /// Constraints: Max length 2048 characters.
500 /// Security: HTTPS required in production. Backend MUST reject private,
501 /// loopback, and link-local addresses to prevent SSRF attacks.
502 #[prost(string, tag="2")]
503 pub url: ::prost::alloc::string::String,
504 /// Additional HTTP headers to include in the webhook request.
505 /// Constraints: Max 20 entries. Key max length 200 characters, value max length 2000 characters.
506 #[prost(map="string, string", tag="3")]
507 pub headers: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
508}
509/// A target for escalation — who should be notified when escalation fires.
510#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
511pub struct EscalationTarget {
512 /// Type of target.
513 #[prost(enumeration="EscalationTargetType", tag="1")]
514 pub r#type: i32,
515 /// ID of the target (user_id, group_id, or role_id).
516 /// Empty for MANAGER type (resolved at runtime from recipient's manager_id).
517 #[prost(string, tag="2")]
518 pub target_id: ::prost::alloc::string::String,
519}
520/// Configuration for an escalation step in the workflow DAG.
521#[derive(Clone, PartialEq, ::prost::Message)]
522pub struct EscalateConfig {
523 /// Condition that triggers escalation.
524 #[prost(enumeration="EscalationCondition", tag="1")]
525 pub condition: i32,
526 /// Targets to notify when escalation fires.
527 #[prost(message, repeated, tag="2")]
528 pub targets: ::prost::alloc::vec::Vec<EscalationTarget>,
529 /// Number of times to repeat this escalation before moving to the next step.
530 /// Constraints: Max 5.
531 #[prost(int32, tag="3")]
532 pub repeat_count: i32,
533 /// Minutes between repeat attempts.
534 #[prost(int32, tag="4")]
535 pub repeat_interval_minutes: i32,
536 /// Behavior mode for this escalation. UNSPECIFIED is normalized to DELIVER.
537 #[prost(enumeration="EscalateMode", tag="5")]
538 pub mode: i32,
539 /// Additional third-party channels to dispatch the escalation through
540 /// alongside the primary push / delivery side effect. Empty = no
541 /// third-party fan-out (existing behaviour). Each entry produces an
542 /// independent dispatch attempt recorded in `channel_events`. ALERT_ONLY
543 /// and DELIVER modes both support third-party fan-out — the channel
544 /// adapters render the alert content from the campaign + a
545 /// mode-aware copy variant.
546 #[prost(enumeration="ChannelName", repeated, tag="6")]
547 pub third_party_channels: ::prost::alloc::vec::Vec<i32>,
548}
549// ─── Status Enums ───────────────────────────────────────────────────────────
550
551/// Lifecycle status of a campaign.
552#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
553#[repr(i32)]
554pub enum CampaignStatus {
555 /// Default value; not a valid status.
556 Unspecified = 0,
557 /// Campaign has been created but not yet started.
558 Created = 1,
559 /// Campaign is actively delivering messages and processing actions.
560 Running = 2,
561 /// All recipients have been processed; campaign is finished.
562 Completed = 3,
563 /// Campaign terminated due to an unrecoverable error.
564 Failed = 4,
565 /// Campaign was manually cancelled before completion.
566 Cancelled = 5,
567}
568impl CampaignStatus {
569 /// String value of the enum field names used in the ProtoBuf definition.
570 ///
571 /// The values are not transformed in any way and thus are considered stable
572 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
573 pub fn as_str_name(&self) -> &'static str {
574 match self {
575 Self::Unspecified => "CAMPAIGN_STATUS_UNSPECIFIED",
576 Self::Created => "CAMPAIGN_STATUS_CREATED",
577 Self::Running => "CAMPAIGN_STATUS_RUNNING",
578 Self::Completed => "CAMPAIGN_STATUS_COMPLETED",
579 Self::Failed => "CAMPAIGN_STATUS_FAILED",
580 Self::Cancelled => "CAMPAIGN_STATUS_CANCELLED",
581 }
582 }
583 /// Creates an enum from field names used in the ProtoBuf definition.
584 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
585 match value {
586 "CAMPAIGN_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
587 "CAMPAIGN_STATUS_CREATED" => Some(Self::Created),
588 "CAMPAIGN_STATUS_RUNNING" => Some(Self::Running),
589 "CAMPAIGN_STATUS_COMPLETED" => Some(Self::Completed),
590 "CAMPAIGN_STATUS_FAILED" => Some(Self::Failed),
591 "CAMPAIGN_STATUS_CANCELLED" => Some(Self::Cancelled),
592 _ => None,
593 }
594 }
595}
596/// Delivery status for a single message sent to a recipient.
597#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
598#[repr(i32)]
599pub enum DeliveryStatus {
600 /// Default value; not a valid status.
601 Unspecified = 0,
602 /// Message is queued but has not been sent yet.
603 Pending = 1,
604 /// Push notification was sent to the delivery provider.
605 Sent = 2,
606 /// Message was confirmed delivered to the device.
607 Delivered = 3,
608 /// Recipient completed the required action (e.g. acknowledged).
609 Acknowledged = 4,
610 /// Recipient did not act before the deadline.
611 Missed = 5,
612 /// Recipient has no registered device; delivery was skipped.
613 NoDevice = 6,
614 /// Delivery failed due to a provider or system error.
615 Failed = 7,
616}
617impl DeliveryStatus {
618 /// String value of the enum field names used in the ProtoBuf definition.
619 ///
620 /// The values are not transformed in any way and thus are considered stable
621 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
622 pub fn as_str_name(&self) -> &'static str {
623 match self {
624 Self::Unspecified => "DELIVERY_STATUS_UNSPECIFIED",
625 Self::Pending => "DELIVERY_STATUS_PENDING",
626 Self::Sent => "DELIVERY_STATUS_SENT",
627 Self::Delivered => "DELIVERY_STATUS_DELIVERED",
628 Self::Acknowledged => "DELIVERY_STATUS_ACKNOWLEDGED",
629 Self::Missed => "DELIVERY_STATUS_MISSED",
630 Self::NoDevice => "DELIVERY_STATUS_NO_DEVICE",
631 Self::Failed => "DELIVERY_STATUS_FAILED",
632 }
633 }
634 /// Creates an enum from field names used in the ProtoBuf definition.
635 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
636 match value {
637 "DELIVERY_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
638 "DELIVERY_STATUS_PENDING" => Some(Self::Pending),
639 "DELIVERY_STATUS_SENT" => Some(Self::Sent),
640 "DELIVERY_STATUS_DELIVERED" => Some(Self::Delivered),
641 "DELIVERY_STATUS_ACKNOWLEDGED" => Some(Self::Acknowledged),
642 "DELIVERY_STATUS_MISSED" => Some(Self::Missed),
643 "DELIVERY_STATUS_NO_DEVICE" => Some(Self::NoDevice),
644 "DELIVERY_STATUS_FAILED" => Some(Self::Failed),
645 _ => None,
646 }
647 }
648}
649/// Mobile platform for device registration.
650#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
651#[repr(i32)]
652pub enum Platform {
653 /// Default value; not a valid platform.
654 Unspecified = 0,
655 /// Apple iOS.
656 Ios = 1,
657 /// Google Android.
658 Android = 2,
659}
660impl Platform {
661 /// String value of the enum field names used in the ProtoBuf definition.
662 ///
663 /// The values are not transformed in any way and thus are considered stable
664 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
665 pub fn as_str_name(&self) -> &'static str {
666 match self {
667 Self::Unspecified => "PLATFORM_UNSPECIFIED",
668 Self::Ios => "PLATFORM_IOS",
669 Self::Android => "PLATFORM_ANDROID",
670 }
671 }
672 /// Creates an enum from field names used in the ProtoBuf definition.
673 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
674 match value {
675 "PLATFORM_UNSPECIFIED" => Some(Self::Unspecified),
676 "PLATFORM_IOS" => Some(Self::Ios),
677 "PLATFORM_ANDROID" => Some(Self::Android),
678 _ => None,
679 }
680 }
681}
682/// Granular permission for authorization checks.
683/// Stored in the database as enum names (e.g. "PERMISSION_ORG_READ").
684/// New values MUST be appended with the next sequential number; existing values
685/// MUST NOT be renumbered or removed (enforced by buf breaking).
686#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
687#[repr(i32)]
688pub enum Permission {
689 /// Default value; not a valid permission.
690 Unspecified = 0,
691 /// View organization settings.
692 OrgRead = 1,
693 /// Modify organization settings.
694 OrgWrite = 2,
695 /// View organization members.
696 MembersRead = 3,
697 /// Invite new users to the organization.
698 MembersInvite = 4,
699 /// Change user roles, deactivate users.
700 MembersManage = 5,
701 /// View campaigns and deliveries.
702 CampaignsRead = 6,
703 /// Create and edit campaigns.
704 CampaignsWrite = 7,
705 /// Start campaign execution.
706 CampaignsStart = 8,
707 /// View templates.
708 TemplatesRead = 9,
709 /// Create and edit templates.
710 TemplatesWrite = 10,
711 /// View inbox messages and deliveries.
712 InboxRead = 11,
713 /// Submit actions on deliveries.
714 InboxAct = 12,
715 /// View all groups in the organization.
716 GroupsAllRead = 13,
717 /// Create, edit, delete groups the caller created, manage own group membership.
718 GroupsWrite = 14,
719 /// Create, edit, delete any group in the organization, manage any group membership.
720 GroupsAllWrite = 15,
721 /// View all teams (organizational units) in the organization.
722 TeamsAllRead = 16,
723 /// Create, edit, delete teams the caller created, manage own team membership.
724 TeamsWrite = 17,
725 /// Create, edit, delete any team in the organization, manage any team membership.
726 TeamsAllWrite = 18,
727 /// View privacy requests (exports, deletions) for the organization.
728 PrivacyRead = 19,
729 /// Schedule deletions, export user data, restrict processing.
730 PrivacyWrite = 20,
731 /// View audit trail events for the organization.
732 AuditRead = 21,
733 /// Review and approve template translations.
734 TemplatesReview = 22,
735 /// Cross-organization read access for platform-level support operations.
736 /// Assignable only to roles within an ORG_TYPE_STAFF organization.
737 PlatformSupport = 23,
738 /// Manage platform access codes (generation, listing, revocation).
739 /// Assignable only to roles within an ORG_TYPE_STAFF organization.
740 PlatformAccessCodes = 24,
741 /// Provision and manage organizations at the platform level.
742 /// Assignable only to roles within an ORG_TYPE_STAFF organization.
743 PlatformProvision = 25,
744 /// Take abuse-response actions against organizations (suspend, revoke, quota overrides).
745 /// Assignable only to roles within an ORG_TYPE_STAFF organization.
746 PlatformAbuseResponse = 26,
747 /// Write subprocessor and compliance records at the platform level.
748 /// Assignable only to roles within an ORG_TYPE_STAFF organization.
749 PlatformComplianceWrite = 27,
750 /// Create synthetic (flagged) data on any org: seed resources and simulate
751 /// campaign outcomes. Assignable only to roles within an ORG_TYPE_STAFF organization.
752 PlatformSynthetic = 28,
753 /// Dispatch notifications to third-party channels (Slack, Telegram, webhook, etc.).
754 ChannelsDispatch = 29,
755 /// Create, update, or remove a member's third-party channel reachability.
756 ReachabilityWrite = 30,
757 /// Triage security incidents (list, classify, mark-notified) at the platform level.
758 /// Assignable only to roles within an ORG_TYPE_STAFF organization.
759 PlatformIncidents = 31,
760}
761impl Permission {
762 /// String value of the enum field names used in the ProtoBuf definition.
763 ///
764 /// The values are not transformed in any way and thus are considered stable
765 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
766 pub fn as_str_name(&self) -> &'static str {
767 match self {
768 Self::Unspecified => "PERMISSION_UNSPECIFIED",
769 Self::OrgRead => "PERMISSION_ORG_READ",
770 Self::OrgWrite => "PERMISSION_ORG_WRITE",
771 Self::MembersRead => "PERMISSION_MEMBERS_READ",
772 Self::MembersInvite => "PERMISSION_MEMBERS_INVITE",
773 Self::MembersManage => "PERMISSION_MEMBERS_MANAGE",
774 Self::CampaignsRead => "PERMISSION_CAMPAIGNS_READ",
775 Self::CampaignsWrite => "PERMISSION_CAMPAIGNS_WRITE",
776 Self::CampaignsStart => "PERMISSION_CAMPAIGNS_START",
777 Self::TemplatesRead => "PERMISSION_TEMPLATES_READ",
778 Self::TemplatesWrite => "PERMISSION_TEMPLATES_WRITE",
779 Self::InboxRead => "PERMISSION_INBOX_READ",
780 Self::InboxAct => "PERMISSION_INBOX_ACT",
781 Self::GroupsAllRead => "PERMISSION_GROUPS_ALL_READ",
782 Self::GroupsWrite => "PERMISSION_GROUPS_WRITE",
783 Self::GroupsAllWrite => "PERMISSION_GROUPS_ALL_WRITE",
784 Self::TeamsAllRead => "PERMISSION_TEAMS_ALL_READ",
785 Self::TeamsWrite => "PERMISSION_TEAMS_WRITE",
786 Self::TeamsAllWrite => "PERMISSION_TEAMS_ALL_WRITE",
787 Self::PrivacyRead => "PERMISSION_PRIVACY_READ",
788 Self::PrivacyWrite => "PERMISSION_PRIVACY_WRITE",
789 Self::AuditRead => "PERMISSION_AUDIT_READ",
790 Self::TemplatesReview => "PERMISSION_TEMPLATES_REVIEW",
791 Self::PlatformSupport => "PERMISSION_PLATFORM_SUPPORT",
792 Self::PlatformAccessCodes => "PERMISSION_PLATFORM_ACCESS_CODES",
793 Self::PlatformProvision => "PERMISSION_PLATFORM_PROVISION",
794 Self::PlatformAbuseResponse => "PERMISSION_PLATFORM_ABUSE_RESPONSE",
795 Self::PlatformComplianceWrite => "PERMISSION_PLATFORM_COMPLIANCE_WRITE",
796 Self::PlatformSynthetic => "PERMISSION_PLATFORM_SYNTHETIC",
797 Self::ChannelsDispatch => "PERMISSION_CHANNELS_DISPATCH",
798 Self::ReachabilityWrite => "PERMISSION_REACHABILITY_WRITE",
799 Self::PlatformIncidents => "PERMISSION_PLATFORM_INCIDENTS",
800 }
801 }
802 /// Creates an enum from field names used in the ProtoBuf definition.
803 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
804 match value {
805 "PERMISSION_UNSPECIFIED" => Some(Self::Unspecified),
806 "PERMISSION_ORG_READ" => Some(Self::OrgRead),
807 "PERMISSION_ORG_WRITE" => Some(Self::OrgWrite),
808 "PERMISSION_MEMBERS_READ" => Some(Self::MembersRead),
809 "PERMISSION_MEMBERS_INVITE" => Some(Self::MembersInvite),
810 "PERMISSION_MEMBERS_MANAGE" => Some(Self::MembersManage),
811 "PERMISSION_CAMPAIGNS_READ" => Some(Self::CampaignsRead),
812 "PERMISSION_CAMPAIGNS_WRITE" => Some(Self::CampaignsWrite),
813 "PERMISSION_CAMPAIGNS_START" => Some(Self::CampaignsStart),
814 "PERMISSION_TEMPLATES_READ" => Some(Self::TemplatesRead),
815 "PERMISSION_TEMPLATES_WRITE" => Some(Self::TemplatesWrite),
816 "PERMISSION_INBOX_READ" => Some(Self::InboxRead),
817 "PERMISSION_INBOX_ACT" => Some(Self::InboxAct),
818 "PERMISSION_GROUPS_ALL_READ" => Some(Self::GroupsAllRead),
819 "PERMISSION_GROUPS_WRITE" => Some(Self::GroupsWrite),
820 "PERMISSION_GROUPS_ALL_WRITE" => Some(Self::GroupsAllWrite),
821 "PERMISSION_TEAMS_ALL_READ" => Some(Self::TeamsAllRead),
822 "PERMISSION_TEAMS_WRITE" => Some(Self::TeamsWrite),
823 "PERMISSION_TEAMS_ALL_WRITE" => Some(Self::TeamsAllWrite),
824 "PERMISSION_PRIVACY_READ" => Some(Self::PrivacyRead),
825 "PERMISSION_PRIVACY_WRITE" => Some(Self::PrivacyWrite),
826 "PERMISSION_AUDIT_READ" => Some(Self::AuditRead),
827 "PERMISSION_TEMPLATES_REVIEW" => Some(Self::TemplatesReview),
828 "PERMISSION_PLATFORM_SUPPORT" => Some(Self::PlatformSupport),
829 "PERMISSION_PLATFORM_ACCESS_CODES" => Some(Self::PlatformAccessCodes),
830 "PERMISSION_PLATFORM_PROVISION" => Some(Self::PlatformProvision),
831 "PERMISSION_PLATFORM_ABUSE_RESPONSE" => Some(Self::PlatformAbuseResponse),
832 "PERMISSION_PLATFORM_COMPLIANCE_WRITE" => Some(Self::PlatformComplianceWrite),
833 "PERMISSION_PLATFORM_SYNTHETIC" => Some(Self::PlatformSynthetic),
834 "PERMISSION_CHANNELS_DISPATCH" => Some(Self::ChannelsDispatch),
835 "PERMISSION_REACHABILITY_WRITE" => Some(Self::ReachabilityWrite),
836 "PERMISSION_PLATFORM_INCIDENTS" => Some(Self::PlatformIncidents),
837 _ => None,
838 }
839 }
840}
841/// Type of action a recipient can perform on a message.
842#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
843#[repr(i32)]
844pub enum ActionType {
845 /// Default value; not a valid action type.
846 Unspecified = 0,
847 /// Simple acknowledgment — recipient confirms they received the message.
848 Ack = 1,
849}
850impl ActionType {
851 /// String value of the enum field names used in the ProtoBuf definition.
852 ///
853 /// The values are not transformed in any way and thus are considered stable
854 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
855 pub fn as_str_name(&self) -> &'static str {
856 match self {
857 Self::Unspecified => "ACTION_TYPE_UNSPECIFIED",
858 Self::Ack => "ACTION_TYPE_ACK",
859 }
860 }
861 /// Creates an enum from field names used in the ProtoBuf definition.
862 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
863 match value {
864 "ACTION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
865 "ACTION_TYPE_ACK" => Some(Self::Ack),
866 _ => None,
867 }
868 }
869}
870/// Type of step within a workflow definition DAG.
871#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
872#[repr(i32)]
873pub enum StepType {
874 /// Default value; not a valid step type.
875 Unspecified = 0,
876 /// Send the initial push notification to all recipients.
877 SendNotification = 1,
878 /// Sleep for a configurable deadline, then proceed to the next step.
879 DeadlineCheck = 2,
880 /// Send a follow-up reminder to recipients who have not acted.
881 SendReminder = 3,
882 /// Call an external webhook with campaign context.
883 CallWebhook = 4,
884 /// Mark unacknowledged deliveries (SENT/DELIVERED) as MISSED. No config required.
885 MarkMissed = 5,
886 /// Escalate unacknowledged deliveries to configured targets.
887 Escalate = 6,
888}
889impl StepType {
890 /// String value of the enum field names used in the ProtoBuf definition.
891 ///
892 /// The values are not transformed in any way and thus are considered stable
893 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
894 pub fn as_str_name(&self) -> &'static str {
895 match self {
896 Self::Unspecified => "STEP_TYPE_UNSPECIFIED",
897 Self::SendNotification => "STEP_TYPE_SEND_NOTIFICATION",
898 Self::DeadlineCheck => "STEP_TYPE_DEADLINE_CHECK",
899 Self::SendReminder => "STEP_TYPE_SEND_REMINDER",
900 Self::CallWebhook => "STEP_TYPE_CALL_WEBHOOK",
901 Self::MarkMissed => "STEP_TYPE_MARK_MISSED",
902 Self::Escalate => "STEP_TYPE_ESCALATE",
903 }
904 }
905 /// Creates an enum from field names used in the ProtoBuf definition.
906 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
907 match value {
908 "STEP_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
909 "STEP_TYPE_SEND_NOTIFICATION" => Some(Self::SendNotification),
910 "STEP_TYPE_DEADLINE_CHECK" => Some(Self::DeadlineCheck),
911 "STEP_TYPE_SEND_REMINDER" => Some(Self::SendReminder),
912 "STEP_TYPE_CALL_WEBHOOK" => Some(Self::CallWebhook),
913 "STEP_TYPE_MARK_MISSED" => Some(Self::MarkMissed),
914 "STEP_TYPE_ESCALATE" => Some(Self::Escalate),
915 _ => None,
916 }
917 }
918}
919/// Condition that must be met for an escalation to fire.
920#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
921#[repr(i32)]
922pub enum EscalationCondition {
923 Unspecified = 0,
924 /// Escalate if the delivery has not been acknowledged.
925 IfNotAcked = 1,
926 /// Escalate if the campaign is still open (even if some deliveries are acknowledged).
927 IfNotClosed = 2,
928}
929impl EscalationCondition {
930 /// String value of the enum field names used in the ProtoBuf definition.
931 ///
932 /// The values are not transformed in any way and thus are considered stable
933 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
934 pub fn as_str_name(&self) -> &'static str {
935 match self {
936 Self::Unspecified => "ESCALATION_CONDITION_UNSPECIFIED",
937 Self::IfNotAcked => "ESCALATION_CONDITION_IF_NOT_ACKED",
938 Self::IfNotClosed => "ESCALATION_CONDITION_IF_NOT_CLOSED",
939 }
940 }
941 /// Creates an enum from field names used in the ProtoBuf definition.
942 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
943 match value {
944 "ESCALATION_CONDITION_UNSPECIFIED" => Some(Self::Unspecified),
945 "ESCALATION_CONDITION_IF_NOT_ACKED" => Some(Self::IfNotAcked),
946 "ESCALATION_CONDITION_IF_NOT_CLOSED" => Some(Self::IfNotClosed),
947 _ => None,
948 }
949 }
950}
951/// Type of escalation target.
952#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
953#[repr(i32)]
954pub enum EscalationTargetType {
955 Unspecified = 0,
956 /// Escalate to a specific user by ID.
957 User = 1,
958 /// Escalate to all members of a group.
959 Group = 2,
960 /// Escalate to the recipient's direct manager (resolved from manager_id at runtime).
961 Manager = 3,
962 /// Escalate to all users with a specific role in the org.
963 Role = 4,
964}
965impl EscalationTargetType {
966 /// String value of the enum field names used in the ProtoBuf definition.
967 ///
968 /// The values are not transformed in any way and thus are considered stable
969 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
970 pub fn as_str_name(&self) -> &'static str {
971 match self {
972 Self::Unspecified => "ESCALATION_TARGET_TYPE_UNSPECIFIED",
973 Self::User => "ESCALATION_TARGET_TYPE_USER",
974 Self::Group => "ESCALATION_TARGET_TYPE_GROUP",
975 Self::Manager => "ESCALATION_TARGET_TYPE_MANAGER",
976 Self::Role => "ESCALATION_TARGET_TYPE_ROLE",
977 }
978 }
979 /// Creates an enum from field names used in the ProtoBuf definition.
980 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
981 match value {
982 "ESCALATION_TARGET_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
983 "ESCALATION_TARGET_TYPE_USER" => Some(Self::User),
984 "ESCALATION_TARGET_TYPE_GROUP" => Some(Self::Group),
985 "ESCALATION_TARGET_TYPE_MANAGER" => Some(Self::Manager),
986 "ESCALATION_TARGET_TYPE_ROLE" => Some(Self::Role),
987 _ => None,
988 }
989 }
990}
991/// Behavior mode controlling what an escalation produces for its targets.
992#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
993#[repr(i32)]
994pub enum EscalateMode {
995 /// Default value; servers normalize this to ESCALATE_MODE_DELIVER.
996 Unspecified = 0,
997 /// Targets receive a delivery for the campaign just like primary recipients.
998 Deliver = 1,
999 /// Targets receive an out-of-band alert only; no delivery is created.
1000 AlertOnly = 2,
1001}
1002impl EscalateMode {
1003 /// String value of the enum field names used in the ProtoBuf definition.
1004 ///
1005 /// The values are not transformed in any way and thus are considered stable
1006 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1007 pub fn as_str_name(&self) -> &'static str {
1008 match self {
1009 Self::Unspecified => "ESCALATE_MODE_UNSPECIFIED",
1010 Self::Deliver => "ESCALATE_MODE_DELIVER",
1011 Self::AlertOnly => "ESCALATE_MODE_ALERT_ONLY",
1012 }
1013 }
1014 /// Creates an enum from field names used in the ProtoBuf definition.
1015 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1016 match value {
1017 "ESCALATE_MODE_UNSPECIFIED" => Some(Self::Unspecified),
1018 "ESCALATE_MODE_DELIVER" => Some(Self::Deliver),
1019 "ESCALATE_MODE_ALERT_ONLY" => Some(Self::AlertOnly),
1020 _ => None,
1021 }
1022 }
1023}
1024// ─── Messages ───────────────────────────────────────────────────────────────
1025
1026/// A scoped API key for programmatic access (MCP agents, service integrations).
1027#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1028pub struct ApiKey {
1029 /// Unique identifier.
1030 #[prost(string, tag="1")]
1031 pub id: ::prost::alloc::string::String,
1032 /// Human-friendly label (e.g. "MCP Production", "CI Pipeline").
1033 #[prost(string, tag="2")]
1034 pub name: ::prost::alloc::string::String,
1035 /// Displayable prefix of the key (e.g. "pidgr_k_abc12345").
1036 /// Used for identification — the full key is only returned on creation.
1037 #[prost(string, tag="3")]
1038 pub key_prefix: ::prost::alloc::string::String,
1039 /// Permissions granted to this key.
1040 #[prost(enumeration="Permission", repeated, tag="4")]
1041 pub permissions: ::prost::alloc::vec::Vec<i32>,
1042 /// When the key was created.
1043 #[prost(message, optional, tag="5")]
1044 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
1045 /// Last time the key was used to authenticate a request. Empty if never used.
1046 #[prost(message, optional, tag="6")]
1047 pub last_used_at: ::core::option::Option<::prost_types::Timestamp>,
1048 /// When the key expires. Empty means no expiration.
1049 #[prost(message, optional, tag="7")]
1050 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
1051 /// Type of this key (API key or SCIM token).
1052 /// Defaults to KEY_TYPE_API_KEY for existing keys.
1053 #[prost(enumeration="KeyType", tag="8")]
1054 pub key_type: i32,
1055}
1056/// Request to create a new API key.
1057#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1058pub struct CreateApiKeyRequest {
1059 /// Human-friendly label. Required, max 200 characters.
1060 #[prost(string, tag="1")]
1061 pub name: ::prost::alloc::string::String,
1062 /// Permissions to grant. Required, at least one.
1063 /// PERMISSION_UNSPECIFIED values are rejected.
1064 #[prost(enumeration="Permission", repeated, tag="2")]
1065 pub permissions: ::prost::alloc::vec::Vec<i32>,
1066 /// Optional expiration time. If omitted, the key does not expire.
1067 #[prost(message, optional, tag="3")]
1068 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
1069 /// Type of key to create. Defaults to KEY_TYPE_API_KEY.
1070 /// SCIM tokens use the "pidgr_scim_" prefix instead of "pidgr_k_".
1071 #[prost(enumeration="KeyType", tag="4")]
1072 pub key_type: i32,
1073}
1074/// Response after creating an API key.
1075/// IMPORTANT: The full key is only returned here — it cannot be retrieved later.
1076#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1077pub struct CreateApiKeyResponse {
1078 /// The created API key metadata.
1079 #[prost(message, optional, tag="1")]
1080 pub api_key: ::core::option::Option<ApiKey>,
1081 /// The full secret key value (e.g. "pidgr_k_abc12345...").
1082 /// Store this securely — it is not retrievable after this response.
1083 #[prost(string, tag="2")]
1084 pub key: ::prost::alloc::string::String,
1085}
1086/// Request to list all API keys in the caller's organization.
1087#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1088pub struct ListApiKeysRequest {
1089 /// Optional filter by key type. Unspecified returns all keys.
1090 #[prost(enumeration="KeyType", tag="1")]
1091 pub key_type: i32,
1092}
1093/// Response containing the organization's API keys.
1094#[derive(Clone, PartialEq, ::prost::Message)]
1095pub struct ListApiKeysResponse {
1096 /// All active (non-revoked) API keys. Full key values are not included.
1097 #[prost(message, repeated, tag="1")]
1098 pub api_keys: ::prost::alloc::vec::Vec<ApiKey>,
1099}
1100/// Request to revoke an API key.
1101#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1102pub struct RevokeApiKeyRequest {
1103 /// ID of the API key to revoke. Required.
1104 #[prost(string, tag="1")]
1105 pub api_key_id: ::prost::alloc::string::String,
1106}
1107/// Response after revoking an API key.
1108#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1109pub struct RevokeApiKeyResponse {
1110}
1111// ─── Enums ──────────────────────────────────────────────────────────────────
1112
1113/// Type of API key, distinguishing platform keys from SCIM provisioning tokens.
1114#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1115#[repr(i32)]
1116pub enum KeyType {
1117 Unspecified = 0,
1118 ApiKey = 1,
1119 ScimToken = 2,
1120}
1121impl KeyType {
1122 /// String value of the enum field names used in the ProtoBuf definition.
1123 ///
1124 /// The values are not transformed in any way and thus are considered stable
1125 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1126 pub fn as_str_name(&self) -> &'static str {
1127 match self {
1128 Self::Unspecified => "KEY_TYPE_UNSPECIFIED",
1129 Self::ApiKey => "KEY_TYPE_API_KEY",
1130 Self::ScimToken => "KEY_TYPE_SCIM_TOKEN",
1131 }
1132 }
1133 /// Creates an enum from field names used in the ProtoBuf definition.
1134 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1135 match value {
1136 "KEY_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
1137 "KEY_TYPE_API_KEY" => Some(Self::ApiKey),
1138 "KEY_TYPE_SCIM_TOKEN" => Some(Self::ScimToken),
1139 _ => None,
1140 }
1141 }
1142}
1143// ─── Messages ───────────────────────────────────────────────────────────────
1144
1145/// Request to export all personal data associated with a user.
1146/// Auth: Requires JWT. Callable by the user themselves or an org admin.
1147#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1148pub struct ExportUserDataRequest {
1149 /// Internal user ID whose data is being exported.
1150 /// Constraints: UUID format (36 characters).
1151 #[prost(string, tag="1")]
1152 pub user_id: ::prost::alloc::string::String,
1153}
1154/// Response containing the export status and download location.
1155#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1156pub struct ExportUserDataResponse {
1157 /// Current status of the export request.
1158 #[prost(enumeration="PrivacyRequestStatus", tag="1")]
1159 pub status: i32,
1160 /// Pre-signed S3 URL to download the exported data (ZIP format).
1161 /// Only populated when status is COMPLETED.
1162 #[prost(string, tag="2")]
1163 pub result_url: ::prost::alloc::string::String,
1164 /// Unique identifier for this export request.
1165 /// Constraints: UUID format (36 characters).
1166 #[prost(string, tag="3")]
1167 pub export_id: ::prost::alloc::string::String,
1168}
1169/// Request to export all data associated with the calling organization
1170/// (GDPR Art. 20 data portability at the org level). The organization is
1171/// extracted from the JWT — it is never in the request message.
1172/// Auth: Requires JWT. Org admin only.
1173#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1174pub struct ExportOrgDataRequest {
1175}
1176/// Response containing the org export status and download location.
1177/// The export workflow assembles org configuration, users, campaigns,
1178/// deliveries, and audit events into an encrypted bundle delivered via a
1179/// pre-signed S3 URL.
1180#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1181pub struct ExportOrgDataResponse {
1182 /// Current status of the export request.
1183 #[prost(enumeration="PrivacyRequestStatus", tag="1")]
1184 pub status: i32,
1185 /// Pre-signed S3 URL to download the exported bundle (encrypted ZIP).
1186 /// Only populated when status is COMPLETED.
1187 #[prost(string, tag="2")]
1188 pub result_url: ::prost::alloc::string::String,
1189 /// Unique identifier for this export request.
1190 /// Constraints: UUID format (36 characters).
1191 #[prost(string, tag="3")]
1192 pub export_id: ::prost::alloc::string::String,
1193}
1194/// Request to delete or anonymize all personal data associated with a user.
1195/// Auth: Requires JWT. Admin only.
1196#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1197pub struct DeleteUserDataRequest {
1198 /// Internal user ID whose data is being deleted.
1199 /// Constraints: UUID format (36 characters).
1200 #[prost(string, tag="1")]
1201 pub user_id: ::prost::alloc::string::String,
1202 /// When true, PII is replaced with placeholders instead of hard-deleted.
1203 /// This preserves audit trail integrity while removing personal data.
1204 #[prost(bool, tag="2")]
1205 pub anonymize: bool,
1206}
1207/// Response confirming the deletion request.
1208#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1209pub struct DeleteUserDataResponse {
1210 /// Current status of the deletion request.
1211 #[prost(enumeration="PrivacyRequestStatus", tag="1")]
1212 pub status: i32,
1213 /// Timestamp when deletion was completed (or scheduled).
1214 /// Only populated when status is COMPLETED.
1215 #[prost(message, optional, tag="2")]
1216 pub deleted_at: ::core::option::Option<::prost_types::Timestamp>,
1217 /// Unique identifier for this deletion request.
1218 #[prost(string, tag="3")]
1219 pub request_id: ::prost::alloc::string::String,
1220}
1221/// Request to list privacy requests for the organization.
1222/// Auth: Requires JWT. Admin only.
1223#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1224pub struct ListPrivacyRequestsRequest {
1225 /// Maximum number of results per page.
1226 /// Constraints: 1–100, default 25.
1227 #[prost(int32, tag="1")]
1228 pub page_size: i32,
1229 /// Continuation token from a previous response.
1230 #[prost(string, tag="2")]
1231 pub page_token: ::prost::alloc::string::String,
1232 /// Filter by request type (export, delete, rectify, restrict). Empty = all.
1233 #[prost(string, tag="3")]
1234 pub request_type: ::prost::alloc::string::String,
1235 /// Filter by status. UNSPECIFIED = all.
1236 #[prost(enumeration="PrivacyRequestStatus", tag="4")]
1237 pub status: i32,
1238}
1239/// Response containing privacy requests.
1240#[derive(Clone, PartialEq, ::prost::Message)]
1241pub struct ListPrivacyRequestsResponse {
1242 /// The privacy requests matching the filters.
1243 #[prost(message, repeated, tag="1")]
1244 pub requests: ::prost::alloc::vec::Vec<PrivacyRequest>,
1245 /// Token for the next page. Empty if no more results.
1246 #[prost(string, tag="2")]
1247 pub next_page_token: ::prost::alloc::string::String,
1248}
1249/// A privacy request record.
1250#[derive(Clone, PartialEq, ::prost::Message)]
1251pub struct PrivacyRequest {
1252 /// Unique identifier.
1253 #[prost(string, tag="1")]
1254 pub id: ::prost::alloc::string::String,
1255 /// The user this request applies to.
1256 #[prost(string, tag="2")]
1257 pub user_id: ::prost::alloc::string::String,
1258 /// Email of the target user.
1259 #[prost(string, tag="3")]
1260 pub user_email: ::prost::alloc::string::String,
1261 /// Type of request (export, delete, rectify, restrict).
1262 #[prost(string, tag="4")]
1263 pub request_type: ::prost::alloc::string::String,
1264 /// Current status.
1265 #[prost(enumeration="PrivacyRequestStatus", tag="5")]
1266 pub status: i32,
1267 /// Whether to anonymize (true) or hard-delete (false). Only for delete requests.
1268 #[prost(bool, tag="6")]
1269 pub anonymize: bool,
1270 /// Email of the admin who initiated this request.
1271 #[prost(string, tag="7")]
1272 pub requested_by_email: ::prost::alloc::string::String,
1273 /// When the request was created.
1274 #[prost(message, optional, tag="8")]
1275 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
1276 /// When the request was completed (if applicable).
1277 #[prost(message, optional, tag="9")]
1278 pub completed_at: ::core::option::Option<::prost_types::Timestamp>,
1279 /// Additional metadata (JSON).
1280 #[prost(map="string, string", tag="10")]
1281 pub metadata: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
1282}
1283/// Request to cancel a pending deletion.
1284/// Auth: Requires JWT. Admin only.
1285#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1286pub struct CancelDeletionRequest {
1287 /// The privacy request ID to cancel.
1288 #[prost(string, tag="1")]
1289 pub request_id: ::prost::alloc::string::String,
1290 /// Admin must type the target user's email to confirm.
1291 #[prost(string, tag="2")]
1292 pub confirmation_email: ::prost::alloc::string::String,
1293}
1294/// Response confirming the cancellation.
1295#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1296pub struct CancelDeletionResponse {
1297 /// Updated status (should be FAILED with reason cancelled).
1298 #[prost(enumeration="PrivacyRequestStatus", tag="1")]
1299 pub status: i32,
1300}
1301/// Request to skip the grace period and delete immediately.
1302/// Auth: Requires JWT. Admin only.
1303#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1304pub struct ImmediateDeleteRequest {
1305 /// The privacy request ID to expedite.
1306 #[prost(string, tag="1")]
1307 pub request_id: ::prost::alloc::string::String,
1308 /// Admin must type the target user's email to confirm.
1309 #[prost(string, tag="2")]
1310 pub confirmation_email: ::prost::alloc::string::String,
1311}
1312/// Response confirming the immediate deletion was triggered.
1313#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1314pub struct ImmediateDeleteResponse {
1315 /// Updated status (should be PROCESSING).
1316 #[prost(enumeration="PrivacyRequestStatus", tag="1")]
1317 pub status: i32,
1318}
1319/// Request to correct personal data for a user.
1320/// Auth: Requires JWT. Callable by the user themselves or an org admin.
1321#[derive(Clone, PartialEq, ::prost::Message)]
1322pub struct RectifyUserDataRequest {
1323 /// Internal user ID whose data is being corrected.
1324 /// Constraints: UUID format (36 characters).
1325 #[prost(string, tag="1")]
1326 pub user_id: ::prost::alloc::string::String,
1327 /// Map of field names to corrected values.
1328 /// Corrections are propagated to all stored locations.
1329 /// Constraints: Max 50 corrections per request.
1330 #[prost(map="string, string", tag="2")]
1331 pub corrections: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
1332}
1333/// Response listing which fields were successfully corrected.
1334#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1335pub struct RectifyUserDataResponse {
1336 /// Names of fields that were rectified.
1337 #[prost(string, repeated, tag="1")]
1338 pub rectified_fields: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1339}
1340/// Request to restrict or unrestrict processing for a user.
1341/// Auth: Requires JWT. Admin only.
1342#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1343pub struct RestrictProcessingRequest {
1344 /// Internal user ID whose processing is being restricted.
1345 /// Constraints: UUID format (36 characters).
1346 #[prost(string, tag="1")]
1347 pub user_id: ::prost::alloc::string::String,
1348 /// When true, processing is restricted. When false, restriction is lifted.
1349 #[prost(bool, tag="2")]
1350 pub restricted: bool,
1351}
1352/// Response confirming the processing restriction status.
1353#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1354pub struct RestrictProcessingResponse {
1355 /// Current restriction status.
1356 #[prost(bool, tag="1")]
1357 pub restricted: bool,
1358 /// Timestamp when the restriction was applied or removed.
1359 #[prost(message, optional, tag="2")]
1360 pub restricted_at: ::core::option::Option<::prost_types::Timestamp>,
1361}
1362/// Request to confirm whether personal data exists for a user.
1363/// LGPD-specific: confirmação de existência (Art. 18, I).
1364/// Auth: Requires JWT. Admin only.
1365#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1366pub struct GetDataExistenceConfirmationRequest {
1367 /// Internal user ID to check.
1368 /// Constraints: UUID format (36 characters).
1369 #[prost(string, tag="1")]
1370 pub user_id: ::prost::alloc::string::String,
1371}
1372/// Response confirming data existence and listing data categories.
1373#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1374pub struct GetDataExistenceConfirmationResponse {
1375 /// Whether any personal data exists for this user.
1376 #[prost(bool, tag="1")]
1377 pub exists: bool,
1378 /// Categories of data stored (e.g., "profile", "deliveries", "analytics").
1379 #[prost(string, repeated, tag="2")]
1380 pub data_categories: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1381}
1382/// Request to list the calling user's own privacy requests.
1383/// Auth: Requires JWT. No admin permission required — returns only the caller's requests.
1384#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1385pub struct ListMyPrivacyRequestsRequest {
1386 /// Maximum number of results per page.
1387 /// Constraints: 1–100, default 25.
1388 #[prost(int32, tag="1")]
1389 pub page_size: i32,
1390 /// Continuation token from a previous response.
1391 #[prost(string, tag="2")]
1392 pub page_token: ::prost::alloc::string::String,
1393 /// Filter by request type (export, rectify). Empty = all.
1394 #[prost(string, tag="3")]
1395 pub request_type: ::prost::alloc::string::String,
1396 /// Filter by status. UNSPECIFIED = all.
1397 #[prost(enumeration="PrivacyRequestStatus", tag="4")]
1398 pub status: i32,
1399}
1400/// Response containing the calling user's privacy requests.
1401#[derive(Clone, PartialEq, ::prost::Message)]
1402pub struct ListMyPrivacyRequestsResponse {
1403 /// The privacy requests belonging to the calling user.
1404 #[prost(message, repeated, tag="1")]
1405 pub requests: ::prost::alloc::vec::Vec<PrivacyRequest>,
1406 /// Token for the next page. Empty if no more results.
1407 #[prost(string, tag="2")]
1408 pub next_page_token: ::prost::alloc::string::String,
1409}
1410/// A security incident that touched the calling organization. Org-facing
1411/// read-only subset of the staff-side incident record — internal triage
1412/// fields (detector signal, classifier identity, evidence pointers) are
1413/// intentionally not exposed.
1414#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1415pub struct OrgSecurityIncident {
1416 /// Unique identifier for the incident.
1417 /// Constraints: UUID format (36 characters).
1418 #[prost(string, tag="1")]
1419 pub id: ::prost::alloc::string::String,
1420 /// When the observability platform detected the incident. The canonical
1421 /// anchor for the 72-hour GDPR Art. 33 notification clock.
1422 #[prost(message, optional, tag="2")]
1423 pub detected_at: ::core::option::Option<::prost_types::Timestamp>,
1424 /// Detector-assigned severity.
1425 #[prost(enumeration="SecurityIncidentSeverity", tag="3")]
1426 pub severity: i32,
1427 /// Legal classification verdict. PENDING until staff triage completes.
1428 #[prost(enumeration="SecurityIncidentClassification", tag="4")]
1429 pub classification: i32,
1430 /// When the regulator was notified. Empty if no notification was required
1431 /// or it has not happened yet.
1432 #[prost(message, optional, tag="5")]
1433 pub notified_at: ::core::option::Option<::prost_types::Timestamp>,
1434 /// When the incident was resolved. Empty while still open.
1435 #[prost(message, optional, tag="6")]
1436 pub resolved_at: ::core::option::Option<::prost_types::Timestamp>,
1437}
1438/// Request to list security incidents that touched the calling organization.
1439/// The organization is extracted from the JWT — it is never in the request.
1440/// Auth: Requires JWT. Admin only.
1441#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1442pub struct ListOrgSecurityIncidentsRequest {
1443 /// Maximum number of results per page.
1444 /// Constraints: 1–100, default 25.
1445 #[prost(int32, tag="1")]
1446 pub page_size: i32,
1447 /// Continuation token from a previous response.
1448 #[prost(string, tag="2")]
1449 pub page_token: ::prost::alloc::string::String,
1450}
1451/// Response containing the organization's security incident feed.
1452#[derive(Clone, PartialEq, ::prost::Message)]
1453pub struct ListOrgSecurityIncidentsResponse {
1454 /// Incidents that touched the organization, ordered by detected_at
1455 /// descending (newest first).
1456 #[prost(message, repeated, tag="1")]
1457 pub incidents: ::prost::alloc::vec::Vec<OrgSecurityIncident>,
1458 /// Token for the next page. Empty if no more results.
1459 #[prost(string, tag="2")]
1460 pub next_page_token: ::prost::alloc::string::String,
1461}
1462// ─── Enums ──────────────────────────────────────────────────────────────────
1463
1464/// Status of a privacy request (export, delete, rectify, restrict).
1465#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1466#[repr(i32)]
1467pub enum PrivacyRequestStatus {
1468 /// Default value; should not be used explicitly.
1469 Unspecified = 0,
1470 /// Request has been created but not yet started.
1471 Pending = 1,
1472 /// Request is currently being processed.
1473 Processing = 2,
1474 /// Request completed successfully.
1475 Completed = 3,
1476 /// Request failed during processing.
1477 Failed = 4,
1478}
1479impl PrivacyRequestStatus {
1480 /// String value of the enum field names used in the ProtoBuf definition.
1481 ///
1482 /// The values are not transformed in any way and thus are considered stable
1483 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1484 pub fn as_str_name(&self) -> &'static str {
1485 match self {
1486 Self::Unspecified => "PRIVACY_REQUEST_STATUS_UNSPECIFIED",
1487 Self::Pending => "PRIVACY_REQUEST_STATUS_PENDING",
1488 Self::Processing => "PRIVACY_REQUEST_STATUS_PROCESSING",
1489 Self::Completed => "PRIVACY_REQUEST_STATUS_COMPLETED",
1490 Self::Failed => "PRIVACY_REQUEST_STATUS_FAILED",
1491 }
1492 }
1493 /// Creates an enum from field names used in the ProtoBuf definition.
1494 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1495 match value {
1496 "PRIVACY_REQUEST_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
1497 "PRIVACY_REQUEST_STATUS_PENDING" => Some(Self::Pending),
1498 "PRIVACY_REQUEST_STATUS_PROCESSING" => Some(Self::Processing),
1499 "PRIVACY_REQUEST_STATUS_COMPLETED" => Some(Self::Completed),
1500 "PRIVACY_REQUEST_STATUS_FAILED" => Some(Self::Failed),
1501 _ => None,
1502 }
1503 }
1504}
1505/// Detector-assigned severity of a security incident. Mirrors the staff-side
1506/// incident taxonomy; the org feed exposes the same values read-only.
1507#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1508#[repr(i32)]
1509pub enum SecurityIncidentSeverity {
1510 /// Default value; should not be used explicitly.
1511 Unspecified = 0,
1512 /// Informational signal; no action expected.
1513 Info = 1,
1514 /// Anomalous signal under investigation.
1515 Warn = 2,
1516 /// Confirmed or suspected breach-grade signal.
1517 Breach = 3,
1518}
1519impl SecurityIncidentSeverity {
1520 /// String value of the enum field names used in the ProtoBuf definition.
1521 ///
1522 /// The values are not transformed in any way and thus are considered stable
1523 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1524 pub fn as_str_name(&self) -> &'static str {
1525 match self {
1526 Self::Unspecified => "SECURITY_INCIDENT_SEVERITY_UNSPECIFIED",
1527 Self::Info => "SECURITY_INCIDENT_SEVERITY_INFO",
1528 Self::Warn => "SECURITY_INCIDENT_SEVERITY_WARN",
1529 Self::Breach => "SECURITY_INCIDENT_SEVERITY_BREACH",
1530 }
1531 }
1532 /// Creates an enum from field names used in the ProtoBuf definition.
1533 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1534 match value {
1535 "SECURITY_INCIDENT_SEVERITY_UNSPECIFIED" => Some(Self::Unspecified),
1536 "SECURITY_INCIDENT_SEVERITY_INFO" => Some(Self::Info),
1537 "SECURITY_INCIDENT_SEVERITY_WARN" => Some(Self::Warn),
1538 "SECURITY_INCIDENT_SEVERITY_BREACH" => Some(Self::Breach),
1539 _ => None,
1540 }
1541 }
1542}
1543/// Legal classification verdict recorded by platform staff during triage.
1544/// Mirrors the staff-side incident taxonomy; immutable once set.
1545#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1546#[repr(i32)]
1547pub enum SecurityIncidentClassification {
1548 /// Default value; should not be used explicitly.
1549 Unspecified = 0,
1550 /// Queued for triage; no verdict recorded yet.
1551 Pending = 1,
1552 /// Triage concluded the incident is not a breach.
1553 NotBreach = 2,
1554 /// Operational incident with no personal data involved.
1555 OperationalOnly = 10,
1556 /// Personal data breach (GDPR Art. 33 notification clock running).
1557 PersonalDataBreach = 11,
1558 /// Personal data breach with high risk to data subjects (GDPR Art. 34).
1559 PersonalDataBreachHighRisk = 12,
1560}
1561impl SecurityIncidentClassification {
1562 /// String value of the enum field names used in the ProtoBuf definition.
1563 ///
1564 /// The values are not transformed in any way and thus are considered stable
1565 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1566 pub fn as_str_name(&self) -> &'static str {
1567 match self {
1568 Self::Unspecified => "SECURITY_INCIDENT_CLASSIFICATION_UNSPECIFIED",
1569 Self::Pending => "SECURITY_INCIDENT_CLASSIFICATION_PENDING",
1570 Self::NotBreach => "SECURITY_INCIDENT_CLASSIFICATION_NOT_BREACH",
1571 Self::OperationalOnly => "SECURITY_INCIDENT_CLASSIFICATION_OPERATIONAL_ONLY",
1572 Self::PersonalDataBreach => "SECURITY_INCIDENT_CLASSIFICATION_PERSONAL_DATA_BREACH",
1573 Self::PersonalDataBreachHighRisk => "SECURITY_INCIDENT_CLASSIFICATION_PERSONAL_DATA_BREACH_HIGH_RISK",
1574 }
1575 }
1576 /// Creates an enum from field names used in the ProtoBuf definition.
1577 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1578 match value {
1579 "SECURITY_INCIDENT_CLASSIFICATION_UNSPECIFIED" => Some(Self::Unspecified),
1580 "SECURITY_INCIDENT_CLASSIFICATION_PENDING" => Some(Self::Pending),
1581 "SECURITY_INCIDENT_CLASSIFICATION_NOT_BREACH" => Some(Self::NotBreach),
1582 "SECURITY_INCIDENT_CLASSIFICATION_OPERATIONAL_ONLY" => Some(Self::OperationalOnly),
1583 "SECURITY_INCIDENT_CLASSIFICATION_PERSONAL_DATA_BREACH" => Some(Self::PersonalDataBreach),
1584 "SECURITY_INCIDENT_CLASSIFICATION_PERSONAL_DATA_BREACH_HIGH_RISK" => Some(Self::PersonalDataBreachHighRisk),
1585 _ => None,
1586 }
1587 }
1588}
1589// ─── Messages ───────────────────────────────────────────────────────────────
1590
1591/// An immutable audit event capturing a significant platform action.
1592/// Audit events are append-only — they cannot be updated or deleted.
1593#[derive(Clone, PartialEq, ::prost::Message)]
1594pub struct AuditEvent {
1595 /// Unique identifier for this audit event.
1596 /// Constraints: UUID format (36 characters).
1597 #[prost(string, tag="1")]
1598 pub id: ::prost::alloc::string::String,
1599 /// Organization in which the event occurred.
1600 /// Constraints: UUID format (36 characters).
1601 #[prost(string, tag="2")]
1602 pub org_id: ::prost::alloc::string::String,
1603 /// User who performed the action. Empty for system-initiated events.
1604 /// Constraints: UUID format (36 characters) when present.
1605 #[prost(string, tag="3")]
1606 pub actor_id: ::prost::alloc::string::String,
1607 /// Type of action that was performed.
1608 #[prost(enumeration="AuditEventType", tag="4")]
1609 pub event_type: i32,
1610 /// Type of entity affected (e.g., "campaign", "user", "template").
1611 /// Constraints: Max length 50 characters.
1612 #[prost(string, tag="5")]
1613 pub entity_type: ::prost::alloc::string::String,
1614 /// Identifier of the entity affected.
1615 /// Constraints: UUID format (36 characters).
1616 #[prost(string, tag="6")]
1617 pub entity_id: ::prost::alloc::string::String,
1618 /// Additional context about the event (e.g., old/new values for changes).
1619 /// Constraints: Max 20 key-value pairs, keys max 50 chars, values max 500 chars.
1620 #[prost(map="string, string", tag="7")]
1621 pub metadata: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
1622 /// True when this event is synthetic (artificially injected) data — used for
1623 /// demos, sandbox testing, or issue reproduction — rather than the record of
1624 /// a real user action.
1625 #[prost(bool, tag="8")]
1626 pub synthetic: bool,
1627 /// Timestamp when the event was recorded.
1628 #[prost(message, optional, tag="10")]
1629 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
1630}
1631/// Request to list audit events with optional filters.
1632/// Auth: Requires JWT. Admin only.
1633#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1634pub struct ListAuditEventsRequest {
1635 /// Pagination token from a previous response.
1636 #[prost(string, tag="1")]
1637 pub page_token: ::prost::alloc::string::String,
1638 /// Maximum number of events to return.
1639 /// Constraints: Min 1, max 100. Default 50.
1640 #[prost(int32, tag="2")]
1641 pub page_size: i32,
1642 /// Optional filter: only return events of this type.
1643 #[prost(enumeration="AuditEventType", tag="3")]
1644 pub event_type: i32,
1645 /// Optional filter: only return events by this actor.
1646 /// Constraints: UUID format (36 characters).
1647 #[prost(string, tag="4")]
1648 pub actor_id: ::prost::alloc::string::String,
1649 /// Optional filter: events after this timestamp (inclusive).
1650 #[prost(message, optional, tag="5")]
1651 pub start_time: ::core::option::Option<::prost_types::Timestamp>,
1652 /// Optional filter: events before this timestamp (exclusive).
1653 #[prost(message, optional, tag="6")]
1654 pub end_time: ::core::option::Option<::prost_types::Timestamp>,
1655}
1656/// Response containing a paginated list of audit events.
1657#[derive(Clone, PartialEq, ::prost::Message)]
1658pub struct ListAuditEventsResponse {
1659 /// Audit events matching the request filters.
1660 #[prost(message, repeated, tag="1")]
1661 pub events: ::prost::alloc::vec::Vec<AuditEvent>,
1662 /// Token for fetching the next page. Empty when no more events.
1663 #[prost(string, tag="2")]
1664 pub next_page_token: ::prost::alloc::string::String,
1665}
1666/// Request to export the audit trail to S3 in a specified format.
1667/// Auth: Requires JWT. Admin only.
1668#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1669pub struct ExportAuditTrailRequest {
1670 /// Export format.
1671 #[prost(enumeration="AuditExportFormat", tag="1")]
1672 pub format: i32,
1673 /// Optional: export events after this timestamp.
1674 #[prost(message, optional, tag="2")]
1675 pub start_time: ::core::option::Option<::prost_types::Timestamp>,
1676 /// Optional: export events before this timestamp.
1677 #[prost(message, optional, tag="3")]
1678 pub end_time: ::core::option::Option<::prost_types::Timestamp>,
1679}
1680/// Response containing the export download URL.
1681#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1682pub struct ExportAuditTrailResponse {
1683 /// Pre-signed S3 URL to download the exported audit trail.
1684 /// Only populated when status is COMPLETED.
1685 #[prost(string, tag="1")]
1686 pub export_url: ::prost::alloc::string::String,
1687 /// Current status of the export request.
1688 #[prost(enumeration="PrivacyRequestStatus", tag="2")]
1689 pub status: i32,
1690}
1691/// A persistent record of an audit trail export request.
1692#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1693pub struct AuditExport {
1694 /// Unique identifier.
1695 #[prost(string, tag="1")]
1696 pub id: ::prost::alloc::string::String,
1697 /// Export format (csv, json).
1698 #[prost(string, tag="2")]
1699 pub format: ::prost::alloc::string::String,
1700 /// Current status.
1701 #[prost(enumeration="PrivacyRequestStatus", tag="3")]
1702 pub status: i32,
1703 /// Pre-signed download URL. Only populated when status is COMPLETED.
1704 #[prost(string, tag="4")]
1705 pub result_url: ::prost::alloc::string::String,
1706 /// Error message if the export failed.
1707 #[prost(string, tag="5")]
1708 pub error_message: ::prost::alloc::string::String,
1709 /// Email of the admin who requested the export.
1710 #[prost(string, tag="6")]
1711 pub requested_by_email: ::prost::alloc::string::String,
1712 /// When the export was requested.
1713 #[prost(message, optional, tag="7")]
1714 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
1715 /// When the export completed (if applicable).
1716 #[prost(message, optional, tag="8")]
1717 pub completed_at: ::core::option::Option<::prost_types::Timestamp>,
1718}
1719/// Request to list audit export history.
1720/// Auth: Requires JWT. Admin only.
1721#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1722pub struct ListAuditExportsRequest {
1723}
1724/// Response containing the list of audit exports.
1725#[derive(Clone, PartialEq, ::prost::Message)]
1726pub struct ListAuditExportsResponse {
1727 /// Audit export records, newest first.
1728 #[prost(message, repeated, tag="1")]
1729 pub exports: ::prost::alloc::vec::Vec<AuditExport>,
1730}
1731/// Request to append a single audit event from an internal service.
1732///
1733/// Auth: INTERNAL-mTLS ONLY. Unlike the read-side RPCs which authenticate
1734/// via Cognito JWT and infer `org_id` from the caller's claim, this RPC is
1735/// invoked by sibling services (e.g. pidgr-integrations) over the internal
1736/// mTLS mesh and therefore carries `org_id` in the request payload. The
1737/// server MUST reject any caller presenting only a JWT.
1738#[derive(Clone, PartialEq, ::prost::Message)]
1739pub struct AppendRequest {
1740 /// String form of the event type. Sibling services use a stable string
1741 /// identifier (e.g. "REACHABILITY_UPSERT", "REACHABILITY_REMOVE") so a
1742 /// new event type does not require a coordinated proto release across
1743 /// every internal service before it can be recorded. The audit server
1744 /// is responsible for mapping the string into its internal taxonomy.
1745 #[prost(string, tag="1")]
1746 pub event_type: ::prost::alloc::string::String,
1747 /// Organization in which the event occurred. UUID.
1748 #[prost(string, tag="2")]
1749 pub org_id: ::prost::alloc::string::String,
1750 /// User the audit event is about, if applicable. UUID. Unset when the
1751 /// event is not subject-bound (e.g. an org-wide policy change).
1752 #[prost(string, optional, tag="3")]
1753 pub subject_user_id: ::core::option::Option<::prost::alloc::string::String>,
1754 /// Actor who initiated the action, if any. UUID. Unset for system-initiated
1755 /// or sibling-service-initiated events.
1756 #[prost(string, optional, tag="4")]
1757 pub actor_id: ::core::option::Option<::prost::alloc::string::String>,
1758 /// Structured event-specific payload. Used in lieu of the rigid
1759 /// `map<string, string> metadata` on `AuditEvent` so sibling services
1760 /// can record nested objects (e.g. a `prefetch_signals` block) without
1761 /// string-encoding every value. Servers SHOULD redact PII before persist
1762 /// and MUST NOT log this field at INFO or above. Sensitive cryptographic
1763 /// material (plaintext identifiers, envelope ciphertext, raw HMAC keys)
1764 /// MUST NOT be placed here.
1765 #[prost(message, optional, tag="5")]
1766 pub details: ::core::option::Option<::prost_types::Struct>,
1767}
1768#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1769pub struct AppendResponse {
1770 /// Server-assigned audit event identifier (UUID).
1771 #[prost(string, tag="1")]
1772 pub event_id: ::prost::alloc::string::String,
1773}
1774// ─── Enums ──────────────────────────────────────────────────────────────────
1775
1776/// Type of auditable platform action.
1777#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1778#[repr(i32)]
1779pub enum AuditEventType {
1780 /// Default value; should not be used explicitly.
1781 Unspecified = 0,
1782 /// ── Campaign lifecycle ───────────────────────────────────────────────────
1783 /// A campaign was created.
1784 CampaignCreated = 1,
1785 /// A message was sent to a recipient.
1786 MessageSent = 2,
1787 /// A message was opened by a recipient.
1788 MessageOpened = 3,
1789 /// A recipient acknowledged a campaign.
1790 AckRegistered = 4,
1791 /// An escalation was triggered by the workflow.
1792 EscalationExecuted = 5,
1793 /// A campaign was started.
1794 CampaignStarted = 12,
1795 /// A campaign was cancelled.
1796 CampaignCancelled = 13,
1797 /// A campaign was updated.
1798 CampaignUpdated = 14,
1799 /// ── User lifecycle ───────────────────────────────────────────────────────
1800 /// A user was invited to the organization.
1801 UserInvited = 6,
1802 /// A user was deactivated.
1803 UserDeactivated = 7,
1804 /// A user was reactivated.
1805 UserReactivated = 15,
1806 /// A user's role was changed (assigned to a different role).
1807 RoleChanged = 10,
1808 /// A user's invite was revoked.
1809 InviteRevoked = 16,
1810 /// A user's profile was updated.
1811 ProfileUpdated = 17,
1812 /// A user's settings were updated.
1813 SettingsUpdated = 18,
1814 /// A user enrolled a passkey.
1815 PasskeyEnrolled = 19,
1816 /// ── GDPR / Privacy ──────────────────────────────────────────────────────
1817 /// A data export was requested (GDPR Art. 15).
1818 DataExportRequested = 8,
1819 /// A data deletion was requested (GDPR Art. 17).
1820 DataDeletionRequested = 9,
1821 /// User data was rectified (GDPR Art. 16).
1822 DataRectified = 20,
1823 /// Data processing was restricted (GDPR Art. 18).
1824 ProcessingRestricted = 21,
1825 /// A scheduled deletion was cancelled.
1826 DeletionCancelled = 22,
1827 /// An immediate deletion was executed.
1828 DeletionImmediate = 23,
1829 /// ── Organization / SSO ───────────────────────────────────────────────────
1830 /// An SSO provider was configured.
1831 SsoConfigured = 11,
1832 /// An SSO provider was created.
1833 SsoProviderCreated = 24,
1834 /// An SSO provider was deleted.
1835 SsoProviderDeleted = 25,
1836 /// Organization settings were updated.
1837 OrgUpdated = 26,
1838 /// ── Roles ────────────────────────────────────────────────────────────────
1839 /// A role was created.
1840 RoleCreated = 27,
1841 /// A role's name or permissions were updated.
1842 RoleUpdated = 28,
1843 /// A role was deleted.
1844 RoleDeleted = 29,
1845 /// ── Templates ────────────────────────────────────────────────────────────
1846 /// A template was created.
1847 TemplateCreated = 30,
1848 /// A template was updated.
1849 TemplateUpdated = 31,
1850 /// ── API Keys ─────────────────────────────────────────────────────────────
1851 /// An API key was created.
1852 ApiKeyCreated = 32,
1853 /// An API key was revoked.
1854 ApiKeyRevoked = 33,
1855 /// ── Invite Links ─────────────────────────────────────────────────────────
1856 /// An invite link was created.
1857 InviteLinkCreated = 34,
1858 /// An invite link was revoked.
1859 InviteLinkRevoked = 35,
1860 /// ── Groups ───────────────────────────────────────────────────────────────
1861 /// A group was created.
1862 GroupCreated = 36,
1863 /// A group was updated.
1864 GroupUpdated = 37,
1865 /// A group was deleted.
1866 GroupDeleted = 38,
1867 /// Members were added to a group.
1868 GroupMembersAdded = 39,
1869 /// Members were removed from a group.
1870 GroupMembersRemoved = 40,
1871 /// ── Teams ────────────────────────────────────────────────────────────────
1872 /// A team was created.
1873 TeamCreated = 41,
1874 /// A team was updated.
1875 TeamUpdated = 42,
1876 /// A team was deleted.
1877 TeamDeleted = 43,
1878 /// Members were added to a team.
1879 TeamMembersAdded = 44,
1880 /// Members were removed from a team.
1881 TeamMembersRemoved = 45,
1882 /// ── SCIM Provisioning ───────────────────────────────────────────────────
1883 /// A user was provisioned via SCIM.
1884 ScimUserProvisioned = 46,
1885 /// A user was deprovisioned via SCIM.
1886 ScimUserDeprovisioned = 47,
1887 /// A user was updated via SCIM.
1888 ScimUserUpdated = 48,
1889 /// ── Translations ────────────────────────────────────────────────────────
1890 /// A template translation was created.
1891 TranslationCreated = 49,
1892 /// A template translation was approved.
1893 TranslationApproved = 50,
1894 /// ── Sandbox Orgs ────────────────────────────────────────────────────────
1895 /// A sandbox organization was created.
1896 SandboxCreated = 51,
1897 /// A sandbox organization expired and was deleted.
1898 SandboxExpired = 52,
1899 /// ── AI/Insights ─────────────────────────────────────────────────────────
1900 /// An AI prediction was served and logged (EU AI Act Art. 12).
1901 AiPredictionLogged = 53,
1902 /// The ML pipeline (archetype clustering + enrichment) was manually triggered.
1903 MlPipelineTriggered = 54,
1904 /// Per-group archetype clustering was manually triggered.
1905 ArchetypeClusteringTriggered = 55,
1906 /// ── Org lifecycle ───────────────────────────────────────────────────────
1907 /// An organization was created.
1908 OrgCreated = 56,
1909 /// An organization was deleted (sandbox cleanup or manual deletion).
1910 OrgDeleted = 57,
1911 /// ── Reachability registry (pidgr-integrations) ──────────────────────────
1912 /// A reachability identifier (email, phone, Slack ID, etc.) was upserted.
1913 /// GDPR-relevant per Chikorita audit classification.
1914 ReachabilityUpsert = 58,
1915 /// A reachability identifier was removed. GDPR Art. 17 "right to erasure"
1916 /// event; written BEFORE the registry row is deleted per Recital 30.
1917 ReachabilityRemove = 59,
1918}
1919impl AuditEventType {
1920 /// String value of the enum field names used in the ProtoBuf definition.
1921 ///
1922 /// The values are not transformed in any way and thus are considered stable
1923 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1924 pub fn as_str_name(&self) -> &'static str {
1925 match self {
1926 Self::Unspecified => "AUDIT_EVENT_TYPE_UNSPECIFIED",
1927 Self::CampaignCreated => "AUDIT_EVENT_TYPE_CAMPAIGN_CREATED",
1928 Self::MessageSent => "AUDIT_EVENT_TYPE_MESSAGE_SENT",
1929 Self::MessageOpened => "AUDIT_EVENT_TYPE_MESSAGE_OPENED",
1930 Self::AckRegistered => "AUDIT_EVENT_TYPE_ACK_REGISTERED",
1931 Self::EscalationExecuted => "AUDIT_EVENT_TYPE_ESCALATION_EXECUTED",
1932 Self::CampaignStarted => "AUDIT_EVENT_TYPE_CAMPAIGN_STARTED",
1933 Self::CampaignCancelled => "AUDIT_EVENT_TYPE_CAMPAIGN_CANCELLED",
1934 Self::CampaignUpdated => "AUDIT_EVENT_TYPE_CAMPAIGN_UPDATED",
1935 Self::UserInvited => "AUDIT_EVENT_TYPE_USER_INVITED",
1936 Self::UserDeactivated => "AUDIT_EVENT_TYPE_USER_DEACTIVATED",
1937 Self::UserReactivated => "AUDIT_EVENT_TYPE_USER_REACTIVATED",
1938 Self::RoleChanged => "AUDIT_EVENT_TYPE_ROLE_CHANGED",
1939 Self::InviteRevoked => "AUDIT_EVENT_TYPE_INVITE_REVOKED",
1940 Self::ProfileUpdated => "AUDIT_EVENT_TYPE_PROFILE_UPDATED",
1941 Self::SettingsUpdated => "AUDIT_EVENT_TYPE_SETTINGS_UPDATED",
1942 Self::PasskeyEnrolled => "AUDIT_EVENT_TYPE_PASSKEY_ENROLLED",
1943 Self::DataExportRequested => "AUDIT_EVENT_TYPE_DATA_EXPORT_REQUESTED",
1944 Self::DataDeletionRequested => "AUDIT_EVENT_TYPE_DATA_DELETION_REQUESTED",
1945 Self::DataRectified => "AUDIT_EVENT_TYPE_DATA_RECTIFIED",
1946 Self::ProcessingRestricted => "AUDIT_EVENT_TYPE_PROCESSING_RESTRICTED",
1947 Self::DeletionCancelled => "AUDIT_EVENT_TYPE_DELETION_CANCELLED",
1948 Self::DeletionImmediate => "AUDIT_EVENT_TYPE_DELETION_IMMEDIATE",
1949 Self::SsoConfigured => "AUDIT_EVENT_TYPE_SSO_CONFIGURED",
1950 Self::SsoProviderCreated => "AUDIT_EVENT_TYPE_SSO_PROVIDER_CREATED",
1951 Self::SsoProviderDeleted => "AUDIT_EVENT_TYPE_SSO_PROVIDER_DELETED",
1952 Self::OrgUpdated => "AUDIT_EVENT_TYPE_ORG_UPDATED",
1953 Self::RoleCreated => "AUDIT_EVENT_TYPE_ROLE_CREATED",
1954 Self::RoleUpdated => "AUDIT_EVENT_TYPE_ROLE_UPDATED",
1955 Self::RoleDeleted => "AUDIT_EVENT_TYPE_ROLE_DELETED",
1956 Self::TemplateCreated => "AUDIT_EVENT_TYPE_TEMPLATE_CREATED",
1957 Self::TemplateUpdated => "AUDIT_EVENT_TYPE_TEMPLATE_UPDATED",
1958 Self::ApiKeyCreated => "AUDIT_EVENT_TYPE_API_KEY_CREATED",
1959 Self::ApiKeyRevoked => "AUDIT_EVENT_TYPE_API_KEY_REVOKED",
1960 Self::InviteLinkCreated => "AUDIT_EVENT_TYPE_INVITE_LINK_CREATED",
1961 Self::InviteLinkRevoked => "AUDIT_EVENT_TYPE_INVITE_LINK_REVOKED",
1962 Self::GroupCreated => "AUDIT_EVENT_TYPE_GROUP_CREATED",
1963 Self::GroupUpdated => "AUDIT_EVENT_TYPE_GROUP_UPDATED",
1964 Self::GroupDeleted => "AUDIT_EVENT_TYPE_GROUP_DELETED",
1965 Self::GroupMembersAdded => "AUDIT_EVENT_TYPE_GROUP_MEMBERS_ADDED",
1966 Self::GroupMembersRemoved => "AUDIT_EVENT_TYPE_GROUP_MEMBERS_REMOVED",
1967 Self::TeamCreated => "AUDIT_EVENT_TYPE_TEAM_CREATED",
1968 Self::TeamUpdated => "AUDIT_EVENT_TYPE_TEAM_UPDATED",
1969 Self::TeamDeleted => "AUDIT_EVENT_TYPE_TEAM_DELETED",
1970 Self::TeamMembersAdded => "AUDIT_EVENT_TYPE_TEAM_MEMBERS_ADDED",
1971 Self::TeamMembersRemoved => "AUDIT_EVENT_TYPE_TEAM_MEMBERS_REMOVED",
1972 Self::ScimUserProvisioned => "AUDIT_EVENT_TYPE_SCIM_USER_PROVISIONED",
1973 Self::ScimUserDeprovisioned => "AUDIT_EVENT_TYPE_SCIM_USER_DEPROVISIONED",
1974 Self::ScimUserUpdated => "AUDIT_EVENT_TYPE_SCIM_USER_UPDATED",
1975 Self::TranslationCreated => "AUDIT_EVENT_TYPE_TRANSLATION_CREATED",
1976 Self::TranslationApproved => "AUDIT_EVENT_TYPE_TRANSLATION_APPROVED",
1977 Self::SandboxCreated => "AUDIT_EVENT_TYPE_SANDBOX_CREATED",
1978 Self::SandboxExpired => "AUDIT_EVENT_TYPE_SANDBOX_EXPIRED",
1979 Self::AiPredictionLogged => "AUDIT_EVENT_TYPE_AI_PREDICTION_LOGGED",
1980 Self::MlPipelineTriggered => "AUDIT_EVENT_TYPE_ML_PIPELINE_TRIGGERED",
1981 Self::ArchetypeClusteringTriggered => "AUDIT_EVENT_TYPE_ARCHETYPE_CLUSTERING_TRIGGERED",
1982 Self::OrgCreated => "AUDIT_EVENT_TYPE_ORG_CREATED",
1983 Self::OrgDeleted => "AUDIT_EVENT_TYPE_ORG_DELETED",
1984 Self::ReachabilityUpsert => "AUDIT_EVENT_TYPE_REACHABILITY_UPSERT",
1985 Self::ReachabilityRemove => "AUDIT_EVENT_TYPE_REACHABILITY_REMOVE",
1986 }
1987 }
1988 /// Creates an enum from field names used in the ProtoBuf definition.
1989 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1990 match value {
1991 "AUDIT_EVENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
1992 "AUDIT_EVENT_TYPE_CAMPAIGN_CREATED" => Some(Self::CampaignCreated),
1993 "AUDIT_EVENT_TYPE_MESSAGE_SENT" => Some(Self::MessageSent),
1994 "AUDIT_EVENT_TYPE_MESSAGE_OPENED" => Some(Self::MessageOpened),
1995 "AUDIT_EVENT_TYPE_ACK_REGISTERED" => Some(Self::AckRegistered),
1996 "AUDIT_EVENT_TYPE_ESCALATION_EXECUTED" => Some(Self::EscalationExecuted),
1997 "AUDIT_EVENT_TYPE_CAMPAIGN_STARTED" => Some(Self::CampaignStarted),
1998 "AUDIT_EVENT_TYPE_CAMPAIGN_CANCELLED" => Some(Self::CampaignCancelled),
1999 "AUDIT_EVENT_TYPE_CAMPAIGN_UPDATED" => Some(Self::CampaignUpdated),
2000 "AUDIT_EVENT_TYPE_USER_INVITED" => Some(Self::UserInvited),
2001 "AUDIT_EVENT_TYPE_USER_DEACTIVATED" => Some(Self::UserDeactivated),
2002 "AUDIT_EVENT_TYPE_USER_REACTIVATED" => Some(Self::UserReactivated),
2003 "AUDIT_EVENT_TYPE_ROLE_CHANGED" => Some(Self::RoleChanged),
2004 "AUDIT_EVENT_TYPE_INVITE_REVOKED" => Some(Self::InviteRevoked),
2005 "AUDIT_EVENT_TYPE_PROFILE_UPDATED" => Some(Self::ProfileUpdated),
2006 "AUDIT_EVENT_TYPE_SETTINGS_UPDATED" => Some(Self::SettingsUpdated),
2007 "AUDIT_EVENT_TYPE_PASSKEY_ENROLLED" => Some(Self::PasskeyEnrolled),
2008 "AUDIT_EVENT_TYPE_DATA_EXPORT_REQUESTED" => Some(Self::DataExportRequested),
2009 "AUDIT_EVENT_TYPE_DATA_DELETION_REQUESTED" => Some(Self::DataDeletionRequested),
2010 "AUDIT_EVENT_TYPE_DATA_RECTIFIED" => Some(Self::DataRectified),
2011 "AUDIT_EVENT_TYPE_PROCESSING_RESTRICTED" => Some(Self::ProcessingRestricted),
2012 "AUDIT_EVENT_TYPE_DELETION_CANCELLED" => Some(Self::DeletionCancelled),
2013 "AUDIT_EVENT_TYPE_DELETION_IMMEDIATE" => Some(Self::DeletionImmediate),
2014 "AUDIT_EVENT_TYPE_SSO_CONFIGURED" => Some(Self::SsoConfigured),
2015 "AUDIT_EVENT_TYPE_SSO_PROVIDER_CREATED" => Some(Self::SsoProviderCreated),
2016 "AUDIT_EVENT_TYPE_SSO_PROVIDER_DELETED" => Some(Self::SsoProviderDeleted),
2017 "AUDIT_EVENT_TYPE_ORG_UPDATED" => Some(Self::OrgUpdated),
2018 "AUDIT_EVENT_TYPE_ROLE_CREATED" => Some(Self::RoleCreated),
2019 "AUDIT_EVENT_TYPE_ROLE_UPDATED" => Some(Self::RoleUpdated),
2020 "AUDIT_EVENT_TYPE_ROLE_DELETED" => Some(Self::RoleDeleted),
2021 "AUDIT_EVENT_TYPE_TEMPLATE_CREATED" => Some(Self::TemplateCreated),
2022 "AUDIT_EVENT_TYPE_TEMPLATE_UPDATED" => Some(Self::TemplateUpdated),
2023 "AUDIT_EVENT_TYPE_API_KEY_CREATED" => Some(Self::ApiKeyCreated),
2024 "AUDIT_EVENT_TYPE_API_KEY_REVOKED" => Some(Self::ApiKeyRevoked),
2025 "AUDIT_EVENT_TYPE_INVITE_LINK_CREATED" => Some(Self::InviteLinkCreated),
2026 "AUDIT_EVENT_TYPE_INVITE_LINK_REVOKED" => Some(Self::InviteLinkRevoked),
2027 "AUDIT_EVENT_TYPE_GROUP_CREATED" => Some(Self::GroupCreated),
2028 "AUDIT_EVENT_TYPE_GROUP_UPDATED" => Some(Self::GroupUpdated),
2029 "AUDIT_EVENT_TYPE_GROUP_DELETED" => Some(Self::GroupDeleted),
2030 "AUDIT_EVENT_TYPE_GROUP_MEMBERS_ADDED" => Some(Self::GroupMembersAdded),
2031 "AUDIT_EVENT_TYPE_GROUP_MEMBERS_REMOVED" => Some(Self::GroupMembersRemoved),
2032 "AUDIT_EVENT_TYPE_TEAM_CREATED" => Some(Self::TeamCreated),
2033 "AUDIT_EVENT_TYPE_TEAM_UPDATED" => Some(Self::TeamUpdated),
2034 "AUDIT_EVENT_TYPE_TEAM_DELETED" => Some(Self::TeamDeleted),
2035 "AUDIT_EVENT_TYPE_TEAM_MEMBERS_ADDED" => Some(Self::TeamMembersAdded),
2036 "AUDIT_EVENT_TYPE_TEAM_MEMBERS_REMOVED" => Some(Self::TeamMembersRemoved),
2037 "AUDIT_EVENT_TYPE_SCIM_USER_PROVISIONED" => Some(Self::ScimUserProvisioned),
2038 "AUDIT_EVENT_TYPE_SCIM_USER_DEPROVISIONED" => Some(Self::ScimUserDeprovisioned),
2039 "AUDIT_EVENT_TYPE_SCIM_USER_UPDATED" => Some(Self::ScimUserUpdated),
2040 "AUDIT_EVENT_TYPE_TRANSLATION_CREATED" => Some(Self::TranslationCreated),
2041 "AUDIT_EVENT_TYPE_TRANSLATION_APPROVED" => Some(Self::TranslationApproved),
2042 "AUDIT_EVENT_TYPE_SANDBOX_CREATED" => Some(Self::SandboxCreated),
2043 "AUDIT_EVENT_TYPE_SANDBOX_EXPIRED" => Some(Self::SandboxExpired),
2044 "AUDIT_EVENT_TYPE_AI_PREDICTION_LOGGED" => Some(Self::AiPredictionLogged),
2045 "AUDIT_EVENT_TYPE_ML_PIPELINE_TRIGGERED" => Some(Self::MlPipelineTriggered),
2046 "AUDIT_EVENT_TYPE_ARCHETYPE_CLUSTERING_TRIGGERED" => Some(Self::ArchetypeClusteringTriggered),
2047 "AUDIT_EVENT_TYPE_ORG_CREATED" => Some(Self::OrgCreated),
2048 "AUDIT_EVENT_TYPE_ORG_DELETED" => Some(Self::OrgDeleted),
2049 "AUDIT_EVENT_TYPE_REACHABILITY_UPSERT" => Some(Self::ReachabilityUpsert),
2050 "AUDIT_EVENT_TYPE_REACHABILITY_REMOVE" => Some(Self::ReachabilityRemove),
2051 _ => None,
2052 }
2053 }
2054}
2055/// Format for audit trail export.
2056#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2057#[repr(i32)]
2058pub enum AuditExportFormat {
2059 /// Default value; should not be used explicitly.
2060 Unspecified = 0,
2061 /// Comma-separated values.
2062 Csv = 1,
2063 /// JSON lines format.
2064 Json = 2,
2065 /// Apache Parquet columnar format.
2066 Parquet = 3,
2067}
2068impl AuditExportFormat {
2069 /// String value of the enum field names used in the ProtoBuf definition.
2070 ///
2071 /// The values are not transformed in any way and thus are considered stable
2072 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2073 pub fn as_str_name(&self) -> &'static str {
2074 match self {
2075 Self::Unspecified => "AUDIT_EXPORT_FORMAT_UNSPECIFIED",
2076 Self::Csv => "AUDIT_EXPORT_FORMAT_CSV",
2077 Self::Json => "AUDIT_EXPORT_FORMAT_JSON",
2078 Self::Parquet => "AUDIT_EXPORT_FORMAT_PARQUET",
2079 }
2080 }
2081 /// Creates an enum from field names used in the ProtoBuf definition.
2082 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2083 match value {
2084 "AUDIT_EXPORT_FORMAT_UNSPECIFIED" => Some(Self::Unspecified),
2085 "AUDIT_EXPORT_FORMAT_CSV" => Some(Self::Csv),
2086 "AUDIT_EXPORT_FORMAT_JSON" => Some(Self::Json),
2087 "AUDIT_EXPORT_FORMAT_PARQUET" => Some(Self::Parquet),
2088 _ => None,
2089 }
2090 }
2091}
2092// ─── Messages ─────────────────────────────────────────────────────────────────
2093
2094/// Request to resolve the effective permission set for one principal.
2095#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2096pub struct ResolvePrincipalPermissionsRequest {
2097 /// UUID of the subject whose permissions are being resolved (user or
2098 /// principal identifier).
2099 #[prost(string, tag="1")]
2100 pub subject: ::prost::alloc::string::String,
2101 /// Organization the resolution is scoped to.
2102 #[prost(string, tag="2")]
2103 pub org_id: ::prost::alloc::string::String,
2104 /// Kind of principal identified by `subject`.
2105 #[prost(enumeration="PrincipalType", tag="3")]
2106 pub principal_type: i32,
2107}
2108/// Effective permissions resolved for the requested principal.
2109#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2110pub struct ResolvePrincipalPermissionsResponse {
2111 /// Flattened, deduplicated set of permissions granted to the principal in
2112 /// the requested organization. Empty when the principal has no grants.
2113 #[prost(enumeration="Permission", repeated, tag="1")]
2114 pub permissions: ::prost::alloc::vec::Vec<i32>,
2115}
2116// ─── Enums ──────────────────────────────────────────────────────────────────
2117
2118/// Kind of principal whose permissions are being resolved.
2119#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2120#[repr(i32)]
2121pub enum PrincipalType {
2122 Unspecified = 0,
2123 /// An end user identified by their user UUID, scoped to one organization.
2124 User = 1,
2125 /// An organization acting as its own principal (e.g. a service identity
2126 /// operating on behalf of the whole org rather than a member).
2127 Org = 2,
2128 /// A platform staff principal whose permissions derive from a role within
2129 /// the ORG_TYPE_STAFF organization.
2130 Staff = 3,
2131}
2132impl PrincipalType {
2133 /// String value of the enum field names used in the ProtoBuf definition.
2134 ///
2135 /// The values are not transformed in any way and thus are considered stable
2136 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2137 pub fn as_str_name(&self) -> &'static str {
2138 match self {
2139 Self::Unspecified => "PRINCIPAL_TYPE_UNSPECIFIED",
2140 Self::User => "PRINCIPAL_TYPE_USER",
2141 Self::Org => "PRINCIPAL_TYPE_ORG",
2142 Self::Staff => "PRINCIPAL_TYPE_STAFF",
2143 }
2144 }
2145 /// Creates an enum from field names used in the ProtoBuf definition.
2146 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2147 match value {
2148 "PRINCIPAL_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
2149 "PRINCIPAL_TYPE_USER" => Some(Self::User),
2150 "PRINCIPAL_TYPE_ORG" => Some(Self::Org),
2151 "PRINCIPAL_TYPE_STAFF" => Some(Self::Staff),
2152 _ => None,
2153 }
2154 }
2155}
2156// ─── Messages ───────────────────────────────────────────────────────────────
2157
2158/// A campaign that delivers structured messages to a set of recipients
2159/// and tracks their engagement through a workflow.
2160#[derive(Clone, PartialEq, ::prost::Message)]
2161pub struct Campaign {
2162 /// Unique identifier for the campaign.
2163 /// Constraints: UUID format (36 characters).
2164 #[prost(string, tag="1")]
2165 pub id: ::prost::alloc::string::String,
2166 /// Human-readable campaign name.
2167 /// Constraints: Max length 200 characters.
2168 #[prost(string, tag="2")]
2169 pub name: ::prost::alloc::string::String,
2170 /// ID of the template used to render messages.
2171 /// Constraints: UUID format (36 characters).
2172 #[prost(string, tag="3")]
2173 pub template_id: ::prost::alloc::string::String,
2174 /// Pinned version of the template used for this campaign.
2175 #[prost(int32, tag="4")]
2176 pub template_version: i32,
2177 /// Object storage reference to the audience snapshot taken at campaign creation.
2178 #[prost(string, tag="5")]
2179 pub audience_snapshot_ref: ::prost::alloc::string::String,
2180 /// Current lifecycle status of the campaign.
2181 #[prost(enumeration="CampaignStatus", tag="6")]
2182 pub status: i32,
2183 /// Workflow DAG that drives the campaign's automation logic.
2184 #[prost(message, optional, tag="7")]
2185 pub workflow: ::core::option::Option<WorkflowDefinition>,
2186 /// Total number of recipients in the audience snapshot.
2187 #[prost(int32, tag="8")]
2188 pub total_recipients: i32,
2189 /// Number of recipients who completed the required action.
2190 #[prost(int32, tag="9")]
2191 pub action_completed_count: i32,
2192 /// Number of recipients who did not act before the deadline.
2193 #[prost(int32, tag="10")]
2194 pub missed_count: i32,
2195 /// Timestamp when the campaign was created.
2196 #[prost(message, optional, tag="11")]
2197 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
2198 /// Timestamp when the campaign was started (workflow execution began).
2199 #[prost(message, optional, tag="12")]
2200 pub started_at: ::core::option::Option<::prost_types::Timestamp>,
2201 /// Timestamp when the campaign finished (completed, failed, or cancelled).
2202 #[prost(message, optional, tag="13")]
2203 pub completed_at: ::core::option::Option<::prost_types::Timestamp>,
2204 /// Display name of the sender shown to recipients (e.g. "HR Team").
2205 /// Constraints: Max length 200 characters.
2206 #[prost(string, tag="14")]
2207 pub sender_name: ::prost::alloc::string::String,
2208 /// Optional user-facing title override. If set, takes precedence over the template title.
2209 /// Constraints: Max length 200 characters.
2210 #[prost(string, tag="15")]
2211 pub title: ::prost::alloc::string::String,
2212 /// Whether this campaign's notifications break through Do Not Disturb / Focus mode.
2213 #[prost(bool, tag="16")]
2214 pub critical: bool,
2215 /// Optional locale override for all recipients in this campaign.
2216 /// When set, all recipients receive the campaign in this locale regardless of
2217 /// their preferred_locale. Empty means per-recipient locale resolution.
2218 /// Valid values: en, es, pt-BR, zh, ja.
2219 #[prost(string, tag="17")]
2220 pub default_locale: ::prost::alloc::string::String,
2221 /// Whether the campaign deadline waits for users without registered devices.
2222 /// When true, NO_DEVICE users remain in pending_count and can acknowledge
2223 /// via inbox after installing the app. Default false preserves current behavior.
2224 #[prost(bool, tag="18")]
2225 pub wait_for_enrollment: bool,
2226 /// Optional. Set when the campaign was created from a Compass archetype CTA.
2227 /// Drives post-campaign archetype-response analytics.
2228 #[prost(message, optional, tag="19")]
2229 pub originating_archetype: ::core::option::Option<CampaignOriginatingArchetype>,
2230 /// True when this campaign contains synthetic (artificially injected) data —
2231 /// created or populated for demos, sandbox testing, or issue reproduction.
2232 #[prost(bool, tag="20")]
2233 pub synthetic: bool,
2234 /// Number of recipients frozen in the audience snapshot at creation time.
2235 /// Unlike total_recipients (which counts deliveries and is 0 until the
2236 /// campaign starts), this is known as soon as the campaign exists.
2237 /// 0 when the campaign predates snapshot-size tracking.
2238 #[prost(int32, tag="21")]
2239 pub audience_snapshot_size: i32,
2240 /// Number of members currently eligible for this campaign's audience,
2241 /// computed at read time. Compare with audience_snapshot_size to see how far
2242 /// the frozen audience has drifted from the present membership.
2243 #[prost(int32, tag="22")]
2244 pub current_audience_size: i32,
2245 /// True when the frozen audience no longer covers the current eligible
2246 /// membership (current_audience_size > audience_snapshot_size). Clients
2247 /// should surface this before the campaign is started: recipients added
2248 /// after creation are NOT reached unless the campaign is recreated.
2249 #[prost(bool, tag="23")]
2250 pub audience_snapshot_stale: bool,
2251}
2252/// Identifies the archetype that motivated the creation of a campaign.
2253/// The audience is NOT filtered by archetype membership — this is metadata
2254/// about the campaign's authoring intent only. See OpenSpec change
2255/// archetype-targeted-campaign-cta.
2256#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2257pub struct CampaignOriginatingArchetype {
2258 /// UUID of the group whose archetype set the label belongs to.
2259 #[prost(string, tag="1")]
2260 pub group_id: ::prost::alloc::string::String,
2261 /// Stable archetype label (e.g., "Swift Acknowledger"). Labels are stable
2262 /// across clustering retrains; archetype IDs are not.
2263 #[prost(string, tag="2")]
2264 pub archetype_label: ::prost::alloc::string::String,
2265}
2266/// A single audience member with optional per-user template variables.
2267#[derive(Clone, PartialEq, ::prost::Message)]
2268pub struct AudienceMember {
2269 /// User ID (UUID).
2270 #[prost(string, tag="1")]
2271 pub user_id: ::prost::alloc::string::String,
2272 /// Template variable values for this user (e.g. {"name": "Alice"}).
2273 #[prost(map="string, string", tag="2")]
2274 pub variables: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
2275}
2276/// Request to create a new campaign.
2277#[derive(Clone, PartialEq, ::prost::Message)]
2278pub struct CreateCampaignRequest {
2279 /// Human-readable campaign name (admin-facing label).
2280 /// Constraints: Max length 200 characters.
2281 #[prost(string, tag="1")]
2282 pub name: ::prost::alloc::string::String,
2283 /// ID of the template to use for rendering messages.
2284 /// Constraints: UUID format (36 characters).
2285 #[prost(string, tag="2")]
2286 pub template_id: ::prost::alloc::string::String,
2287 /// Version of the template to pin for this campaign.
2288 #[prost(int32, tag="3")]
2289 pub template_version: i32,
2290 /// List of user IDs that form the campaign audience.
2291 /// Constraints: Max 100000 items.
2292 #[prost(string, repeated, tag="4")]
2293 pub user_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2294 /// Workflow DAG defining the campaign's automation steps.
2295 /// Required: CreateCampaign rejects a request with no workflow
2296 /// (INVALID_ARGUMENT) and does not substitute a default. The definition
2297 /// MUST validate as an acyclic graph of well-formed steps.
2298 #[prost(message, optional, tag="5")]
2299 pub workflow: ::core::option::Option<WorkflowDefinition>,
2300 /// Display name of the sender shown to recipients (e.g. "HR Team").
2301 /// Constraints: Max length 200 characters.
2302 #[prost(string, tag="6")]
2303 pub sender_name: ::prost::alloc::string::String,
2304 /// Optional user-facing title override. If empty, the template title is used.
2305 /// Constraints: Max length 200 characters.
2306 #[prost(string, tag="7")]
2307 pub title: ::prost::alloc::string::String,
2308 /// Rich audience with per-user template variables.
2309 /// When set, takes precedence over user_ids.
2310 /// Constraints: Max 100000 items.
2311 #[prost(message, repeated, tag="8")]
2312 pub audience: ::prost::alloc::vec::Vec<AudienceMember>,
2313 /// Whether to include users with processing_restricted=true in the audience.
2314 /// Default false: restricted users are excluded. Set true only with Art. 18(2) legal basis.
2315 #[prost(bool, tag="9")]
2316 pub include_restricted: bool,
2317 /// Whether this campaign's notifications break through Do Not Disturb / Focus mode.
2318 #[prost(bool, tag="10")]
2319 pub critical: bool,
2320 /// Optional locale override for all recipients.
2321 #[prost(string, tag="11")]
2322 pub default_locale: ::prost::alloc::string::String,
2323 /// Whether the campaign deadline should wait for users without registered devices.
2324 /// When true, NO_DEVICE users are not decremented from pending_count,
2325 /// allowing them to acknowledge via inbox after installing the app.
2326 #[prost(bool, tag="12")]
2327 pub wait_for_enrollment: bool,
2328 /// Optional. Set when the campaign is created from a Compass archetype CTA.
2329 /// The server validates the caller has access to group_id and that
2330 /// archetype_label exists in the group's current archetype set; cross-org
2331 /// group_id returns PERMISSION_DENIED, unknown label returns NOT_FOUND.
2332 #[prost(message, optional, tag="13")]
2333 pub originating_archetype: ::core::option::Option<CampaignOriginatingArchetype>,
2334}
2335/// Response after creating a campaign.
2336#[derive(Clone, PartialEq, ::prost::Message)]
2337pub struct CreateCampaignResponse {
2338 /// The newly created campaign.
2339 #[prost(message, optional, tag="1")]
2340 pub campaign: ::core::option::Option<Campaign>,
2341}
2342/// Request to start a campaign's workflow execution.
2343#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2344pub struct StartCampaignRequest {
2345 /// ID of the campaign to start.
2346 /// Constraints: UUID format (36 characters).
2347 #[prost(string, tag="1")]
2348 pub campaign_id: ::prost::alloc::string::String,
2349}
2350/// Response after starting a campaign.
2351#[derive(Clone, PartialEq, ::prost::Message)]
2352pub struct StartCampaignResponse {
2353 /// The campaign with updated status.
2354 #[prost(message, optional, tag="1")]
2355 pub campaign: ::core::option::Option<Campaign>,
2356}
2357/// Request to retrieve a single campaign by ID.
2358#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2359pub struct GetCampaignRequest {
2360 /// ID of the campaign to retrieve.
2361 /// Constraints: UUID format (36 characters).
2362 #[prost(string, tag="1")]
2363 pub campaign_id: ::prost::alloc::string::String,
2364}
2365/// Response containing the requested campaign.
2366#[derive(Clone, PartialEq, ::prost::Message)]
2367pub struct GetCampaignResponse {
2368 /// The requested campaign.
2369 #[prost(message, optional, tag="1")]
2370 pub campaign: ::core::option::Option<Campaign>,
2371}
2372/// Request to list campaigns with pagination.
2373#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2374pub struct ListCampaignsRequest {
2375 /// Pagination parameters.
2376 #[prost(message, optional, tag="1")]
2377 pub pagination: ::core::option::Option<Pagination>,
2378}
2379/// Response containing a page of campaigns.
2380#[derive(Clone, PartialEq, ::prost::Message)]
2381pub struct ListCampaignsResponse {
2382 /// List of campaigns in this page.
2383 #[prost(message, repeated, tag="1")]
2384 pub campaigns: ::prost::alloc::vec::Vec<Campaign>,
2385 /// Pagination metadata for fetching subsequent pages.
2386 #[prost(message, optional, tag="2")]
2387 pub pagination_meta: ::core::option::Option<PaginationMeta>,
2388}
2389/// Request to cancel a running campaign.
2390#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2391pub struct CancelCampaignRequest {
2392 /// ID of the campaign to cancel.
2393 /// Constraints: UUID format (36 characters).
2394 #[prost(string, tag="1")]
2395 pub campaign_id: ::prost::alloc::string::String,
2396}
2397/// Response after cancelling a campaign.
2398#[derive(Clone, PartialEq, ::prost::Message)]
2399pub struct CancelCampaignResponse {
2400 /// The campaign with updated status (CANCELLED).
2401 #[prost(message, optional, tag="1")]
2402 pub campaign: ::core::option::Option<Campaign>,
2403}
2404/// Request to update a draft campaign (status must be CREATED).
2405/// Only non-empty/non-zero fields are updated; omitted fields remain unchanged.
2406#[derive(Clone, PartialEq, ::prost::Message)]
2407pub struct UpdateCampaignRequest {
2408 /// ID of the campaign to update.
2409 /// Constraints: UUID format (36 characters).
2410 #[prost(string, tag="1")]
2411 pub campaign_id: ::prost::alloc::string::String,
2412 /// Updated campaign name. Empty string means no change.
2413 /// Constraints: Max length 200 characters.
2414 #[prost(string, tag="2")]
2415 pub name: ::prost::alloc::string::String,
2416 /// Updated sender display name. Empty string means no change.
2417 /// Constraints: Max length 200 characters.
2418 #[prost(string, tag="3")]
2419 pub sender_name: ::prost::alloc::string::String,
2420 /// Updated title override. Empty string means no change.
2421 /// Constraints: Max length 200 characters.
2422 #[prost(string, tag="4")]
2423 pub title: ::prost::alloc::string::String,
2424 /// Updated template ID. Empty string means no change.
2425 /// Constraints: UUID format (36 characters).
2426 #[prost(string, tag="5")]
2427 pub template_id: ::prost::alloc::string::String,
2428 /// Updated template version. Zero means no change.
2429 #[prost(int32, tag="6")]
2430 pub template_version: i32,
2431 /// Updated workflow DAG. Null/omitted means no change.
2432 #[prost(message, optional, tag="7")]
2433 pub workflow: ::core::option::Option<WorkflowDefinition>,
2434}
2435/// Response after updating a campaign.
2436#[derive(Clone, PartialEq, ::prost::Message)]
2437pub struct UpdateCampaignResponse {
2438 /// The campaign with updated fields.
2439 #[prost(message, optional, tag="1")]
2440 pub campaign: ::core::option::Option<Campaign>,
2441}
2442/// A single delivery record tracking message delivery to one recipient.
2443/// Out-of-band context attached to a delivery beyond its canonical
2444/// recipient + status + content payload. Optional; fields are populated
2445/// per delivery kind. Currently only REMINDER_FYI children carry values,
2446/// to snapshot context from the parent delivery so clients can render
2447/// without fetching additional resources.
2448#[derive(Clone, PartialEq, ::prost::Message)]
2449pub struct DeliveryMetadata {
2450 /// REMINDER_FYI: the rendered Message payload from the parent delivery,
2451 /// used to render the blockquoted "Original message" panel on the
2452 /// notify-target's inbox card.
2453 #[prost(message, optional, tag="1")]
2454 pub original_message: ::core::option::Option<Message>,
2455 /// REMINDER_FYI: display name of the original recipient (the employee
2456 /// who hasn't responded). Used to interpolate the FYI title and banner.
2457 #[prost(string, tag="2")]
2458 pub original_recipient_name: ::prost::alloc::string::String,
2459 /// REMINDER_FYI: campaign title, denormalized so the notify-target's
2460 /// client can render without a separate campaign lookup.
2461 #[prost(string, tag="3")]
2462 pub campaign_title: ::prost::alloc::string::String,
2463 /// REMINDER_FYI: when the parent reminder step fired, used to render
2464 /// the "fired X ago" footer on the FYI card.
2465 #[prost(message, optional, tag="4")]
2466 pub reminder_fired_at: ::core::option::Option<::prost_types::Timestamp>,
2467}
2468#[derive(Clone, PartialEq, ::prost::Message)]
2469pub struct Delivery {
2470 /// Unique identifier for this delivery.
2471 /// Constraints: UUID format (36 characters).
2472 #[prost(string, tag="1")]
2473 pub id: ::prost::alloc::string::String,
2474 /// ID of the recipient user.
2475 /// Constraints: UUID format (36 characters).
2476 #[prost(string, tag="2")]
2477 pub user_id: ::prost::alloc::string::String,
2478 /// ID of the campaign this delivery belongs to.
2479 /// Constraints: UUID format (36 characters).
2480 #[prost(string, tag="3")]
2481 pub campaign_id: ::prost::alloc::string::String,
2482 /// Current delivery status.
2483 #[prost(enumeration="DeliveryStatus", tag="4")]
2484 pub status: i32,
2485 /// Timestamp when the message was delivered to the device.
2486 #[prost(message, optional, tag="5")]
2487 pub delivered_at: ::core::option::Option<::prost_types::Timestamp>,
2488 /// Timestamp when the recipient read the message.
2489 #[prost(message, optional, tag="6")]
2490 pub read_at: ::core::option::Option<::prost_types::Timestamp>,
2491 /// Timestamp when the recipient performed the required action.
2492 #[prost(message, optional, tag="7")]
2493 pub acted_at: ::core::option::Option<::prost_types::Timestamp>,
2494 /// Email address of the recipient, populated from the users table on read.
2495 #[prost(string, tag="8")]
2496 pub recipient_email: ::prost::alloc::string::String,
2497 /// Discriminator distinguishing primary recipient deliveries from
2498 /// deliveries generated by downstream workflow steps.
2499 #[prost(enumeration="delivery::Kind", tag="12")]
2500 pub kind: i32,
2501 /// For non-primary deliveries, the UUID of the originating delivery this
2502 /// row was derived from. Empty for primary deliveries.
2503 /// Constraints: UUID format (36 characters) when set.
2504 #[prost(string, tag="13")]
2505 pub parent_delivery_id: ::prost::alloc::string::String,
2506 /// The locale this delivery's body was actually rendered in after fallback
2507 /// resolution (recipient preference, campaign override, template default).
2508 /// Valid values: en, es, pt-BR, zh, ja.
2509 #[prost(string, tag="14")]
2510 pub rendered_locale: ::prost::alloc::string::String,
2511 /// Optional out-of-band context. See `DeliveryMetadata` for which
2512 /// delivery kinds populate which fields. Empty for legacy / PRIMARY
2513 /// deliveries.
2514 #[prost(message, optional, tag="15")]
2515 pub metadata: ::core::option::Option<DeliveryMetadata>,
2516 /// True when this delivery's outcome is synthetic (artificially injected)
2517 /// data rather than the result of a real delivery and user response.
2518 #[prost(bool, tag="9")]
2519 pub synthetic: bool,
2520}
2521/// Nested message and enum types in `Delivery`.
2522pub mod delivery {
2523 /// Discriminator describing what produced this delivery row.
2524 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2525 #[repr(i32)]
2526 pub enum Kind {
2527 /// Default value; not a valid kind.
2528 Unspecified = 0,
2529 /// Delivery generated for an audience recipient at campaign start.
2530 Primary = 1,
2531 /// Delivery generated by an escalation step targeting a non-audience user.
2532 Escalation = 2,
2533 /// Passive heads-up delivery generated when a reminder step fans out to
2534 /// its `notify_targets`. Carries no action button; auto-dismisses when
2535 /// the parent delivery is acknowledged. See
2536 /// `SendReminderConfig.notify_targets`.
2537 ReminderFyi = 3,
2538 }
2539 impl Kind {
2540 /// String value of the enum field names used in the ProtoBuf definition.
2541 ///
2542 /// The values are not transformed in any way and thus are considered stable
2543 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2544 pub fn as_str_name(&self) -> &'static str {
2545 match self {
2546 Self::Unspecified => "KIND_UNSPECIFIED",
2547 Self::Primary => "KIND_PRIMARY",
2548 Self::Escalation => "KIND_ESCALATION",
2549 Self::ReminderFyi => "KIND_REMINDER_FYI",
2550 }
2551 }
2552 /// Creates an enum from field names used in the ProtoBuf definition.
2553 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2554 match value {
2555 "KIND_UNSPECIFIED" => Some(Self::Unspecified),
2556 "KIND_PRIMARY" => Some(Self::Primary),
2557 "KIND_ESCALATION" => Some(Self::Escalation),
2558 "KIND_REMINDER_FYI" => Some(Self::ReminderFyi),
2559 _ => None,
2560 }
2561 }
2562 }
2563}
2564/// Request to list deliveries for a campaign with optional status filtering.
2565#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2566pub struct ListDeliveriesRequest {
2567 /// ID of the campaign to list deliveries for.
2568 /// Constraints: UUID format (36 characters).
2569 #[prost(string, tag="1")]
2570 pub campaign_id: ::prost::alloc::string::String,
2571 /// Optional filter by delivery status. UNSPECIFIED returns all.
2572 #[prost(enumeration="DeliveryStatus", tag="2")]
2573 pub status_filter: i32,
2574 /// Pagination parameters.
2575 #[prost(message, optional, tag="3")]
2576 pub pagination: ::core::option::Option<Pagination>,
2577}
2578/// Response containing a page of delivery records.
2579#[derive(Clone, PartialEq, ::prost::Message)]
2580pub struct ListDeliveriesResponse {
2581 /// List of deliveries in this page.
2582 #[prost(message, repeated, tag="1")]
2583 pub deliveries: ::prost::alloc::vec::Vec<Delivery>,
2584 /// Pagination metadata for fetching subsequent pages.
2585 #[prost(message, optional, tag="2")]
2586 pub pagination_meta: ::core::option::Option<PaginationMeta>,
2587}
2588/// Request to compute the archetype-tendency-shift surface for a campaign:
2589/// how each archetype's share of the originating group has moved between
2590/// the snapshot closest to campaign-creation time and the most recent
2591/// snapshot. Only valid for campaigns whose originating_archetype is set.
2592#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2593pub struct GetCampaignArchetypeBreakdownRequest {
2594 /// ID of the campaign to break down.
2595 /// Constraints: UUID format (36 characters).
2596 #[prost(string, tag="1")]
2597 pub campaign_id: ::prost::alloc::string::String,
2598}
2599/// Movement in one archetype's share of the originating group between the
2600/// "before" and "after" archetype-clustering snapshots. Cohort-level only;
2601/// no joining to user identity. The `is_origin` row is the archetype the
2602/// campaign was authored for.
2603#[derive(Clone, PartialEq, ::prost::Message)]
2604pub struct ArchetypeShareShift {
2605 /// Stable archetype label, e.g. "Swift Acknowledger".
2606 #[prost(string, tag="1")]
2607 pub label: ::prost::alloc::string::String,
2608 /// Archetype's share of the group at the snapshot closest to (but not
2609 /// after) the campaign's created_at. Range 0.0 – 1.0.
2610 #[prost(double, tag="2")]
2611 pub share_before: f64,
2612 /// Archetype's share of the group at the most recent snapshot. Range
2613 /// 0.0 – 1.0. Equals share_before when no clustering has run since.
2614 #[prost(double, tag="3")]
2615 pub share_after: f64,
2616 /// True when this row's label matches the campaign's
2617 /// originating_archetype.archetype_label.
2618 #[prost(bool, tag="4")]
2619 pub is_origin: bool,
2620 /// Count of email DELIVERED events recorded for this archetype's members
2621 /// across the campaign window. Denominator for both open-rate fields.
2622 #[prost(uint64, tag="5")]
2623 pub email_delivered_count: u64,
2624 /// Open rate excluding events flagged as Apple-MPP prefetches
2625 /// (prefetch_suspected=true). Range 0.0 – 1.0.
2626 #[prost(double, tag="6")]
2627 pub email_open_rate_real: f64,
2628 /// Open rate including all OPENED events, prefetches included.
2629 /// Range 0.0 – 1.0.
2630 #[prost(double, tag="7")]
2631 pub email_open_rate_raw: f64,
2632}
2633/// Response containing per-archetype share shifts. The admin renders
2634/// these as a comparison table — origin row marked, others as peers, so
2635/// the admin can tell campaign-coincident drift apart from background
2636/// drift across the rest of the group.
2637#[derive(Clone, PartialEq, ::prost::Message)]
2638pub struct GetCampaignArchetypeBreakdownResponse {
2639 /// One entry per archetype in the originating group. Empty when
2640 /// insufficient_history is true.
2641 #[prost(message, repeated, tag="1")]
2642 pub shifts: ::prost::alloc::vec::Vec<ArchetypeShareShift>,
2643 /// When the "before" sample was taken (closest snapshot at or before
2644 /// campaign creation).
2645 #[prost(message, optional, tag="2")]
2646 pub before_snapshot_at: ::core::option::Option<::prost_types::Timestamp>,
2647 /// When the "after" sample was taken (most recent snapshot).
2648 #[prost(message, optional, tag="3")]
2649 pub after_snapshot_at: ::core::option::Option<::prost_types::Timestamp>,
2650 /// True when fewer than two clustering snapshots exist for the group,
2651 /// so no shift can be computed yet. Admin renders an "awaiting next
2652 /// clustering cycle" empty state.
2653 #[prost(bool, tag="4")]
2654 pub insufficient_history: bool,
2655}
2656// ─── Short-code messages ────────────────────────────────────────────────────
2657
2658/// Request to resolve a campaign's short-code, lazily generating one on
2659/// first call. Used by internal-service callers (the dispatch layer)
2660/// when assembling a third-party-channel deeplink:
2661/// `links.pidgr.com/c/{short_code}?t={token}`.
2662#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2663pub struct ResolveOrCreateShortCodeRequest {
2664 /// The campaign whose short-code is being resolved.
2665 /// Constraints: Required, must be a UUID and exist within the caller's organization.
2666 #[prost(string, tag="1")]
2667 pub campaign_id: ::prost::alloc::string::String,
2668}
2669/// Response carrying the resolved short-code. The same campaign always
2670/// resolves to the same code for its lifetime; the value is safe to
2671/// cache by the caller.
2672#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2673pub struct ResolveOrCreateShortCodeResponse {
2674 /// 8-character base62 short-code stable for the campaign's lifetime.
2675 #[prost(string, tag="1")]
2676 pub short_code: ::prost::alloc::string::String,
2677}
2678/// Request to look up a campaign by its public short-code. Called by the
2679/// native app when the recipient taps a third-party-channel deeplink and
2680/// the URL handler needs to route to the right campaign card. Designed to
2681/// be safe to call without authentication — the response carries no PII
2682/// and only enough context for the app to route correctly and show org
2683/// branding before the auth gate.
2684#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2685pub struct GetCampaignByShortCodeRequest {
2686 /// The 8-character short-code from the deeplink path.
2687 /// Constraints: Required, exactly 8 base62 characters.
2688 #[prost(string, tag="1")]
2689 pub short_code: ::prost::alloc::string::String,
2690}
2691/// Response carrying the minimum metadata the native app needs to route
2692/// the deeplink. Subject is the campaign's title text (already visible
2693/// in the recipient's inbox after dispatch — no new PII exposure). Body
2694/// content, audience size, delivery status and any other operational
2695/// fields are NOT included; the app fetches those via authenticated
2696/// `GetCampaign` after the recipient signs in.
2697#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2698pub struct GetCampaignByShortCodeResponse {
2699 /// Campaign UUID — the app uses this for the authenticated `GetCampaign`
2700 /// follow-up after the deeplink token validates.
2701 #[prost(string, tag="1")]
2702 pub campaign_id: ::prost::alloc::string::String,
2703 /// Organization UUID owning the campaign — lets the app pick the
2704 /// correct SSO / sign-in flow when the recipient is logged out.
2705 #[prost(string, tag="2")]
2706 pub org_id: ::prost::alloc::string::String,
2707 /// Display name of the organization for sign-in branding ("Sign in to
2708 /// Acme Inc to view this campaign"). Public information; the
2709 /// organization's profile already exposes it elsewhere.
2710 #[prost(string, tag="3")]
2711 pub organization_name: ::prost::alloc::string::String,
2712 /// Campaign subject (title). Same string the recipient already saw in
2713 /// their inbox; included so the deeplink interstitial can show
2714 /// "Acme Inc — All-hands Q3" before the auth gate.
2715 #[prost(string, tag="4")]
2716 pub subject: ::prost::alloc::string::String,
2717}
2718// ─── Messages ───────────────────────────────────────────────────────────────
2719
2720/// A registered device that can receive push notifications.
2721/// INTERNAL: This message is for server-side use only. Use DeviceSummary for API responses.
2722#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2723pub struct Device {
2724 /// Unique identifier for this device.
2725 /// Constraints: UUID format (36 characters).
2726 #[prost(string, tag="1")]
2727 pub device_id: ::prost::alloc::string::String,
2728 /// ID of the user who owns this device.
2729 /// Constraints: UUID format (36 characters).
2730 #[prost(string, tag="2")]
2731 pub user_id: ::prost::alloc::string::String,
2732 /// Mobile platform (iOS or Android).
2733 #[prost(enumeration="Platform", tag="3")]
2734 pub platform: i32,
2735 /// Push token used to send notifications to this device.
2736 #[prost(string, tag="4")]
2737 pub push_token: ::prost::alloc::string::String,
2738 /// Whether the device is currently active and eligible for push delivery.
2739 #[prost(bool, tag="5")]
2740 pub active: bool,
2741 /// Timestamp of the last activity from this device.
2742 #[prost(message, optional, tag="6")]
2743 pub last_seen: ::core::option::Option<::prost_types::Timestamp>,
2744 /// Timestamp when the device was first registered.
2745 #[prost(message, optional, tag="7")]
2746 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
2747}
2748/// A device summary safe for API responses — excludes sensitive push_token.
2749#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2750pub struct DeviceSummary {
2751 /// Unique identifier for this device.
2752 #[prost(string, tag="1")]
2753 pub device_id: ::prost::alloc::string::String,
2754 /// ID of the user who owns this device.
2755 #[prost(string, tag="2")]
2756 pub user_id: ::prost::alloc::string::String,
2757 /// Mobile platform (iOS or Android).
2758 #[prost(enumeration="Platform", tag="3")]
2759 pub platform: i32,
2760 /// Whether the device is currently active and eligible for push delivery.
2761 #[prost(bool, tag="4")]
2762 pub active: bool,
2763 /// Timestamp of the last activity from this device.
2764 #[prost(message, optional, tag="5")]
2765 pub last_seen: ::core::option::Option<::prost_types::Timestamp>,
2766 /// Timestamp when the device was first registered.
2767 #[prost(message, optional, tag="6")]
2768 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
2769}
2770/// Request to register a device for push notifications.
2771#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2772pub struct RegisterRequest {
2773 /// Client-generated unique device identifier.
2774 /// Constraints: UUID format (36 characters).
2775 #[prost(string, tag="1")]
2776 pub device_id: ::prost::alloc::string::String,
2777 /// Mobile platform of the device.
2778 #[prost(enumeration="Platform", tag="2")]
2779 pub platform: i32,
2780 /// Push token obtained from the push notification provider on the client.
2781 /// Constraints: Max length 4096 characters.
2782 #[prost(string, tag="3")]
2783 pub push_token: ::prost::alloc::string::String,
2784}
2785/// Response after registering a device.
2786#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2787pub struct RegisterResponse {
2788 /// The registered device summary (excludes push_token).
2789 #[prost(message, optional, tag="1")]
2790 pub device: ::core::option::Option<DeviceSummary>,
2791}
2792/// Request to deactivate a device, stopping push notifications.
2793#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2794pub struct DeactivateRequest {
2795 /// ID of the device to deactivate.
2796 /// Constraints: UUID format (36 characters).
2797 #[prost(string, tag="1")]
2798 pub device_id: ::prost::alloc::string::String,
2799}
2800/// Response after deactivating a device.
2801#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
2802pub struct DeactivateResponse {
2803 /// Whether the device was successfully deactivated.
2804 #[prost(bool, tag="1")]
2805 pub success: bool,
2806}
2807/// Request to list all devices for the authenticated user.
2808#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
2809pub struct ListDevicesRequest {
2810}
2811/// Response containing all devices for the user.
2812#[derive(Clone, PartialEq, ::prost::Message)]
2813pub struct ListDevicesResponse {
2814 /// List of devices registered to the authenticated user.
2815 #[prost(message, repeated, tag="1")]
2816 pub devices: ::prost::alloc::vec::Vec<DeviceSummary>,
2817}
2818/// Request to list devices for a specific member (admin use).
2819#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2820pub struct ListMemberDevicesRequest {
2821 /// ID of the user whose devices to list.
2822 /// Constraints: UUID format (36 characters).
2823 #[prost(string, tag="1")]
2824 pub user_id: ::prost::alloc::string::String,
2825}
2826/// Response containing all devices for the specified member.
2827#[derive(Clone, PartialEq, ::prost::Message)]
2828pub struct ListMemberDevicesResponse {
2829 /// List of devices registered to the specified user.
2830 #[prost(message, repeated, tag="1")]
2831 pub devices: ::prost::alloc::vec::Vec<DeviceSummary>,
2832}
2833// ─── Messages ───────────────────────────────────────────────────────────────
2834
2835/// User-configurable platform settings that apply across all clients.
2836/// All fields use their UNSPECIFIED/zero value to mean "no change" in updates.
2837#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2838pub struct UserSettings {
2839 /// Preferred color scheme for the UI.
2840 #[prost(enumeration="ThemePreference", tag="1")]
2841 pub theme_preference: i32,
2842 /// User's preferred language for the UI and push notifications.
2843 /// Empty string means "use organization default" or "auto-detect".
2844 /// Valid values: en, es, pt-BR, zh, ja.
2845 #[prost(string, tag="2")]
2846 pub preferred_locale: ::prost::alloc::string::String,
2847}
2848/// Structured profile attributes for a user within an organization.
2849/// Populated through admin invitation, mobile onboarding, or SSO attribute sync.
2850#[derive(Clone, PartialEq, ::prost::Message)]
2851pub struct UserProfile {
2852 /// User's given name.
2853 /// Constraints: Max length 200 characters.
2854 #[prost(string, tag="1")]
2855 pub first_name: ::prost::alloc::string::String,
2856 /// User's family name.
2857 /// Constraints: Max length 200 characters.
2858 #[prost(string, tag="2")]
2859 pub last_name: ::prost::alloc::string::String,
2860 /// Department or team within the organization.
2861 /// Constraints: Max length 200 characters.
2862 #[prost(string, tag="3")]
2863 pub department: ::prost::alloc::string::String,
2864 /// Job title.
2865 /// Constraints: Max length 200 characters.
2866 #[prost(string, tag="4")]
2867 pub title: ::prost::alloc::string::String,
2868 /// Phone number.
2869 /// Constraints: Max length 200 characters.
2870 #[prost(string, tag="5")]
2871 pub phone: ::prost::alloc::string::String,
2872 /// Office or geographic location.
2873 /// Constraints: Max length 200 characters.
2874 #[prost(string, tag="6")]
2875 pub location: ::prost::alloc::string::String,
2876 /// Organization-specific employee identifier.
2877 /// Constraints: Max length 200 characters.
2878 #[prost(string, tag="7")]
2879 pub employee_id: ::prost::alloc::string::String,
2880 /// Display name of the user's direct manager.
2881 /// Constraints: Max length 200 characters.
2882 #[prost(string, tag="8")]
2883 pub manager_name: ::prost::alloc::string::String,
2884 /// Employment start date in ISO 8601 format (YYYY-MM-DD).
2885 /// Constraints: Max length 200 characters.
2886 #[prost(string, tag="9")]
2887 pub start_date: ::prost::alloc::string::String,
2888 /// Organization-defined custom attributes for fields not covered by the fixed schema.
2889 /// Constraints: Max 50 entries. Key max length 100 characters, value max length 1000 characters.
2890 #[prost(map="string, string", tag="10")]
2891 pub custom_attributes: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
2892 /// UUID of the user's direct manager within the same organization.
2893 /// Populated from SCIM enterprise extension (manager.value), manual admin
2894 /// assignment, or SSO attribute mapping. Empty if not set.
2895 #[prost(string, tag="11")]
2896 pub manager_id: ::prost::alloc::string::String,
2897}
2898/// A user within an organization.
2899#[derive(Clone, PartialEq, ::prost::Message)]
2900pub struct User {
2901 /// Unique identifier for the user (internal platform UUID, not identity provider subject ID).
2902 #[prost(string, tag="1")]
2903 pub id: ::prost::alloc::string::String,
2904 /// User's email address.
2905 /// Constraints: Max length 254 characters (RFC 5321).
2906 #[prost(string, tag="2")]
2907 pub email: ::prost::alloc::string::String,
2908 /// User's display name.
2909 /// Constraints: Max length 200 characters.
2910 #[prost(string, tag="3")]
2911 pub name: ::prost::alloc::string::String,
2912 /// Current account status.
2913 #[prost(enumeration="UserStatus", tag="5")]
2914 pub status: i32,
2915 /// Timestamp when the user was created.
2916 #[prost(message, optional, tag="6")]
2917 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
2918 /// The user's role with its permission set.
2919 #[prost(message, optional, tag="7")]
2920 pub role: ::core::option::Option<Role>,
2921 /// ID of the user's role (for assignment operations).
2922 #[prost(string, tag="8")]
2923 pub role_id: ::prost::alloc::string::String,
2924 /// Structured profile attributes (department, title, etc.).
2925 /// May be empty if the user has not completed their profile.
2926 #[prost(message, optional, tag="9")]
2927 pub profile: ::core::option::Option<UserProfile>,
2928 /// Whether data processing is restricted for this user (GDPR Art. 18).
2929 /// When true, the user is excluded from campaign audiences by default.
2930 #[prost(bool, tag="10")]
2931 pub processing_restricted: bool,
2932 /// Data governance region override. Empty string means "inherit from org default".
2933 /// Valid values: EU, LATAM, BR, APAC, US.
2934 #[prost(string, tag="11")]
2935 pub data_governance_region: ::prost::alloc::string::String,
2936}
2937// ─── Enums ──────────────────────────────────────────────────────────────────
2938
2939/// Lifecycle status of a user account.
2940#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2941#[repr(i32)]
2942pub enum UserStatus {
2943 /// Default value; not a valid status.
2944 Unspecified = 0,
2945 /// User has been invited but has not completed onboarding.
2946 Invited = 1,
2947 /// User is active and can receive messages.
2948 Active = 2,
2949 /// User has been deactivated and will not receive messages.
2950 Deactivated = 3,
2951}
2952impl UserStatus {
2953 /// String value of the enum field names used in the ProtoBuf definition.
2954 ///
2955 /// The values are not transformed in any way and thus are considered stable
2956 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2957 pub fn as_str_name(&self) -> &'static str {
2958 match self {
2959 Self::Unspecified => "USER_STATUS_UNSPECIFIED",
2960 Self::Invited => "USER_STATUS_INVITED",
2961 Self::Active => "USER_STATUS_ACTIVE",
2962 Self::Deactivated => "USER_STATUS_DEACTIVATED",
2963 }
2964 }
2965 /// Creates an enum from field names used in the ProtoBuf definition.
2966 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2967 match value {
2968 "USER_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
2969 "USER_STATUS_INVITED" => Some(Self::Invited),
2970 "USER_STATUS_ACTIVE" => Some(Self::Active),
2971 "USER_STATUS_DEACTIVATED" => Some(Self::Deactivated),
2972 _ => None,
2973 }
2974 }
2975}
2976/// User's preferred color scheme.
2977#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2978#[repr(i32)]
2979pub enum ThemePreference {
2980 /// Default value; treated as SYSTEM when reading, "no change" when updating.
2981 Unspecified = 0,
2982 /// Always use light mode regardless of system setting.
2983 Light = 1,
2984 /// Always use dark mode regardless of system setting.
2985 Dark = 2,
2986 /// Follow the operating system or browser preference.
2987 System = 3,
2988}
2989impl ThemePreference {
2990 /// String value of the enum field names used in the ProtoBuf definition.
2991 ///
2992 /// The values are not transformed in any way and thus are considered stable
2993 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2994 pub fn as_str_name(&self) -> &'static str {
2995 match self {
2996 Self::Unspecified => "THEME_PREFERENCE_UNSPECIFIED",
2997 Self::Light => "THEME_PREFERENCE_LIGHT",
2998 Self::Dark => "THEME_PREFERENCE_DARK",
2999 Self::System => "THEME_PREFERENCE_SYSTEM",
3000 }
3001 }
3002 /// Creates an enum from field names used in the ProtoBuf definition.
3003 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3004 match value {
3005 "THEME_PREFERENCE_UNSPECIFIED" => Some(Self::Unspecified),
3006 "THEME_PREFERENCE_LIGHT" => Some(Self::Light),
3007 "THEME_PREFERENCE_DARK" => Some(Self::Dark),
3008 "THEME_PREFERENCE_SYSTEM" => Some(Self::System),
3009 _ => None,
3010 }
3011 }
3012}
3013// ─── Messages ───────────────────────────────────────────────────────────────
3014
3015/// A named collection of users within an organization, used for campaign
3016/// audience targeting (recipient groups).
3017#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3018pub struct Group {
3019 /// Unique identifier for the group.
3020 #[prost(string, tag="1")]
3021 pub id: ::prost::alloc::string::String,
3022 /// Human-readable display name (unique within the organization).
3023 /// Constraints: Max length 200 characters.
3024 #[prost(string, tag="2")]
3025 pub name: ::prost::alloc::string::String,
3026 /// Optional description of the group's purpose.
3027 /// Constraints: Max length 1000 characters.
3028 #[prost(string, tag="3")]
3029 pub description: ::prost::alloc::string::String,
3030 /// Number of users currently in the group.
3031 #[prost(int32, tag="4")]
3032 pub member_count: i32,
3033 /// Timestamp when the group was created.
3034 #[prost(message, optional, tag="5")]
3035 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
3036 /// Timestamp when the group was last updated.
3037 #[prost(message, optional, tag="6")]
3038 pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
3039 /// Whether this is the organization's default group (cannot be deleted or renamed).
3040 #[prost(bool, tag="7")]
3041 pub is_default: bool,
3042 /// ID of the user who created this group. Empty for system-seeded defaults.
3043 #[prost(string, tag="8")]
3044 pub created_by: ::prost::alloc::string::String,
3045}
3046/// Request to create a new group.
3047#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3048pub struct CreateGroupRequest {
3049 /// Display name for the group. Required.
3050 /// Constraints: Max length 200 characters.
3051 #[prost(string, tag="1")]
3052 pub name: ::prost::alloc::string::String,
3053 /// Optional description.
3054 /// Constraints: Max length 1000 characters.
3055 #[prost(string, tag="2")]
3056 pub description: ::prost::alloc::string::String,
3057}
3058/// Response after creating a group.
3059#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3060pub struct CreateGroupResponse {
3061 /// The newly created group.
3062 #[prost(message, optional, tag="1")]
3063 pub group: ::core::option::Option<Group>,
3064}
3065/// Request to retrieve a group by ID.
3066#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3067pub struct GetGroupRequest {
3068 /// ID of the group to retrieve. Required.
3069 #[prost(string, tag="1")]
3070 pub group_id: ::prost::alloc::string::String,
3071}
3072/// Response containing the requested group.
3073#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3074pub struct GetGroupResponse {
3075 /// The requested group.
3076 #[prost(message, optional, tag="1")]
3077 pub group: ::core::option::Option<Group>,
3078}
3079/// Request to list groups in the organization with pagination.
3080#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3081pub struct ListGroupsRequest {
3082 /// Pagination parameters.
3083 #[prost(message, optional, tag="1")]
3084 pub pagination: ::core::option::Option<Pagination>,
3085}
3086/// Response containing a page of groups.
3087#[derive(Clone, PartialEq, ::prost::Message)]
3088pub struct ListGroupsResponse {
3089 /// Groups in this page.
3090 #[prost(message, repeated, tag="1")]
3091 pub groups: ::prost::alloc::vec::Vec<Group>,
3092 /// Pagination metadata for fetching subsequent pages.
3093 #[prost(message, optional, tag="2")]
3094 pub pagination_meta: ::core::option::Option<PaginationMeta>,
3095}
3096/// Request to update a group's name and/or description.
3097#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3098pub struct UpdateGroupRequest {
3099 /// ID of the group to update. Required.
3100 #[prost(string, tag="1")]
3101 pub group_id: ::prost::alloc::string::String,
3102 /// New display name. If empty, the name is not changed.
3103 /// Default groups cannot be renamed.
3104 /// Constraints: Max length 200 characters.
3105 #[prost(string, tag="2")]
3106 pub name: ::prost::alloc::string::String,
3107 /// New description. If empty, the description is not changed.
3108 /// Constraints: Max length 1000 characters.
3109 #[prost(string, tag="3")]
3110 pub description: ::prost::alloc::string::String,
3111}
3112/// Response after updating a group.
3113#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3114pub struct UpdateGroupResponse {
3115 /// The updated group.
3116 #[prost(message, optional, tag="1")]
3117 pub group: ::core::option::Option<Group>,
3118}
3119/// Request to delete a group.
3120#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3121pub struct DeleteGroupRequest {
3122 /// ID of the group to delete. Required.
3123 /// Default groups cannot be deleted.
3124 #[prost(string, tag="1")]
3125 pub group_id: ::prost::alloc::string::String,
3126}
3127/// Response after deleting a group.
3128#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3129pub struct DeleteGroupResponse {
3130}
3131/// Request to add users to a group.
3132#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3133pub struct AddGroupMembersRequest {
3134 /// ID of the group to add members to. Required.
3135 #[prost(string, tag="1")]
3136 pub group_id: ::prost::alloc::string::String,
3137 /// IDs of users to add. Must belong to the same organization.
3138 /// Adding an existing member is a no-op (idempotent).
3139 /// Constraints: Max 100 user IDs per request.
3140 #[prost(string, repeated, tag="2")]
3141 pub user_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
3142}
3143/// Response after adding group members.
3144#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3145pub struct AddGroupMembersResponse {
3146 /// The group with updated member_count.
3147 #[prost(message, optional, tag="1")]
3148 pub group: ::core::option::Option<Group>,
3149}
3150/// Request to remove users from a group.
3151#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3152pub struct RemoveGroupMembersRequest {
3153 /// ID of the group to remove members from. Required.
3154 #[prost(string, tag="1")]
3155 pub group_id: ::prost::alloc::string::String,
3156 /// IDs of users to remove. Removing a non-member is a no-op (idempotent).
3157 /// Constraints: Max 100 user IDs per request.
3158 #[prost(string, repeated, tag="2")]
3159 pub user_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
3160}
3161/// Response after removing group members.
3162#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3163pub struct RemoveGroupMembersResponse {
3164 /// The group with updated member_count.
3165 #[prost(message, optional, tag="1")]
3166 pub group: ::core::option::Option<Group>,
3167}
3168/// Request to list members of a group with pagination.
3169#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3170pub struct ListGroupMembersRequest {
3171 /// ID of the group whose members to list. Required.
3172 #[prost(string, tag="1")]
3173 pub group_id: ::prost::alloc::string::String,
3174 /// Pagination parameters.
3175 #[prost(message, optional, tag="2")]
3176 pub pagination: ::core::option::Option<Pagination>,
3177}
3178/// Response containing a page of group members.
3179#[derive(Clone, PartialEq, ::prost::Message)]
3180pub struct ListGroupMembersResponse {
3181 /// Users in this page.
3182 #[prost(message, repeated, tag="1")]
3183 pub users: ::prost::alloc::vec::Vec<User>,
3184 /// Pagination metadata for fetching subsequent pages.
3185 #[prost(message, optional, tag="2")]
3186 pub pagination_meta: ::core::option::Option<PaginationMeta>,
3187}
3188/// A group membership entry for batch lookups.
3189#[derive(Clone, PartialEq, ::prost::Message)]
3190pub struct UserGroupMembership {
3191 /// ID of the user.
3192 #[prost(string, tag="1")]
3193 pub user_id: ::prost::alloc::string::String,
3194 /// Groups the user belongs to.
3195 #[prost(message, repeated, tag="2")]
3196 pub groups: ::prost::alloc::vec::Vec<Group>,
3197}
3198/// Request to get group memberships for a batch of users.
3199#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3200pub struct GetUserGroupMembershipsRequest {
3201 /// IDs of users to look up. Required.
3202 /// Constraints: Max 200 user IDs per request.
3203 #[prost(string, repeated, tag="1")]
3204 pub user_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
3205}
3206/// Response containing group memberships for the requested users.
3207#[derive(Clone, PartialEq, ::prost::Message)]
3208pub struct GetUserGroupMembershipsResponse {
3209 /// Group memberships per user. Only users with at least one group are included.
3210 #[prost(message, repeated, tag="1")]
3211 pub memberships: ::prost::alloc::vec::Vec<UserGroupMembership>,
3212}
3213// ─── Messages ───────────────────────────────────────────────────────────────
3214
3215/// A single touch event captured from the mobile app.
3216#[derive(Clone, PartialEq, ::prost::Message)]
3217pub struct TouchEvent {
3218 /// Screen name from React Navigation route.
3219 /// Constraints: Max length 200 characters.
3220 #[prost(string, tag="1")]
3221 pub screen_name: ::prost::alloc::string::String,
3222 /// Horizontal coordinate as a percentage of screen width (0.0–1.0).
3223 /// Constraints: Range 0.0 to 1.0 inclusive.
3224 #[prost(float, tag="2")]
3225 pub x_pct: f32,
3226 /// Vertical coordinate as a percentage of screen height (0.0–1.0).
3227 /// Constraints: Range 0.0 to 1.0 inclusive.
3228 #[prost(float, tag="3")]
3229 pub y_pct: f32,
3230 /// Type of touch event.
3231 #[prost(enumeration="TouchEventType", tag="4")]
3232 pub event_type: i32,
3233 /// Screen width in device pixels at the time of capture.
3234 #[prost(int32, tag="5")]
3235 pub screen_width: i32,
3236 /// Screen height in device pixels at the time of capture.
3237 #[prost(int32, tag="6")]
3238 pub screen_height: i32,
3239 /// Client-side timestamp when the touch occurred.
3240 #[prost(message, optional, tag="7")]
3241 pub client_timestamp: ::core::option::Option<::prost_types::Timestamp>,
3242 /// Campaign ID if the touch occurred during a campaign message view.
3243 /// Empty string for organic (non-campaign) navigation.
3244 #[prost(string, tag="8")]
3245 pub campaign_id: ::prost::alloc::string::String,
3246}
3247/// Request to ingest a batch of touch events from the mobile app.
3248#[derive(Clone, PartialEq, ::prost::Message)]
3249pub struct IngestTouchEventsRequest {
3250 /// Batch of touch events to ingest.
3251 /// Constraints: Max 100 events per batch.
3252 #[prost(message, repeated, tag="1")]
3253 pub events: ::prost::alloc::vec::Vec<TouchEvent>,
3254}
3255/// Response after ingesting touch events.
3256#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3257pub struct IngestTouchEventsResponse {
3258 /// Number of events successfully ingested.
3259 #[prost(int32, tag="1")]
3260 pub ingested_count: i32,
3261}
3262/// A single aggregated data point in a heatmap grid cell.
3263#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3264pub struct HeatmapDataPoint {
3265 /// Grid cell horizontal center as a percentage (0.0–1.0).
3266 #[prost(float, tag="1")]
3267 pub x_pct: f32,
3268 /// Grid cell vertical center as a percentage (0.0–1.0).
3269 #[prost(float, tag="2")]
3270 pub y_pct: f32,
3271 /// Aggregated value for this cell (count, median, or z-score depending on mode).
3272 #[prost(float, tag="3")]
3273 pub value: f32,
3274}
3275/// Request to query aggregated heatmap data for a screen.
3276#[derive(Clone, PartialEq, ::prost::Message)]
3277pub struct QueryHeatmapDataRequest {
3278 /// Screen name to query.
3279 /// Constraints: Max length 200 characters.
3280 #[prost(string, tag="1")]
3281 pub screen_name: ::prost::alloc::string::String,
3282 /// Start of the time range filter (inclusive).
3283 #[prost(message, optional, tag="2")]
3284 pub date_from: ::core::option::Option<::prost_types::Timestamp>,
3285 /// End of the time range filter (inclusive).
3286 #[prost(message, optional, tag="3")]
3287 pub date_to: ::core::option::Option<::prost_types::Timestamp>,
3288 /// Optional: filter by campaign ID.
3289 /// Constraints: UUID format (36 characters).
3290 #[prost(string, tag="4")]
3291 pub campaign_id: ::prost::alloc::string::String,
3292 /// Grid resolution for coordinate rounding. Default: 0.02 (50×50 grid).
3293 /// Constraints: Range 0.005 to 0.1.
3294 #[prost(float, tag="6")]
3295 pub grid_resolution: f32,
3296 /// Aggregation mode (TOTAL or MEDIAN).
3297 #[prost(enumeration="HeatmapMode", tag="7")]
3298 pub mode: i32,
3299 /// Optional: filter by event types. Empty list means all types.
3300 #[prost(enumeration="TouchEventType", repeated, tag="8")]
3301 pub event_types: ::prost::alloc::vec::Vec<i32>,
3302}
3303/// Response containing aggregated heatmap data.
3304#[derive(Clone, PartialEq, ::prost::Message)]
3305pub struct QueryHeatmapDataResponse {
3306 /// Aggregated data points for heatmap rendering.
3307 #[prost(message, repeated, tag="1")]
3308 pub data_points: ::prost::alloc::vec::Vec<HeatmapDataPoint>,
3309 /// URL to a mobile-captured screenshot for this screen, if available.
3310 /// Empty string when no screenshot exists.
3311 #[prost(string, tag="3")]
3312 pub screenshot_url: ::prost::alloc::string::String,
3313 /// Whether per-cohort bucket breakdowns are available (k >= 5).
3314 #[prost(bool, tag="4")]
3315 pub cohort_enabled: bool,
3316}
3317/// Request to upload a screenshot captured from the mobile app.
3318#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3319pub struct UploadScreenshotRequest {
3320 /// Screen name matching React Navigation route (e.g. "MessageDetail::<campaign_uuid>").
3321 /// Constraints: Max length 200 characters.
3322 #[prost(string, tag="1")]
3323 pub screen_name: ::prost::alloc::string::String,
3324 /// App version that captured the screenshot (e.g. "1.15.0").
3325 #[prost(string, tag="2")]
3326 pub app_version: ::prost::alloc::string::String,
3327 /// PNG image data.
3328 /// Constraints: Max 512KB.
3329 #[prost(bytes="vec", tag="3")]
3330 pub image_data: ::prost::alloc::vec::Vec<u8>,
3331}
3332/// Response after uploading a screenshot.
3333#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3334pub struct UploadScreenshotResponse {
3335 /// S3 URL where the screenshot was stored.
3336 #[prost(string, tag="1")]
3337 pub url: ::prost::alloc::string::String,
3338}
3339/// A screen screenshot stored as a static asset.
3340#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3341pub struct ScreenScreenshot {
3342 /// Screen name matching React Navigation route.
3343 #[prost(string, tag="1")]
3344 pub screen_name: ::prost::alloc::string::String,
3345 /// S3 URL to the screenshot image.
3346 #[prost(string, tag="2")]
3347 pub url: ::prost::alloc::string::String,
3348 /// App version this screenshot corresponds to.
3349 #[prost(string, tag="3")]
3350 pub app_version: ::prost::alloc::string::String,
3351}
3352/// Request to list available screen screenshots.
3353#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3354pub struct ListScreenshotsRequest {
3355}
3356/// Response containing available screen screenshots.
3357#[derive(Clone, PartialEq, ::prost::Message)]
3358pub struct ListScreenshotsResponse {
3359 /// Available screen screenshots with their URLs and versions.
3360 #[prost(message, repeated, tag="1")]
3361 pub screenshots: ::prost::alloc::vec::Vec<ScreenScreenshot>,
3362}
3363// ─── Enums ──────────────────────────────────────────────────────────────────
3364
3365/// Type of touch event captured on the mobile app.
3366#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
3367#[repr(i32)]
3368pub enum TouchEventType {
3369 /// Default value; not a valid event type.
3370 Unspecified = 0,
3371 /// A single tap on the screen.
3372 Tap = 1,
3373 /// A long press (held for 500ms+).
3374 LongPress = 2,
3375 /// A periodic scroll position sample (viewport midpoint every 2s).
3376 Scroll = 3,
3377 /// The user tapped an action button (e.g. "Acknowledge").
3378 ActionClick = 4,
3379}
3380impl TouchEventType {
3381 /// String value of the enum field names used in the ProtoBuf definition.
3382 ///
3383 /// The values are not transformed in any way and thus are considered stable
3384 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3385 pub fn as_str_name(&self) -> &'static str {
3386 match self {
3387 Self::Unspecified => "TOUCH_EVENT_TYPE_UNSPECIFIED",
3388 Self::Tap => "TOUCH_EVENT_TYPE_TAP",
3389 Self::LongPress => "TOUCH_EVENT_TYPE_LONG_PRESS",
3390 Self::Scroll => "TOUCH_EVENT_TYPE_SCROLL",
3391 Self::ActionClick => "TOUCH_EVENT_TYPE_ACTION_CLICK",
3392 }
3393 }
3394 /// Creates an enum from field names used in the ProtoBuf definition.
3395 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3396 match value {
3397 "TOUCH_EVENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
3398 "TOUCH_EVENT_TYPE_TAP" => Some(Self::Tap),
3399 "TOUCH_EVENT_TYPE_LONG_PRESS" => Some(Self::LongPress),
3400 "TOUCH_EVENT_TYPE_SCROLL" => Some(Self::Scroll),
3401 "TOUCH_EVENT_TYPE_ACTION_CLICK" => Some(Self::ActionClick),
3402 _ => None,
3403 }
3404 }
3405}
3406/// Aggregation mode for heatmap data queries.
3407#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
3408#[repr(i32)]
3409pub enum HeatmapMode {
3410 /// Default value; not a valid mode.
3411 Unspecified = 0,
3412 /// Sum of all cohort buckets' touches per grid cell (default).
3413 Total = 1,
3414 /// Median touch count per grid cell across cohort buckets.
3415 Median = 2,
3416}
3417impl HeatmapMode {
3418 /// String value of the enum field names used in the ProtoBuf definition.
3419 ///
3420 /// The values are not transformed in any way and thus are considered stable
3421 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3422 pub fn as_str_name(&self) -> &'static str {
3423 match self {
3424 Self::Unspecified => "HEATMAP_MODE_UNSPECIFIED",
3425 Self::Total => "HEATMAP_MODE_TOTAL",
3426 Self::Median => "HEATMAP_MODE_MEDIAN",
3427 }
3428 }
3429 /// Creates an enum from field names used in the ProtoBuf definition.
3430 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3431 match value {
3432 "HEATMAP_MODE_UNSPECIFIED" => Some(Self::Unspecified),
3433 "HEATMAP_MODE_TOTAL" => Some(Self::Total),
3434 "HEATMAP_MODE_MEDIAN" => Some(Self::Median),
3435 _ => None,
3436 }
3437 }
3438}
3439// ─── Messages ───────────────────────────────────────────────────────────────
3440
3441/// A single entry in a user's inbox, combining a message with its delivery state.
3442#[derive(Clone, PartialEq, ::prost::Message)]
3443pub struct InboxEntry {
3444 /// ID of the delivery record for this inbox entry.
3445 /// Constraints: UUID format (36 characters).
3446 #[prost(string, tag="1")]
3447 pub delivery_id: ::prost::alloc::string::String,
3448 /// The fully rendered message content.
3449 #[prost(message, optional, tag="2")]
3450 pub message: ::core::option::Option<Message>,
3451 /// Current delivery status (e.g. DELIVERED, ACKNOWLEDGED).
3452 #[prost(enumeration="DeliveryStatus", tag="3")]
3453 pub status: i32,
3454 /// Whether the user has read this message.
3455 #[prost(bool, tag="4")]
3456 pub read: bool,
3457 /// Timestamp when the message was received in the inbox.
3458 #[prost(message, optional, tag="5")]
3459 pub received_at: ::core::option::Option<::prost_types::Timestamp>,
3460 /// Discriminator: PRIMARY for normal deliveries, ESCALATION for delivery-grade
3461 /// escalations. Mirrors Delivery.kind so inbox-sync clients can branch on the
3462 /// same dimension as listDeliveries clients.
3463 #[prost(enumeration="delivery::Kind", tag="6")]
3464 pub kind: i32,
3465 /// For ESCALATION entries, the UUID of the unacked delivery that triggered this
3466 /// entry. Empty for PRIMARY entries.
3467 #[prost(string, tag="7")]
3468 pub parent_delivery_id: ::prost::alloc::string::String,
3469 /// The locale the body actually rendered in after fallback resolution. Empty
3470 /// for legacy/PRIMARY entries.
3471 #[prost(string, tag="8")]
3472 pub rendered_locale: ::prost::alloc::string::String,
3473 /// Optional out-of-band context mirrored from the underlying delivery.
3474 /// See `DeliveryMetadata` for which delivery kinds populate which fields.
3475 /// Empty for PRIMARY entries.
3476 #[prost(message, optional, tag="9")]
3477 pub metadata: ::core::option::Option<DeliveryMetadata>,
3478}
3479/// Request to sync inbox entries since a given timestamp.
3480#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3481pub struct SyncRequest {
3482 /// Fetch entries newer than this timestamp. Omit for initial sync.
3483 #[prost(message, optional, tag="1")]
3484 pub since: ::core::option::Option<::prost_types::Timestamp>,
3485 /// Maximum number of entries to return.
3486 /// Constraints: Valid range 1 to 200.
3487 #[prost(int32, tag="2")]
3488 pub limit: i32,
3489}
3490/// Response containing synced inbox entries.
3491#[derive(Clone, PartialEq, ::prost::Message)]
3492pub struct SyncResponse {
3493 /// Inbox entries newer than the requested timestamp.
3494 #[prost(message, repeated, tag="1")]
3495 pub entries: ::prost::alloc::vec::Vec<InboxEntry>,
3496 /// Cursor timestamp to use for the next sync call.
3497 #[prost(message, optional, tag="2")]
3498 pub next_since: ::core::option::Option<::prost_types::Timestamp>,
3499}
3500/// Request to mark a message as read.
3501#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3502pub struct MarkReadRequest {
3503 /// ID of the delivery to mark as read.
3504 /// Constraints: UUID format (36 characters).
3505 #[prost(string, tag="1")]
3506 pub delivery_id: ::prost::alloc::string::String,
3507}
3508/// Response after marking a message as read.
3509#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3510pub struct MarkReadResponse {
3511 /// Whether the read status was successfully updated.
3512 #[prost(bool, tag="1")]
3513 pub success: bool,
3514}
3515/// Request to retrieve a single message by delivery ID.
3516#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3517pub struct GetMessageRequest {
3518 /// ID of the delivery to retrieve.
3519 /// Constraints: UUID format (36 characters).
3520 #[prost(string, tag="1")]
3521 pub delivery_id: ::prost::alloc::string::String,
3522}
3523/// Response containing the requested inbox entry.
3524#[derive(Clone, PartialEq, ::prost::Message)]
3525pub struct GetMessageResponse {
3526 /// The inbox entry for the requested delivery.
3527 #[prost(message, optional, tag="1")]
3528 pub entry: ::core::option::Option<InboxEntry>,
3529}
3530// ─── Messages ───────────────────────────────────────────────────────────────
3531
3532/// A behavioral archetype describing a cohort pattern (never an individual).
3533/// Derived from k-anonymized, DP-noised behavioral feature vectors.
3534#[derive(Clone, PartialEq, ::prost::Message)]
3535pub struct Archetype {
3536 /// Human-readable label (e.g., "Swift Acknowledger", "Thorough Reader").
3537 #[prost(string, tag="1")]
3538 pub label: ::prost::alloc::string::String,
3539 /// Description of the behavioral pattern this archetype represents.
3540 #[prost(string, tag="2")]
3541 pub description: ::prost::alloc::string::String,
3542 /// Proportion of the group that belongs to this archetype (0.0-1.0).
3543 #[prost(float, tag="3")]
3544 pub percentage: f32,
3545 /// Centroid of the behavioral feature vector for this archetype.
3546 /// Keys are stable dimension names from the feature extractor
3547 /// vocabulary (e.g., "tap_density", "engagement_depth",
3548 /// "scroll_velocity_p50", "idle_gap_p75"). Single-letter keys are
3549 /// reserved for backward compatibility with pre-v0.64 servers and
3550 /// SHALL be ignored by clients.
3551 #[prost(map="string, double", tag="4")]
3552 pub feature_centroid: ::std::collections::HashMap<::prost::alloc::string::String, f64>,
3553 /// Per-dimension distribution of the archetype's members. Lets the
3554 /// admin render percentile bands instead of single-point centroids.
3555 /// Absent until at least k members exist in the cluster. Keys mirror
3556 /// `feature_centroid` keys.
3557 #[prost(map="string, message", tag="5")]
3558 pub feature_breakdown: ::std::collections::HashMap<::prost::alloc::string::String, DimensionStats>,
3559 /// Tap density heatmap aggregated across sessions for this
3560 /// archetype. Cohort-level only — never per-session timing.
3561 /// Absent when fewer than k sessions have tap data.
3562 #[prost(message, optional, tag="6")]
3563 pub tap_heatmap: ::core::option::Option<TapHeatmap>,
3564 /// Forecast of cluster share at fixed horizons (7/14/30/90 days).
3565 /// Absent during cold start before historical clustering runs exist
3566 /// to extrapolate from.
3567 #[prost(message, optional, tag="7")]
3568 pub forecast: ::core::option::Option<ArchetypeForecast>,
3569 /// Sessions that sit at the median and quartiles of the archetype's
3570 /// centroid distance, ranked by distance. Bounded at three entries.
3571 /// Absent until at least 50 sessions have been scored.
3572 /// Sessions can come from any client that emits to ReplayService —
3573 /// mobile (iOS, Android) or desktop (macOS, Windows, Linux).
3574 #[prost(message, repeated, tag="8")]
3575 pub exemplar_sessions: ::prost::alloc::vec::Vec<ExemplarSession>,
3576 /// Per-screen dwell time distribution, derived from session replay.
3577 /// Absent when fewer than k sessions per screen exist.
3578 #[prost(message, optional, tag="9")]
3579 pub screen_dwell: ::core::option::Option<ScreenDwell>,
3580 /// End-to-end response latencies (push delivered → read → ack) for
3581 /// members of this archetype, as percentiles. Absent until at least
3582 /// k campaign deliveries have been recorded for this archetype.
3583 #[prost(message, optional, tag="10")]
3584 pub response_timeline: ::core::option::Option<ResponseTimeline>,
3585 /// Where this archetype came from. UNSPECIFIED on responses from
3586 /// pre-v0.81 servers; clients SHOULD treat UNSPECIFIED as ML for
3587 /// backward compatibility (provisional output is always labelled).
3588 #[prost(enumeration="ArchetypeSource", tag="11")]
3589 pub source: i32,
3590}
3591/// Per-dimension distribution stats for one feature dimension within
3592/// an archetype's cohort. All values are in the same units as
3593/// `Archetype.feature_centroid`. Used to render percentile bands on
3594/// the admin's behavioral profile panel.
3595#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3596pub struct DimensionStats {
3597 /// Centroid value (same as Archetype.feature_centroid\[key\]).
3598 #[prost(double, tag="1")]
3599 pub centroid: f64,
3600 /// 25th percentile across the archetype's members.
3601 #[prost(double, tag="2")]
3602 pub p25: f64,
3603 /// Median across the archetype's members.
3604 #[prost(double, tag="3")]
3605 pub p50: f64,
3606 /// 75th percentile across the archetype's members.
3607 #[prost(double, tag="4")]
3608 pub p75: f64,
3609 /// Median across the entire group (all archetypes), included so the
3610 /// admin can render "this archetype is X% above group median".
3611 #[prost(double, tag="5")]
3612 pub group_p50: f64,
3613}
3614/// A density grid of tap activity for one archetype, normalized to
3615/// \[0.0, 1.0\] where 1.0 is the hottest cell in the cohort. Cohort-
3616/// level only.
3617#[derive(Clone, PartialEq, ::prost::Message)]
3618pub struct TapHeatmap {
3619 /// Width of the density grid in cells.
3620 #[prost(int32, tag="1")]
3621 pub width: i32,
3622 /// Height of the density grid in cells.
3623 #[prost(int32, tag="2")]
3624 pub height: i32,
3625 /// Row-major density values, length must equal width*height. All in
3626 /// \[0.0, 1.0\].
3627 #[prost(double, repeated, tag="3")]
3628 pub values: ::prost::alloc::vec::Vec<f64>,
3629 /// Number of sessions aggregated. Always >= MinFeatureVectorsForClustering
3630 /// when the field is present.
3631 #[prost(int32, tag="4")]
3632 pub session_count: i32,
3633 /// Optional per-event-type breakdown. When present, the writer
3634 /// SHALL emit one entry for each event type in the source data
3635 /// (TAP, LONG_PRESS, SCROLL, ACTION_CLICK).
3636 #[prost(message, repeated, tag="5")]
3637 pub layers: ::prost::alloc::vec::Vec<TapHeatmapLayer>,
3638}
3639/// One per-event-type layer of a TapHeatmap.
3640#[derive(Clone, PartialEq, ::prost::Message)]
3641pub struct TapHeatmapLayer {
3642 /// Event type this layer represents (e.g., "TAP", "LONG_PRESS",
3643 /// "SCROLL", "ACTION_CLICK").
3644 #[prost(string, tag="1")]
3645 pub event_type: ::prost::alloc::string::String,
3646 /// Row-major density values, same dimensions as the parent
3647 /// TapHeatmap. Independently normalized to \[0.0, 1.0\].
3648 #[prost(double, repeated, tag="2")]
3649 pub values: ::prost::alloc::vec::Vec<f64>,
3650}
3651/// Predicted cluster share at fixed horizons with confidence bands.
3652#[derive(Clone, PartialEq, ::prost::Message)]
3653pub struct ArchetypeForecast {
3654 /// Horizons in increasing days. Always one entry each for 7, 14,
3655 /// 30, and 90 days when the field is present.
3656 #[prost(message, repeated, tag="1")]
3657 pub horizons: ::prost::alloc::vec::Vec<ForecastHorizon>,
3658}
3659/// Predicted share at one horizon with a 90% prediction interval.
3660#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3661pub struct ForecastHorizon {
3662 /// Horizon length in days (one of: 7, 14, 30, 90).
3663 #[prost(int32, tag="1")]
3664 pub days: i32,
3665 /// Predicted fraction of the group falling in this archetype at the
3666 /// horizon (0.0-1.0).
3667 #[prost(double, tag="2")]
3668 pub predicted_share: f64,
3669 /// 5th-percentile lower bound of the prediction interval.
3670 #[prost(double, tag="3")]
3671 pub lower: f64,
3672 /// 95th-percentile upper bound of the prediction interval.
3673 #[prost(double, tag="4")]
3674 pub upper: f64,
3675 /// Confidence in this horizon's prediction.
3676 #[prost(enumeration="ConfidenceLevel", tag="5")]
3677 pub confidence: i32,
3678}
3679/// Pointer to a representative session for one archetype, ranked by
3680/// distance to the archetype centroid.
3681#[derive(Clone, PartialEq, ::prost::Message)]
3682pub struct ExemplarSession {
3683 /// Session recording ID retrievable via ReplayService for the same
3684 /// org. Linkable from the admin regardless of originating platform.
3685 #[prost(string, tag="1")]
3686 pub session_id: ::prost::alloc::string::String,
3687 /// Quantile rank within the archetype: 25, 50, or 75. The writer
3688 /// emits at most one session per rank.
3689 #[prost(int32, tag="2")]
3690 pub rank: i32,
3691 /// L2 distance from the session's feature vector to the centroid.
3692 #[prost(double, tag="3")]
3693 pub distance: f64,
3694 /// Optional duration metadata for quick admin labelling.
3695 #[prost(int32, tag="4")]
3696 pub duration_seconds: i32,
3697 /// Optional platform identifier from the vocabulary
3698 /// {"ios", "android", "macos", "windows", "linux"}. The admin
3699 /// renders unknown values verbatim for forward compatibility.
3700 #[prost(string, tag="5")]
3701 pub platform: ::prost::alloc::string::String,
3702}
3703/// Per-screen dwell distribution within an archetype. Lets the admin
3704/// surface "this archetype lingers 8.2s on the Message Detail screen
3705/// vs 0.4s on the Inbox list".
3706#[derive(Clone, PartialEq, ::prost::Message)]
3707pub struct ScreenDwell {
3708 /// One entry per screen. Screens with fewer than k members in the
3709 /// archetype are dropped from the list (not marked as absent).
3710 #[prost(message, repeated, tag="1")]
3711 pub entries: ::prost::alloc::vec::Vec<ScreenDwellEntry>,
3712}
3713#[derive(Clone, PartialEq, ::prost::Message)]
3714pub struct ScreenDwellEntry {
3715 /// Stable screen identifier (e.g., "MessageDetail", "Inbox",
3716 /// "ProfileSettings"). Sourced from the same screen_name vocabulary
3717 /// used by heatmap_cells.
3718 #[prost(string, tag="1")]
3719 pub screen_name: ::prost::alloc::string::String,
3720 /// Median dwell time in seconds for this archetype on this screen.
3721 #[prost(double, tag="2")]
3722 pub median_seconds: f64,
3723 /// 75th-percentile dwell time in seconds.
3724 #[prost(double, tag="3")]
3725 pub p75_seconds: f64,
3726 /// Number of distinct sessions aggregated for this screen.
3727 #[prost(int32, tag="4")]
3728 pub session_count: i32,
3729}
3730/// End-to-end response latencies for members of one archetype, in
3731/// seconds. Each percentile is computed across all qualifying campaign
3732/// deliveries for the archetype's members within the rolling window.
3733#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3734pub struct ResponseTimeline {
3735 /// Time from `delivered_at` to `read_at`, in seconds.
3736 #[prost(message, optional, tag="1")]
3737 pub read_after_delivered: ::core::option::Option<LatencyPercentiles>,
3738 /// Time from `read_at` to `acknowledged_at`, in seconds. Only
3739 /// includes deliveries that were both read and acknowledged.
3740 #[prost(message, optional, tag="2")]
3741 pub ack_after_read: ::core::option::Option<LatencyPercentiles>,
3742 /// End-to-end time from `delivered_at` to `acknowledged_at`, in
3743 /// seconds. Only includes deliveries that were acknowledged.
3744 #[prost(message, optional, tag="3")]
3745 pub ack_after_delivered: ::core::option::Option<LatencyPercentiles>,
3746 /// Number of deliveries the timeline is computed over.
3747 #[prost(int32, tag="4")]
3748 pub delivery_count: i32,
3749}
3750/// Latency distribution stats. Values are in seconds.
3751#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3752pub struct LatencyPercentiles {
3753 #[prost(double, tag="1")]
3754 pub p50: f64,
3755 #[prost(double, tag="2")]
3756 pub p75: f64,
3757 #[prost(double, tag="3")]
3758 pub p95: f64,
3759}
3760/// A cohort-level prediction for campaign acknowledgment rate.
3761/// Never targets or scores individuals — always represents an audience aggregate.
3762#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3763pub struct CohortPrediction {
3764 /// Predicted ACK rate for the audience (0.0-1.0).
3765 #[prost(float, tag="1")]
3766 pub predicted_ack_rate: f32,
3767 /// Lower bound of the confidence interval.
3768 #[prost(float, tag="2")]
3769 pub confidence_low: f32,
3770 /// Upper bound of the confidence interval.
3771 #[prost(float, tag="3")]
3772 pub confidence_high: f32,
3773 /// Confidence level based on available data volume.
3774 #[prost(enumeration="ConfidenceLevel", tag="4")]
3775 pub confidence_level: i32,
3776 /// Number of anonymous data points used for this prediction.
3777 #[prost(int32, tag="5")]
3778 pub data_point_count: i32,
3779}
3780/// Advisory information for campaign configuration, combining predictions and archetypes.
3781#[derive(Clone, PartialEq, ::prost::Message)]
3782pub struct CampaignAdvisory {
3783 /// Cohort-level ACK prediction for the target audience.
3784 #[prost(message, optional, tag="1")]
3785 pub predicted_ack: ::core::option::Option<CohortPrediction>,
3786 /// Suggested escalation delay in minutes based on historical cohort patterns.
3787 /// 0 if insufficient data.
3788 #[prost(int32, tag="2")]
3789 pub suggested_escalation_delay_minutes: i32,
3790 /// Behavioral archetypes for the target audience.
3791 #[prost(message, repeated, tag="3")]
3792 pub archetypes: ::prost::alloc::vec::Vec<Archetype>,
3793}
3794/// Request to retrieve behavioral archetypes for a group.
3795#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3796pub struct GetGroupArchetypesRequest {
3797 /// ID of the group to query archetypes for. Required.
3798 #[prost(string, tag="1")]
3799 pub group_id: ::prost::alloc::string::String,
3800}
3801/// Response containing behavioral archetypes for a group.
3802#[derive(Clone, PartialEq, ::prost::Message)]
3803pub struct GetGroupArchetypesResponse {
3804 /// Behavioral archetypes for the group (empty if insufficient data).
3805 #[prost(message, repeated, tag="1")]
3806 pub archetypes: ::prost::alloc::vec::Vec<Archetype>,
3807 /// Number of anonymous feature vectors used for clustering.
3808 #[prost(int32, tag="2")]
3809 pub data_point_count: i32,
3810 /// Why `archetypes` looks the way it does. Lets the UI render a
3811 /// distinct empty-state affordance for "never trained" vs
3812 /// "below threshold" vs "no clusters" vs "ready". See PipelineState.
3813 #[prost(enumeration="PipelineState", tag="3")]
3814 pub pipeline_state: i32,
3815 /// Confidence in the returned archetypes, derived from available data
3816 /// volume. Always CONFIDENCE_LEVEL_LOW when provisional archetypes
3817 /// are returned — clients use this plus `Archetype.source` to render
3818 /// the low-confidence disclaimer.
3819 #[prost(enumeration="ConfidenceLevel", tag="4")]
3820 pub confidence_level: i32,
3821}
3822/// Request to predict cohort-level ACK rate for a campaign configuration.
3823#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3824pub struct PredictCampaignAckRequest {
3825 /// ID of the target audience group. Required.
3826 #[prost(string, tag="1")]
3827 pub group_id: ::prost::alloc::string::String,
3828 /// Template type (optional, for prediction refinement).
3829 #[prost(string, tag="2")]
3830 pub template_type: ::prost::alloc::string::String,
3831 /// Number of workflow steps (optional, for prediction refinement).
3832 #[prost(int32, tag="3")]
3833 pub workflow_step_count: i32,
3834}
3835/// Response containing a cohort-level ACK prediction.
3836#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3837pub struct PredictCampaignAckResponse {
3838 /// Cohort-level prediction.
3839 #[prost(message, optional, tag="1")]
3840 pub prediction: ::core::option::Option<CohortPrediction>,
3841}
3842/// Request for campaign configuration advisory.
3843#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3844pub struct GetCampaignAdvisoryRequest {
3845 /// ID of the target audience group. Required.
3846 #[prost(string, tag="1")]
3847 pub group_id: ::prost::alloc::string::String,
3848 /// Template ID (optional, for advisory context).
3849 #[prost(string, tag="2")]
3850 pub template_id: ::prost::alloc::string::String,
3851 /// Template version (optional).
3852 #[prost(int32, tag="3")]
3853 pub template_version: i32,
3854 /// Number of workflow steps (optional).
3855 #[prost(int32, tag="4")]
3856 pub workflow_step_count: i32,
3857}
3858/// Response containing campaign advisory information.
3859#[derive(Clone, PartialEq, ::prost::Message)]
3860pub struct GetCampaignAdvisoryResponse {
3861 /// Campaign advisory with prediction, suggested escalation, and archetypes.
3862 #[prost(message, optional, tag="1")]
3863 pub advisory: ::core::option::Option<CampaignAdvisory>,
3864}
3865/// Request to generate an AI narrative for a group's insights.
3866#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3867pub struct GetInsightNarrativeRequest {
3868 /// ID of the group to generate a narrative for. Required.
3869 #[prost(string, tag="1")]
3870 pub group_id: ::prost::alloc::string::String,
3871 /// Name of the prompt template to use (e.g., "campaign-advisory", "archetype-explanation").
3872 #[prost(string, tag="2")]
3873 pub prompt_name: ::prost::alloc::string::String,
3874}
3875/// Response containing an AI-generated narrative.
3876#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3877pub struct GetInsightNarrativeResponse {
3878 /// AI-generated narrative text (Markdown formatted).
3879 #[prost(string, tag="1")]
3880 pub narrative: ::prost::alloc::string::String,
3881 /// Timestamp when the narrative was generated.
3882 #[prost(message, optional, tag="2")]
3883 pub generated_at: ::core::option::Option<::prost_types::Timestamp>,
3884 /// Model identifier used for generation.
3885 #[prost(string, tag="3")]
3886 pub model_id: ::prost::alloc::string::String,
3887}
3888/// Request to manually trigger the ML training pipeline.
3889/// Empty — organization is extracted from the JWT.
3890#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3891pub struct TriggerMlPipelineRequest {
3892}
3893/// Response after triggering the ML pipeline.
3894#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3895pub struct TriggerMlPipelineResponse {
3896 /// Remaining manual retrains allowed this month.
3897 #[prost(int32, tag="1")]
3898 pub remaining_this_month: i32,
3899 /// Timestamp of the last successful training (null if never trained).
3900 #[prost(message, optional, tag="2")]
3901 pub last_trained_at: ::core::option::Option<::prost_types::Timestamp>,
3902}
3903/// Request to manually retrigger archetype clustering for a single group
3904/// without rerunning the full SageMaker training pipeline. Reuses the
3905/// already-deployed clustering model.
3906#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3907pub struct TriggerArchetypeClusteringRequest {
3908 /// Group to recluster. Org is extracted from the JWT.
3909 #[prost(string, tag="1")]
3910 pub group_id: ::prost::alloc::string::String,
3911}
3912/// Response after triggering archetype clustering for one group.
3913#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3914pub struct TriggerArchetypeClusteringResponse {
3915 /// Temporal workflow id — useful for client-side dedupe + operator
3916 /// debugging via the Temporal UI.
3917 #[prost(string, tag="1")]
3918 pub workflow_id: ::prost::alloc::string::String,
3919 /// Remaining manual retrains allowed this month. Shares the same
3920 /// monthly counter as TriggerMLPipeline (ml_manual_limit_monthly).
3921 #[prost(int32, tag="2")]
3922 pub remaining_this_month: i32,
3923 /// Timestamp of the last successful archetype clustering for this
3924 /// (org, group), null if never clustered.
3925 #[prost(message, optional, tag="3")]
3926 pub last_clustered_at: ::core::option::Option<::prost_types::Timestamp>,
3927}
3928/// Request to draft a campaign body for a given archetype using Bedrock.
3929/// Used by the Compass "Target this archetype in a new campaign" CTA to
3930/// pre-fill the campaign creation wizard's body field.
3931#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3932pub struct GenerateCampaignBodyDraftRequest {
3933 /// UUID of the source group whose archetype set the label belongs to.
3934 #[prost(string, tag="1")]
3935 pub group_id: ::prost::alloc::string::String,
3936 /// Stable archetype label, e.g. "Swift Acknowledger".
3937 #[prost(string, tag="2")]
3938 pub archetype_label: ::prost::alloc::string::String,
3939 /// Lane-recommended action copy passed through from the admin (e.g.
3940 /// "Simplify the call-to-action"). Used as a tone hint for the prompt.
3941 #[prost(string, tag="3")]
3942 pub lane_action: ::prost::alloc::string::String,
3943}
3944/// Response containing the generated draft body in Markdown.
3945#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3946pub struct GenerateCampaignBodyDraftResponse {
3947 /// Draft Markdown body, 3-5 sentences. Authored as if written for the
3948 /// recipient — does not mention the archetype name.
3949 #[prost(string, tag="1")]
3950 pub body_markdown: ::prost::alloc::string::String,
3951}
3952// ─── Enums ──────────────────────────────────────────────────────────────────
3953
3954/// Confidence level for cohort-level predictions, based on available data volume.
3955#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
3956#[repr(i32)]
3957pub enum ConfidenceLevel {
3958 Unspecified = 0,
3959 /// Fewer than 50 campaigns — predictions based on heuristics/industry benchmarks.
3960 Low = 1,
3961 /// 50-200 campaigns — basic clustering available, wide confidence intervals.
3962 Medium = 2,
3963 /// 200+ campaigns — full ML pipeline, narrow confidence intervals.
3964 High = 3,
3965}
3966impl ConfidenceLevel {
3967 /// String value of the enum field names used in the ProtoBuf definition.
3968 ///
3969 /// The values are not transformed in any way and thus are considered stable
3970 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3971 pub fn as_str_name(&self) -> &'static str {
3972 match self {
3973 Self::Unspecified => "CONFIDENCE_LEVEL_UNSPECIFIED",
3974 Self::Low => "CONFIDENCE_LEVEL_LOW",
3975 Self::Medium => "CONFIDENCE_LEVEL_MEDIUM",
3976 Self::High => "CONFIDENCE_LEVEL_HIGH",
3977 }
3978 }
3979 /// Creates an enum from field names used in the ProtoBuf definition.
3980 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3981 match value {
3982 "CONFIDENCE_LEVEL_UNSPECIFIED" => Some(Self::Unspecified),
3983 "CONFIDENCE_LEVEL_LOW" => Some(Self::Low),
3984 "CONFIDENCE_LEVEL_MEDIUM" => Some(Self::Medium),
3985 "CONFIDENCE_LEVEL_HIGH" => Some(Self::High),
3986 _ => None,
3987 }
3988 }
3989}
3990/// Pipeline state for a group's archetypes. Lets the admin UI render
3991/// distinct empty-state affordances ("run clustering" vs "need N more
3992/// sessions" vs "pipeline ran but audience was too homogeneous") instead
3993/// of treating every empty archetype list the same. Populated by
3994/// InsightsService.GetGroupArchetypes.
3995#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
3996#[repr(i32)]
3997pub enum PipelineState {
3998 Unspecified = 0,
3999 /// The ML pipeline has never fired for this org. Archetypes are
4000 /// empty because nothing ran, not because of data shape.
4001 NeverRun = 1,
4002 /// The pipeline ran but the group had fewer than the k-anonymization
4003 /// minimum feature vectors (50), so clustering was skipped. UI
4004 /// renders "keep running campaigns" affordance.
4005 BelowThreshold = 2,
4006 /// The pipeline ran with enough vectors but the clustering provider
4007 /// returned zero clusters — typically means the audience is too
4008 /// homogeneous to separate into distinct archetypes.
4009 NoClusters = 3,
4010 /// Archetypes are populated and ready to render.
4011 Ready = 4,
4012}
4013impl PipelineState {
4014 /// String value of the enum field names used in the ProtoBuf definition.
4015 ///
4016 /// The values are not transformed in any way and thus are considered stable
4017 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
4018 pub fn as_str_name(&self) -> &'static str {
4019 match self {
4020 Self::Unspecified => "PIPELINE_STATE_UNSPECIFIED",
4021 Self::NeverRun => "PIPELINE_STATE_NEVER_RUN",
4022 Self::BelowThreshold => "PIPELINE_STATE_BELOW_THRESHOLD",
4023 Self::NoClusters => "PIPELINE_STATE_NO_CLUSTERS",
4024 Self::Ready => "PIPELINE_STATE_READY",
4025 }
4026 }
4027 /// Creates an enum from field names used in the ProtoBuf definition.
4028 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4029 match value {
4030 "PIPELINE_STATE_UNSPECIFIED" => Some(Self::Unspecified),
4031 "PIPELINE_STATE_NEVER_RUN" => Some(Self::NeverRun),
4032 "PIPELINE_STATE_BELOW_THRESHOLD" => Some(Self::BelowThreshold),
4033 "PIPELINE_STATE_NO_CLUSTERS" => Some(Self::NoClusters),
4034 "PIPELINE_STATE_READY" => Some(Self::Ready),
4035 _ => None,
4036 }
4037 }
4038}
4039/// Where an archetype came from. Lets clients distinguish trained ML
4040/// clustering output from low-confidence provisional output generated
4041/// for sandboxes and opted-in organizations before enough engagement
4042/// data exists. Clients MUST render a low-confidence disclaimer for
4043/// PROVISIONAL archetypes.
4044#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
4045#[repr(i32)]
4046pub enum ArchetypeSource {
4047 Unspecified = 0,
4048 /// Produced by the trained ML clustering pipeline (k-anonymized,
4049 /// DP-noised behavioral feature vectors).
4050 Ml = 1,
4051 /// Rule-based provisional output derived from coarse delivery/read/
4052 /// ack activity (or a stable starter distribution for sandboxes with
4053 /// no activity). Low confidence, never written to the ML artifact
4054 /// path, and always superseded by ML output once available.
4055 Provisional = 2,
4056}
4057impl ArchetypeSource {
4058 /// String value of the enum field names used in the ProtoBuf definition.
4059 ///
4060 /// The values are not transformed in any way and thus are considered stable
4061 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
4062 pub fn as_str_name(&self) -> &'static str {
4063 match self {
4064 Self::Unspecified => "ARCHETYPE_SOURCE_UNSPECIFIED",
4065 Self::Ml => "ARCHETYPE_SOURCE_ML",
4066 Self::Provisional => "ARCHETYPE_SOURCE_PROVISIONAL",
4067 }
4068 }
4069 /// Creates an enum from field names used in the ProtoBuf definition.
4070 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4071 match value {
4072 "ARCHETYPE_SOURCE_UNSPECIFIED" => Some(Self::Unspecified),
4073 "ARCHETYPE_SOURCE_ML" => Some(Self::Ml),
4074 "ARCHETYPE_SOURCE_PROVISIONAL" => Some(Self::Provisional),
4075 _ => None,
4076 }
4077 }
4078}
4079// ─── Messages ───────────────────────────────────────────────────────────────
4080
4081/// A single reachability registry row, returned by `GetReachability` and
4082/// `ListReachabilityForUser`. The plaintext identifier and envelope ciphertext
4083/// are NEVER returned over the wire — only metadata. The dispatch worker reads
4084/// the plaintext directly from the database and decrypts via KMS.
4085#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4086pub struct Reachability {
4087 /// Server-assigned row identifier (UUID).
4088 #[prost(string, tag="1")]
4089 pub id: ::prost::alloc::string::String,
4090 /// Organization that owns this reachability entry.
4091 #[prost(string, tag="2")]
4092 pub org_id: ::prost::alloc::string::String,
4093 /// User this reachability entry is for.
4094 #[prost(string, tag="3")]
4095 pub user_id: ::prost::alloc::string::String,
4096 /// Channel for which this entry stores a contact identifier.
4097 #[prost(enumeration="ChannelName", tag="4")]
4098 pub channel: i32,
4099 /// When the row was first written.
4100 #[prost(message, optional, tag="5")]
4101 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
4102 /// When the row was last upserted.
4103 #[prost(message, optional, tag="6")]
4104 pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
4105 /// Optional AWS region identifier (e.g. "eu-west-1") this user's data must
4106 /// remain in for GDPR/residency reasons. Unset means "no constraint."
4107 /// Enforcement happens at dispatch time, not write time.
4108 #[prost(string, optional, tag="7")]
4109 pub region_constraint: ::core::option::Option<::prost::alloc::string::String>,
4110}
4111/// Per-(org, channel) region allowlist used by the dispatch worker to enforce
4112/// data-residency policy. An empty `allowed_regions` list means "no policy
4113/// configured" — NOT "no regions allowed."
4114#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4115pub struct RegionPolicy {
4116 #[prost(string, tag="1")]
4117 pub org_id: ::prost::alloc::string::String,
4118 #[prost(enumeration="ChannelName", tag="2")]
4119 pub channel: i32,
4120 /// AWS region identifiers (e.g. "eu-west-1", "us-east-1"). Empty list ==
4121 /// "no policy configured" — the dispatch worker SHALL NOT block on empty.
4122 #[prost(string, repeated, tag="3")]
4123 pub allowed_regions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
4124 #[prost(message, optional, tag="4")]
4125 pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
4126}
4127// ─── Enums ──────────────────────────────────────────────────────────────────
4128
4129/// Terminal status of a single dispatch attempt as returned by the worker-mode
4130/// `DispatchToChannel` RPC. Distinct from the richer `ChannelEventStatus` in
4131/// `channel_events.proto`, which models the audit-trail row for every state
4132/// transition (SENT → DELIVERED → OPENED → …). DispatchStatus is the immediate
4133/// outcome of one worker call.
4134#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
4135#[repr(i32)]
4136pub enum DispatchStatus {
4137 /// Default value; should not be used explicitly.
4138 Unspecified = 0,
4139 /// The adapter accepted the message for delivery (provider returned success).
4140 Sent = 1,
4141 /// The adapter returned a terminal error (e.g. recipient blocked, domain not
4142 /// verified). Retries SHALL NOT be attempted; consult `failure_reason`.
4143 Failed = 2,
4144 /// An existing `(dispatch_id, SENT)` row was found by the idempotency guard
4145 /// before the adapter was called; the prior receipt was returned without a
4146 /// second provider call.
4147 Deduped = 3,
4148}
4149impl DispatchStatus {
4150 /// String value of the enum field names used in the ProtoBuf definition.
4151 ///
4152 /// The values are not transformed in any way and thus are considered stable
4153 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
4154 pub fn as_str_name(&self) -> &'static str {
4155 match self {
4156 Self::Unspecified => "DISPATCH_STATUS_UNSPECIFIED",
4157 Self::Sent => "DISPATCH_STATUS_SENT",
4158 Self::Failed => "DISPATCH_STATUS_FAILED",
4159 Self::Deduped => "DISPATCH_STATUS_DEDUPED",
4160 }
4161 }
4162 /// Creates an enum from field names used in the ProtoBuf definition.
4163 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4164 match value {
4165 "DISPATCH_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
4166 "DISPATCH_STATUS_SENT" => Some(Self::Sent),
4167 "DISPATCH_STATUS_FAILED" => Some(Self::Failed),
4168 "DISPATCH_STATUS_DEDUPED" => Some(Self::Deduped),
4169 _ => None,
4170 }
4171 }
4172}
4173// ─── DispatchToChannel ──────────────────────────────────────────────────────
4174
4175/// Worker-mode entry point invoked by the Temporal worker for one recipient.
4176/// Idempotent on `dispatch_id`: if a `(dispatch_id, SENT)` row already exists
4177/// in `channel_dispatches`, the worker SHALL return DISPATCH_STATUS_DEDUPED
4178/// without re-invoking the channel adapter.
4179#[derive(Clone, PartialEq, ::prost::Message)]
4180pub struct DispatchToChannelRequest {
4181 /// Idempotency key. Must be stable across retries from pidgr-api side.
4182 #[prost(string, tag="1")]
4183 pub dispatch_id: ::prost::alloc::string::String,
4184 #[prost(string, tag="2")]
4185 pub org_id: ::prost::alloc::string::String,
4186 #[prost(string, tag="3")]
4187 pub user_id: ::prost::alloc::string::String,
4188 /// Which channel adapter to invoke (EMAIL is the Wave 1 implementation).
4189 #[prost(enumeration="ChannelName", tag="4")]
4190 pub channel: i32,
4191 /// Template to render before dispatch.
4192 #[prost(string, tag="5")]
4193 pub template_id: ::prost::alloc::string::String,
4194 /// Per-recipient template variables.
4195 #[prost(map="string, string", tag="6")]
4196 pub template_vars: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
4197 /// BCP-47 locale used to select the template translation.
4198 #[prost(string, tag="7")]
4199 pub locale: ::prost::alloc::string::String,
4200 /// Optional AWS region the worker MUST dispatch from (typically copied from
4201 /// the recipient's reachability row). Unset means "no constraint."
4202 #[prost(string, optional, tag="8")]
4203 pub region_constraint: ::core::option::Option<::prost::alloc::string::String>,
4204}
4205#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4206pub struct DispatchToChannelResponse {
4207 /// Echoes back the request's `dispatch_id`.
4208 #[prost(string, tag="1")]
4209 pub dispatch_id: ::prost::alloc::string::String,
4210 /// Terminal outcome of this call.
4211 #[prost(enumeration="DispatchStatus", tag="2")]
4212 pub status: i32,
4213 /// Human-readable failure reason; set only when `status` is
4214 /// DISPATCH_STATUS_FAILED.
4215 #[prost(string, optional, tag="3")]
4216 pub failure_reason: ::core::option::Option<::prost::alloc::string::String>,
4217}
4218// ─── UpsertReachability ─────────────────────────────────────────────────────
4219
4220/// Records a recipient identifier for a (user, channel) tuple. The plaintext
4221/// identifier is column-level KMS-encrypted on insert and never logged or
4222/// returned. The server computes the org-scoped HMAC lookup hash so opt-out
4223/// webhooks can find the row without decrypt.
4224#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4225pub struct UpsertReachabilityRequest {
4226 #[prost(string, tag="1")]
4227 pub org_id: ::prost::alloc::string::String,
4228 #[prost(string, tag="2")]
4229 pub user_id: ::prost::alloc::string::String,
4230 #[prost(enumeration="ChannelName", tag="3")]
4231 pub channel: i32,
4232 /// The plaintext identifier (email address, phone number, Slack user ID,
4233 /// Telegram chat ID, etc.). Encrypted at rest server-side. Servers MUST NOT
4234 /// log this field. Clients SHOULD treat this message as sensitive.
4235 #[prost(string, tag="4")]
4236 pub identifier_plaintext: ::prost::alloc::string::String,
4237 /// Optional AWS region this user's data must remain in (e.g. "eu-west-1").
4238 /// Recorded but NOT enforced at write time; enforcement is at dispatch.
4239 #[prost(string, optional, tag="5")]
4240 pub region_constraint: ::core::option::Option<::prost::alloc::string::String>,
4241}
4242#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4243pub struct UpsertReachabilityResponse {
4244 /// The metadata for the upserted row. Plaintext identifier and envelope
4245 /// ciphertext are intentionally absent.
4246 #[prost(message, optional, tag="1")]
4247 pub reachability: ::core::option::Option<Reachability>,
4248}
4249// ─── RemoveReachability ─────────────────────────────────────────────────────
4250
4251/// Idempotent removal. GDPR Recital 30 audit row is appended via internal-mTLS
4252/// BEFORE the registry row is deleted (see AuditService.Append). If no row
4253/// existed, `removed = false` and no audit row is emitted.
4254#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4255pub struct RemoveReachabilityRequest {
4256 #[prost(string, tag="1")]
4257 pub org_id: ::prost::alloc::string::String,
4258 #[prost(string, tag="2")]
4259 pub user_id: ::prost::alloc::string::String,
4260 #[prost(enumeration="ChannelName", tag="3")]
4261 pub channel: i32,
4262}
4263#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4264pub struct RemoveReachabilityResponse {
4265 /// True if a row was deleted. False if no row existed for the tuple
4266 /// (idempotent success).
4267 #[prost(bool, tag="1")]
4268 pub removed: bool,
4269}
4270// ─── GetReachability ────────────────────────────────────────────────────────
4271
4272/// Returns the reachability metadata for a single (user, channel) tuple.
4273/// Returns NOT_FOUND if no row exists.
4274#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4275pub struct GetReachabilityRequest {
4276 #[prost(string, tag="1")]
4277 pub org_id: ::prost::alloc::string::String,
4278 #[prost(string, tag="2")]
4279 pub user_id: ::prost::alloc::string::String,
4280 #[prost(enumeration="ChannelName", tag="3")]
4281 pub channel: i32,
4282}
4283#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4284pub struct GetReachabilityResponse {
4285 /// Plaintext identifier and envelope ciphertext are intentionally absent.
4286 #[prost(message, optional, tag="1")]
4287 pub reachability: ::core::option::Option<Reachability>,
4288}
4289// ─── ListReachabilityForUser ────────────────────────────────────────────────
4290
4291/// Returns one Reachability entry per channel configured for a (org, user)
4292/// pair. Used by the admin-side per-user matrix view. Plaintext identifiers
4293/// and envelope ciphertext are intentionally absent — the admin UI only needs
4294/// to know which channels are configured.
4295#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4296pub struct ListReachabilityForUserRequest {
4297 #[prost(string, tag="1")]
4298 pub org_id: ::prost::alloc::string::String,
4299 #[prost(string, tag="2")]
4300 pub user_id: ::prost::alloc::string::String,
4301}
4302#[derive(Clone, PartialEq, ::prost::Message)]
4303pub struct ListReachabilityForUserResponse {
4304 /// One entry per channel that has a row for the (org_id, user_id) pair.
4305 #[prost(message, repeated, tag="1")]
4306 pub reachabilities: ::prost::alloc::vec::Vec<Reachability>,
4307}
4308// ─── GetRegionPolicy / SetRegionPolicy ──────────────────────────────────────
4309
4310#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4311pub struct GetRegionPolicyRequest {
4312 #[prost(string, tag="1")]
4313 pub org_id: ::prost::alloc::string::String,
4314 #[prost(enumeration="ChannelName", tag="2")]
4315 pub channel: i32,
4316}
4317#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4318pub struct GetRegionPolicyResponse {
4319 /// Always populated. Empty `allowed_regions` means "no policy configured"
4320 /// — NOT "no regions allowed."
4321 #[prost(message, optional, tag="1")]
4322 pub policy: ::core::option::Option<RegionPolicy>,
4323}
4324/// Admin-only upsert. Empty `allowed_regions` clears the policy.
4325#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4326pub struct SetRegionPolicyRequest {
4327 #[prost(string, tag="1")]
4328 pub org_id: ::prost::alloc::string::String,
4329 #[prost(enumeration="ChannelName", tag="2")]
4330 pub channel: i32,
4331 /// AWS region identifiers (e.g. "eu-west-1"). Empty list == "no policy."
4332 #[prost(string, repeated, tag="3")]
4333 pub allowed_regions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
4334}
4335#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4336pub struct SetRegionPolicyResponse {
4337 #[prost(message, optional, tag="1")]
4338 pub policy: ::core::option::Option<RegionPolicy>,
4339}
4340// ─── GetCostCapPolicy / SetCostCapPolicy ────────────────────────────────────
4341
4342/// Get the cost-cap state for the current calendar-month period (UTC). When
4343/// no row exists for `(org_id, channel, period_yyyymm)`, the server returns
4344/// the channel default cap from server config
4345/// (`COST_CAP_DEFAULT_${CHANNEL}_MICROS`) with `used_micros = 0`.
4346#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4347pub struct GetCostCapPolicyRequest {
4348 #[prost(string, tag="1")]
4349 pub org_id: ::prost::alloc::string::String,
4350 #[prost(enumeration="ChannelName", tag="2")]
4351 pub channel: i32,
4352}
4353#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4354pub struct GetCostCapPolicyResponse {
4355 #[prost(string, tag="1")]
4356 pub org_id: ::prost::alloc::string::String,
4357 #[prost(enumeration="ChannelName", tag="2")]
4358 pub channel: i32,
4359 /// Current period's cap in micros (1/1_000_000 of a USD).
4360 #[prost(int64, tag="3")]
4361 pub cap_micros: i64,
4362 /// Current period's accumulated spend in micros.
4363 #[prost(int64, tag="4")]
4364 pub used_micros: i64,
4365 /// Calendar-month period in integer YYYYMM form (e.g. 202605 for May 2026).
4366 #[prost(int32, tag="5")]
4367 pub period_yyyymm: i32,
4368}
4369/// Admin-only upsert of the cap for the current calendar-month period. Future
4370/// periods inherit the most recent SetCostCapPolicy value until the next call.
4371#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4372pub struct SetCostCapPolicyRequest {
4373 #[prost(string, tag="1")]
4374 pub org_id: ::prost::alloc::string::String,
4375 #[prost(enumeration="ChannelName", tag="2")]
4376 pub channel: i32,
4377 #[prost(int64, tag="3")]
4378 pub cap_micros: i64,
4379}
4380#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4381pub struct SetCostCapPolicyResponse {
4382 #[prost(string, tag="1")]
4383 pub org_id: ::prost::alloc::string::String,
4384 #[prost(enumeration="ChannelName", tag="2")]
4385 pub channel: i32,
4386 #[prost(int64, tag="3")]
4387 pub cap_micros: i64,
4388 #[prost(int64, tag="4")]
4389 pub used_micros: i64,
4390 #[prost(int32, tag="5")]
4391 pub period_yyyymm: i32,
4392}
4393// ─── GetOrgWebhookConfig / SetOrgWebhookConfig ──────────────────────────────
4394
4395/// Get the org's generic-webhook channel configuration. The shared secret is
4396/// write-only and never returned — `has_secret` reports whether one is set.
4397#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4398pub struct GetOrgWebhookConfigRequest {
4399 #[prost(string, tag="1")]
4400 pub org_id: ::prost::alloc::string::String,
4401}
4402#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4403pub struct GetOrgWebhookConfigResponse {
4404 #[prost(string, tag="1")]
4405 pub org_id: ::prost::alloc::string::String,
4406 /// Destination URL Pidgr POSTs notification events to. Empty when no
4407 /// configuration exists.
4408 #[prost(string, tag="2")]
4409 pub url: ::prost::alloc::string::String,
4410 /// Whether dispatch via the WEBHOOK channel is enabled for the org.
4411 #[prost(bool, tag="3")]
4412 pub enabled: bool,
4413 /// Whether a signing secret is currently configured. The secret itself is
4414 /// never returned.
4415 #[prost(bool, tag="4")]
4416 pub has_secret: bool,
4417 #[prost(message, optional, tag="5")]
4418 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
4419 #[prost(message, optional, tag="6")]
4420 pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
4421}
4422/// Admin-only upsert of the org's generic-webhook configuration. The server
4423/// validates the URL (https-only, public addresses only) before persisting,
4424/// and envelope-encrypts the secret at rest. Setting a new `secret` rotates
4425/// it; leaving `secret` unset keeps the existing one.
4426#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4427pub struct SetOrgWebhookConfigRequest {
4428 #[prost(string, tag="1")]
4429 pub org_id: ::prost::alloc::string::String,
4430 /// Destination URL. Constraints: https scheme; non-private, non-loopback
4431 /// host. Validation failures return `invalid_argument`.
4432 #[prost(string, tag="2")]
4433 pub url: ::prost::alloc::string::String,
4434 #[prost(bool, tag="3")]
4435 pub enabled: bool,
4436 /// Shared secret used for the `X-Pidgr-Signature` HMAC-SHA256 header.
4437 /// Write-only. Unset keeps the current secret; set rotates it.
4438 /// Constraints: 16–256 bytes when set.
4439 #[prost(string, optional, tag="4")]
4440 pub secret: ::core::option::Option<::prost::alloc::string::String>,
4441}
4442#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4443pub struct SetOrgWebhookConfigResponse {
4444 #[prost(string, tag="1")]
4445 pub org_id: ::prost::alloc::string::String,
4446 #[prost(string, tag="2")]
4447 pub url: ::prost::alloc::string::String,
4448 #[prost(bool, tag="3")]
4449 pub enabled: bool,
4450 #[prost(bool, tag="4")]
4451 pub has_secret: bool,
4452 #[prost(message, optional, tag="5")]
4453 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
4454 #[prost(message, optional, tag="6")]
4455 pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
4456}
4457// ─── CreateChannelConnectLink ───────────────────────────────────────────────
4458
4459/// Mints a short-lived, HMAC-signed opt-in link a user follows to bind a
4460/// third-party channel to their (org, user). Only follow-style channels are
4461/// accepted: CHANNEL_NAME_TELEGRAM (bot-follow), CHANNEL_NAME_SLACK (OAuth),
4462/// CHANNEL_NAME_LINE (follow-code). Any other channel is rejected server-side
4463/// with `invalid_argument`. Wraps the pidgr-api `internal/linktoken` minter.
4464#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4465pub struct CreateChannelConnectLinkRequest {
4466 #[prost(string, tag="1")]
4467 pub org_id: ::prost::alloc::string::String,
4468 /// Internal user UUID; resolved via UserResolver on the server. The minted
4469 /// token binds the resulting channel identifier to this (org, user).
4470 #[prost(string, tag="2")]
4471 pub user_id: ::prost::alloc::string::String,
4472 /// Channel to connect. Constraints: must be one of CHANNEL_NAME_TELEGRAM,
4473 /// CHANNEL_NAME_SLACK, CHANNEL_NAME_LINE. Other values return
4474 /// `invalid_argument`.
4475 #[prost(enumeration="ChannelName", tag="3")]
4476 pub channel: i32,
4477}
4478#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4479pub struct CreateChannelConnectLinkResponse {
4480 /// The deep link the client renders for the user to follow (e.g. a
4481 /// Telegram bot-follow URL, Slack OAuth authorize URL, or LINE follow URL).
4482 #[prost(string, tag="1")]
4483 pub connect_url: ::prost::alloc::string::String,
4484 /// The raw 64-char base64url opt-in token embedded in `connect_url`,
4485 /// surfaced separately so clients can render it as a QR code or copy
4486 /// button. Implementation detail — clients SHOULD NOT parse or mutate it.
4487 #[prost(string, tag="2")]
4488 pub token: ::prost::alloc::string::String,
4489 /// When the minted token expires. After this time the link no longer
4490 /// binds and the user must request a fresh one.
4491 #[prost(message, optional, tag="3")]
4492 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
4493}
4494// ─── Messages ───────────────────────────────────────────────────────────────
4495
4496/// A shareable invite link that allows users to self-join an organization.
4497/// Links carry a role assignment and optional usage/expiry constraints.
4498#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4499pub struct InviteLink {
4500 /// Unique identifier for the invite link.
4501 #[prost(string, tag="1")]
4502 pub id: ::prost::alloc::string::String,
4503 /// Cryptographically random base64url-encoded token (43 characters).
4504 #[prost(string, tag="2")]
4505 pub token: ::prost::alloc::string::String,
4506 /// ID of the role assigned to users who redeem this link.
4507 #[prost(string, tag="3")]
4508 pub role_id: ::prost::alloc::string::String,
4509 /// Maximum number of times this link can be redeemed.
4510 /// 0 means unlimited.
4511 #[prost(int32, tag="4")]
4512 pub max_uses: i32,
4513 /// Number of times this link has been redeemed.
4514 #[prost(int32, tag="5")]
4515 pub use_count: i32,
4516 /// When the link expires. Empty if no expiry.
4517 #[prost(message, optional, tag="6")]
4518 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
4519 /// When the link was revoked. Empty if not revoked.
4520 #[prost(message, optional, tag="7")]
4521 pub revoked_at: ::core::option::Option<::prost_types::Timestamp>,
4522 /// ID of the admin who created the link.
4523 #[prost(string, tag="8")]
4524 pub created_by: ::prost::alloc::string::String,
4525 /// When the link was created.
4526 #[prost(message, optional, tag="9")]
4527 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
4528 /// Data governance region assigned to users who redeem this link. Empty means inherit from org default.
4529 /// Valid values: EU, LATAM, BR, APAC, US.
4530 #[prost(string, tag="10")]
4531 pub data_governance_region: ::prost::alloc::string::String,
4532}
4533/// Request to create a new invite link for the organization.
4534#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4535pub struct CreateInviteLinkRequest {
4536 /// ID of the role to assign. Defaults to the organization's employee role if empty.
4537 #[prost(string, tag="1")]
4538 pub role_id: ::prost::alloc::string::String,
4539 /// Maximum number of redemptions. 0 means unlimited.
4540 #[prost(int32, tag="2")]
4541 pub max_uses: i32,
4542 /// Number of hours until the link expires. 0 means no expiry.
4543 /// Constraints: Valid range 0 to 8760 (1 year).
4544 #[prost(int32, tag="3")]
4545 pub expires_in_hours: i32,
4546 /// Optional data governance region. Users who redeem this link inherit this region. Empty means inherit from org default.
4547 /// Valid values: EU, LATAM, BR, APAC, US.
4548 #[prost(string, tag="4")]
4549 pub data_governance_region: ::prost::alloc::string::String,
4550}
4551/// Response after creating an invite link.
4552#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4553pub struct CreateInviteLinkResponse {
4554 /// The newly created invite link.
4555 #[prost(message, optional, tag="1")]
4556 pub invite_link: ::core::option::Option<InviteLink>,
4557 /// Full URL for sharing (e.g. "<https://app.pidgr.com/join?token=<TOKEN>">).
4558 #[prost(string, tag="2")]
4559 pub url: ::prost::alloc::string::String,
4560}
4561/// Request to list all invite links for the organization.
4562#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4563pub struct ListInviteLinksRequest {
4564}
4565/// Response containing all invite links for the organization.
4566#[derive(Clone, PartialEq, ::prost::Message)]
4567pub struct ListInviteLinksResponse {
4568 /// All invite links (active, expired, maxed-out, and revoked), ordered by creation date descending.
4569 #[prost(message, repeated, tag="1")]
4570 pub invite_links: ::prost::alloc::vec::Vec<InviteLink>,
4571}
4572/// Request to revoke an invite link.
4573#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4574pub struct RevokeInviteLinkRequest {
4575 /// ID of the invite link to revoke. Required.
4576 #[prost(string, tag="1")]
4577 pub invite_link_id: ::prost::alloc::string::String,
4578}
4579/// Response after revoking an invite link.
4580#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4581pub struct RevokeInviteLinkResponse {
4582}
4583/// Request to redeem an invite link (authenticated — email extracted from JWT).
4584#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4585pub struct RedeemInviteLinkRequest {
4586 /// The invite link token from the URL query parameter.
4587 #[prost(string, tag="1")]
4588 pub token: ::prost::alloc::string::String,
4589}
4590/// Response after redeeming an invite link.
4591#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4592pub struct RedeemInviteLinkResponse {
4593 /// Name of the organization the user was added to.
4594 #[prost(string, tag="1")]
4595 pub organization_name: ::prost::alloc::string::String,
4596}
4597/// Request to validate an invite link and provision a user account if needed (unauthenticated).
4598#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4599pub struct ValidateInviteLinkRequest {
4600 /// The invite link token from the URL query parameter.
4601 #[prost(string, tag="1")]
4602 pub token: ::prost::alloc::string::String,
4603 /// Email address of the user joining the organization.
4604 /// Constraints: Max length 254 characters (RFC 5321).
4605 #[prost(string, tag="2")]
4606 pub email: ::prost::alloc::string::String,
4607}
4608/// Response after validating an invite link.
4609#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4610pub struct ValidateInviteLinkResponse {
4611 /// Name of the organization the invite link belongs to.
4612 #[prost(string, tag="1")]
4613 pub organization_name: ::prost::alloc::string::String,
4614}
4615// ─── Messages ───────────────────────────────────────────────────────────────
4616
4617/// Request to invite a new user to the organization.
4618#[derive(Clone, PartialEq, ::prost::Message)]
4619pub struct InviteUserRequest {
4620 /// Email address to send the invitation to.
4621 /// Constraints: Max length 254 characters (RFC 5321).
4622 #[prost(string, tag="1")]
4623 pub email: ::prost::alloc::string::String,
4624 /// Display name for the invited user.
4625 /// Constraints: Max length 200 characters.
4626 #[prost(string, tag="2")]
4627 pub name: ::prost::alloc::string::String,
4628 /// ID of the role to assign. Defaults to the organization's employee role if empty.
4629 #[prost(string, tag="4")]
4630 pub role_id: ::prost::alloc::string::String,
4631 /// Optional profile attributes to pre-fill at invitation time.
4632 #[prost(message, optional, tag="5")]
4633 pub profile: ::core::option::Option<UserProfile>,
4634 /// Optional data governance region for the invited user. Empty means inherit from org default.
4635 /// Valid values: EU, LATAM, BR, APAC, US.
4636 #[prost(string, tag="6")]
4637 pub data_governance_region: ::prost::alloc::string::String,
4638}
4639/// Response after inviting a user.
4640#[derive(Clone, PartialEq, ::prost::Message)]
4641pub struct InviteUserResponse {
4642 /// The newly created user (status: INVITED).
4643 #[prost(message, optional, tag="1")]
4644 pub user: ::core::option::Option<User>,
4645}
4646/// Request to retrieve a user by ID.
4647#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4648pub struct GetUserRequest {
4649 /// ID of the user to retrieve.
4650 #[prost(string, tag="1")]
4651 pub user_id: ::prost::alloc::string::String,
4652}
4653/// Response containing the requested user.
4654#[derive(Clone, PartialEq, ::prost::Message)]
4655pub struct GetUserResponse {
4656 /// The requested user.
4657 #[prost(message, optional, tag="1")]
4658 pub user: ::core::option::Option<User>,
4659}
4660/// Request to list users in the organization with pagination.
4661#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4662pub struct ListUsersRequest {
4663 /// Pagination parameters.
4664 #[prost(message, optional, tag="1")]
4665 pub pagination: ::core::option::Option<Pagination>,
4666}
4667/// Response containing a page of users.
4668#[derive(Clone, PartialEq, ::prost::Message)]
4669pub struct ListUsersResponse {
4670 /// List of users in this page.
4671 #[prost(message, repeated, tag="1")]
4672 pub users: ::prost::alloc::vec::Vec<User>,
4673 /// Pagination metadata for fetching subsequent pages.
4674 #[prost(message, optional, tag="2")]
4675 pub pagination_meta: ::core::option::Option<PaginationMeta>,
4676}
4677/// Request to change a user's role within the organization.
4678#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4679pub struct UpdateUserRoleRequest {
4680 /// ID of the user whose role to update.
4681 #[prost(string, tag="1")]
4682 pub user_id: ::prost::alloc::string::String,
4683 /// ID of the new role to assign.
4684 #[prost(string, tag="2")]
4685 pub role_id: ::prost::alloc::string::String,
4686}
4687/// Response after updating a user's role.
4688#[derive(Clone, PartialEq, ::prost::Message)]
4689pub struct UpdateUserRoleResponse {
4690 /// The updated user with the new role.
4691 #[prost(message, optional, tag="1")]
4692 pub user: ::core::option::Option<User>,
4693}
4694/// Request to deactivate a user within the organization.
4695#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4696pub struct DeactivateUserRequest {
4697 /// ID of the user to deactivate.
4698 #[prost(string, tag="1")]
4699 pub user_id: ::prost::alloc::string::String,
4700}
4701/// Response after deactivating a user.
4702#[derive(Clone, PartialEq, ::prost::Message)]
4703pub struct DeactivateUserResponse {
4704 /// The deactivated user (status: DEACTIVATED).
4705 #[prost(message, optional, tag="1")]
4706 pub user: ::core::option::Option<User>,
4707}
4708/// Request to reactivate a deactivated user.
4709#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4710pub struct ReactivateUserRequest {
4711 /// ID of the user to reactivate.
4712 #[prost(string, tag="1")]
4713 pub user_id: ::prost::alloc::string::String,
4714}
4715/// Response after reactivating a user.
4716#[derive(Clone, PartialEq, ::prost::Message)]
4717pub struct ReactivateUserResponse {
4718 /// The reactivated user (status: INVITED).
4719 #[prost(message, optional, tag="1")]
4720 pub user: ::core::option::Option<User>,
4721}
4722/// Request to revoke an invitation for a user who has not yet registered.
4723#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4724pub struct RevokeInviteRequest {
4725 /// ID of the invited user to remove.
4726 /// Constraints: UUID format (36 characters).
4727 #[prost(string, tag="1")]
4728 pub user_id: ::prost::alloc::string::String,
4729}
4730/// Response after revoking an invitation. Empty on success.
4731#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4732pub struct RevokeInviteResponse {
4733}
4734/// Request to update a user's profile attributes.
4735#[derive(Clone, PartialEq, ::prost::Message)]
4736pub struct UpdateUserProfileRequest {
4737 /// ID of the user whose profile to update.
4738 /// Empty or matching the caller's own ID allows self-update without PERMISSION_MEMBERS_MANAGE.
4739 #[prost(string, tag="1")]
4740 pub user_id: ::prost::alloc::string::String,
4741 /// Profile attributes to set. All provided fields overwrite existing values.
4742 #[prost(message, optional, tag="2")]
4743 pub profile: ::core::option::Option<UserProfile>,
4744}
4745/// Response after updating a user's profile.
4746#[derive(Clone, PartialEq, ::prost::Message)]
4747pub struct UpdateUserProfileResponse {
4748 /// The updated user with the new profile.
4749 #[prost(message, optional, tag="1")]
4750 pub user: ::core::option::Option<User>,
4751}
4752/// Request to retrieve the caller's platform settings.
4753#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4754pub struct GetUserSettingsRequest {
4755}
4756/// Response containing the caller's platform settings.
4757#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4758pub struct GetUserSettingsResponse {
4759 /// Current settings. Fields at their default value indicate the platform default.
4760 #[prost(message, optional, tag="1")]
4761 pub settings: ::core::option::Option<UserSettings>,
4762}
4763/// Request to update the caller's platform settings.
4764#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4765pub struct UpdateUserSettingsRequest {
4766 /// Settings to update. Only fields with non-default (non-UNSPECIFIED) values
4767 /// are applied; default-valued fields are left unchanged.
4768 #[prost(message, optional, tag="1")]
4769 pub settings: ::core::option::Option<UserSettings>,
4770}
4771/// Response after updating the caller's platform settings.
4772#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4773pub struct UpdateUserSettingsResponse {
4774 /// The full settings after the update.
4775 #[prost(message, optional, tag="1")]
4776 pub settings: ::core::option::Option<UserSettings>,
4777}
4778/// Request to invite multiple users to the organization in a single call.
4779#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4780pub struct BulkInviteUsersRequest {
4781 /// Email addresses to invite.
4782 /// Constraints: Min 1, max 100 emails. Duplicates are deduplicated before processing.
4783 #[prost(string, repeated, tag="1")]
4784 pub emails: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
4785 /// ID of the role to assign. Defaults to the organization's employee role if empty.
4786 #[prost(string, tag="2")]
4787 pub role_id: ::prost::alloc::string::String,
4788}
4789/// Per-email result within a bulk invite operation.
4790#[derive(Clone, PartialEq, ::prost::Message)]
4791pub struct BulkInviteResult {
4792 /// The email address that was processed.
4793 #[prost(string, tag="1")]
4794 pub email: ::prost::alloc::string::String,
4795 /// Whether the invitation succeeded.
4796 #[prost(bool, tag="2")]
4797 pub success: bool,
4798 /// Error message if the invitation failed (e.g. "user already exists").
4799 /// Empty on success.
4800 #[prost(string, tag="3")]
4801 pub error: ::prost::alloc::string::String,
4802 /// The created user. Only set on success.
4803 #[prost(message, optional, tag="4")]
4804 pub user: ::core::option::Option<User>,
4805}
4806/// Response after bulk inviting users.
4807#[derive(Clone, PartialEq, ::prost::Message)]
4808pub struct BulkInviteUsersResponse {
4809 /// Per-email results in the same order as the deduplicated input.
4810 #[prost(message, repeated, tag="1")]
4811 pub results: ::prost::alloc::vec::Vec<BulkInviteResult>,
4812 /// Number of users successfully invited.
4813 #[prost(int32, tag="2")]
4814 pub invited_count: i32,
4815 /// Number of emails that failed.
4816 #[prost(int32, tag="3")]
4817 pub failed_count: i32,
4818}
4819/// Request to confirm passkey enrollment after client-side WebAuthn registration.
4820/// The server verifies that the caller has at least one registered WebAuthn
4821/// credential before setting the enrollment attribute.
4822#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4823pub struct ConfirmPasskeyEnrollmentRequest {
4824}
4825/// Response after confirming passkey enrollment.
4826#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4827pub struct ConfirmPasskeyEnrollmentResponse {
4828 /// Whether enrollment was confirmed and the user attribute was updated.
4829 #[prost(bool, tag="1")]
4830 pub confirmed: bool,
4831}
4832/// Request to update a user's data governance region.
4833#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4834pub struct UpdateUserRegionRequest {
4835 /// ID of the user whose region to update. Required.
4836 #[prost(string, tag="1")]
4837 pub user_id: ::prost::alloc::string::String,
4838 /// New governance region, or empty to inherit from org default.
4839 /// Valid values: EU, LATAM, BR, APAC, US.
4840 #[prost(string, tag="2")]
4841 pub data_governance_region: ::prost::alloc::string::String,
4842}
4843/// Response after updating a user's governance region.
4844#[derive(Clone, PartialEq, ::prost::Message)]
4845pub struct UpdateUserRegionResponse {
4846 /// The updated user.
4847 #[prost(message, optional, tag="1")]
4848 pub user: ::core::option::Option<User>,
4849 /// Temporal workflow ID for the region migration, if a migration was triggered.
4850 /// Empty if the region didn't actually change.
4851 #[prost(string, tag="2")]
4852 pub migration_workflow_id: ::prost::alloc::string::String,
4853}
4854// ─── Messages ───────────────────────────────────────────────────────────────
4855
4856/// A single non-retired pepper version. Returned by GetPeppers.
4857///
4858/// During a rotation overlap, multiple versions are returned — callers
4859/// (e.g. pidgr-integrations) compute lookup hashes under EVERY returned
4860/// version to write or match against `identifier_lookup_hash_v1` and
4861/// `identifier_lookup_hash_v2` on the reachability registry.
4862#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4863pub struct Pepper {
4864 /// Monotonically-increasing version number. Lower versions retire first.
4865 #[prost(int32, tag="1")]
4866 pub version: i32,
4867 /// Raw HMAC key material. Sensitive — callers MUST NOT log or persist
4868 /// this value to disk. In-memory caching keyed on (org_id, version) with
4869 /// a short TTL is permitted and expected.
4870 #[prost(bytes="vec", tag="2")]
4871 pub key_material: ::prost::alloc::vec::Vec<u8>,
4872}
4873/// Request to fetch the active (non-retired) peppers for one org/purpose.
4874///
4875/// Auth: internal-mTLS only. This RPC exposes raw cryptographic key material
4876/// and MUST NOT be reachable from the public ingress or from JWT-authenticated
4877/// clients. The server SHALL reject any caller whose mTLS identity is not on
4878/// the configured allowlist.
4879#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4880pub struct GetPeppersRequest {
4881 /// Organization whose peppers are requested.
4882 #[prost(string, tag="1")]
4883 pub org_id: ::prost::alloc::string::String,
4884 /// Purpose identifier scoping which key family to return. Use
4885 /// `"reachability_lookup"` for the pidgr-integrations registry lookup hash.
4886 #[prost(string, tag="2")]
4887 pub purpose: ::prost::alloc::string::String,
4888}
4889#[derive(Clone, PartialEq, ::prost::Message)]
4890pub struct GetPeppersResponse {
4891 /// All non-retired pepper versions for the (org_id, purpose) pair, in
4892 /// ascending version order. Typically exactly one entry; two during a
4893 /// rotation overlap window; zero only when no pepper has ever been
4894 /// generated for this (org, purpose).
4895 #[prost(message, repeated, tag="1")]
4896 pub peppers: ::prost::alloc::vec::Vec<Pepper>,
4897}
4898// ─── Messages ───────────────────────────────────────────────────────────────
4899
4900/// Maps an identity provider claim to a user profile field.
4901/// Used for automatic profile population when users authenticate via SSO/SAML.
4902#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4903pub struct SsoAttributeMapping {
4904 /// Claim name from the identity provider (e.g. "urn:oid:2.5.4.11", "given_name").
4905 /// Constraints: Max length 500 characters.
4906 #[prost(string, tag="1")]
4907 pub idp_claim: ::prost::alloc::string::String,
4908 /// Target UserProfile field name (e.g. "department", "first_name").
4909 /// For custom attributes, use "custom:" prefix (e.g. "custom:cost_center").
4910 /// Constraints: Max length 100 characters.
4911 #[prost(string, tag="2")]
4912 pub profile_field: ::prost::alloc::string::String,
4913}
4914/// An organization (tenant) in the Pidgr platform.
4915#[derive(Clone, PartialEq, ::prost::Message)]
4916pub struct Organization {
4917 /// Unique identifier for the organization.
4918 #[prost(string, tag="1")]
4919 pub id: ::prost::alloc::string::String,
4920 /// Organization display name.
4921 /// Constraints: Max length 200 characters.
4922 #[prost(string, tag="2")]
4923 pub name: ::prost::alloc::string::String,
4924 /// Default workflow used when campaigns don't specify one.
4925 #[prost(message, optional, tag="3")]
4926 pub default_workflow: ::core::option::Option<WorkflowDefinition>,
4927 /// Timestamp when the organization was created.
4928 #[prost(message, optional, tag="4")]
4929 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
4930 /// Industry vertical.
4931 #[prost(enumeration="Industry", tag="5")]
4932 pub industry: i32,
4933 /// Employee headcount range.
4934 #[prost(enumeration="CompanySize", tag="6")]
4935 pub company_size: i32,
4936 /// SSO identity provider claim-to-profile mappings.
4937 /// Empty when the organization does not use SSO.
4938 #[prost(message, repeated, tag="7")]
4939 pub sso_attribute_mappings: ::prost::alloc::vec::Vec<SsoAttributeMapping>,
4940 /// Default language for new users in this organization.
4941 /// Empty means no org default (users auto-detect from device/browser).
4942 /// Valid values: en, es, pt-BR, zh, ja.
4943 #[prost(string, tag="8")]
4944 pub default_locale: ::prost::alloc::string::String,
4945 /// Organization lifecycle type.
4946 #[prost(enumeration="OrgType", tag="9")]
4947 pub org_type: i32,
4948 /// Expiration time for sandbox organizations. Empty for standard orgs.
4949 #[prost(message, optional, tag="10")]
4950 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
4951 /// Data governance framework (EU, LATAM, BR, APAC, US).
4952 /// Determines legal framework, DPA template, and Bedrock endpoint routing.
4953 #[prost(string, tag="11")]
4954 pub data_governance_region: ::prost::alloc::string::String,
4955 /// AWS region for content storage (resolved from data_governance_region).
4956 /// e.g., "eu-west-1", "us-east-1".
4957 #[prost(string, tag="12")]
4958 pub data_content_region: ::prost::alloc::string::String,
4959 /// ─── ML pipeline settings ──────────────────────────────────────────────────
4960 /// Cold-start threshold: completed campaigns below this count trigger immediate
4961 /// retraining. At or above, the org is flagged for the weekly cron.
4962 /// Default 10, range 1-100.
4963 #[prost(int32, tag="13")]
4964 pub ml_retrain_cold_threshold: i32,
4965 /// Whether cancelled campaigns count toward the training counter. Default true.
4966 #[prost(bool, tag="14")]
4967 pub ml_cancelled_counts: bool,
4968 /// Monthly limit on manual retrain triggers. Default 3, range 0-10.
4969 #[prost(int32, tag="15")]
4970 pub ml_manual_limit_monthly: i32,
4971 /// Number of manual retrains used in the current month (resets monthly).
4972 #[prost(int32, tag="16")]
4973 pub ml_manual_retrains_used: i32,
4974 /// Whether the org is flagged for the next weekly cron run.
4975 #[prost(bool, tag="17")]
4976 pub ml_needs_retrain: bool,
4977 /// Campaigns completed since the last ML training run.
4978 #[prost(int32, tag="18")]
4979 pub campaigns_since_last_training: i32,
4980 /// Total campaigns completed across the organization lifetime.
4981 #[prost(int32, tag="19")]
4982 pub total_completed_campaigns: i32,
4983 /// Timestamp of the most recent successful ML training. Empty if never trained.
4984 #[prost(message, optional, tag="20")]
4985 pub last_ml_training_at: ::core::option::Option<::prost_types::Timestamp>,
4986 /// Controls whether aggregate stats (campaign recipient/ack/missed counts)
4987 /// include synthetic data. Unset = default by org type: sandbox orgs include,
4988 /// standard orgs exclude. Derived intelligence (ML, analytics, attestation
4989 /// evidence) always excludes synthetic regardless of this setting.
4990 #[prost(bool, optional, tag="21")]
4991 pub include_synthetic_in_aggregates: ::core::option::Option<bool>,
4992 /// Whether the organization has opted into provisional (rule-based,
4993 /// low-confidence) archetypes for groups that don't yet have trained
4994 /// ML archetypes. Only meaningful for ORG_TYPE_STANDARD — sandbox
4995 /// organizations are always eligible regardless of this setting.
4996 /// Default false: production analytics stay conservative.
4997 #[prost(bool, tag="22")]
4998 pub provisional_archetypes_enabled: bool,
4999}
5000/// Request to create a new organization.
5001/// JWT auth only — the authenticated caller becomes the initial admin. Additional
5002/// admins are added via CreateInviteLink after the org exists.
5003#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5004pub struct CreateOrganizationRequest {
5005 /// Name for the new organization.
5006 /// Constraints: Max length 200 characters.
5007 #[prost(string, tag="1")]
5008 pub name: ::prost::alloc::string::String,
5009 /// Industry vertical for the organization.
5010 #[prost(enumeration="Industry", tag="2")]
5011 pub industry: i32,
5012 /// Employee headcount range.
5013 #[prost(enumeration="CompanySize", tag="3")]
5014 pub company_size: i32,
5015 /// Access code required during early access.
5016 /// Format: PIDGR-XXXXXXXX (8 alphanumeric characters).
5017 #[prost(string, tag="4")]
5018 pub access_code: ::prost::alloc::string::String,
5019 /// Data governance framework. Defaults to "US" if omitted.
5020 /// Valid values: EU, LATAM, BR, APAC, US.
5021 #[prost(string, tag="5")]
5022 pub data_governance_region: ::prost::alloc::string::String,
5023 /// Optional bootstrap fixture to seed the organization with starter data.
5024 /// Empty string means the default fixture.
5025 #[prost(string, tag="6")]
5026 pub fixture_id: ::prost::alloc::string::String,
5027}
5028/// Response after creating an organization.
5029#[derive(Clone, PartialEq, ::prost::Message)]
5030pub struct CreateOrganizationResponse {
5031 /// The newly created organization.
5032 #[prost(message, optional, tag="1")]
5033 pub organization: ::core::option::Option<Organization>,
5034 /// The admin user created for the organization.
5035 #[prost(message, optional, tag="2")]
5036 pub admin_user: ::core::option::Option<User>,
5037}
5038/// Request to retrieve the organization for the authenticated user.
5039#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5040pub struct GetOrganizationRequest {
5041}
5042/// Response containing the organization.
5043#[derive(Clone, PartialEq, ::prost::Message)]
5044pub struct GetOrganizationResponse {
5045 /// The organization the authenticated user belongs to.
5046 #[prost(message, optional, tag="1")]
5047 pub organization: ::core::option::Option<Organization>,
5048}
5049/// Request to update organization settings.
5050#[derive(Clone, PartialEq, ::prost::Message)]
5051pub struct UpdateOrganizationRequest {
5052 /// New organization name. Empty string leaves unchanged.
5053 /// Constraints: Max length 200 characters.
5054 #[prost(string, tag="1")]
5055 pub name: ::prost::alloc::string::String,
5056 /// New default workflow definition. Null leaves unchanged.
5057 #[prost(message, optional, tag="2")]
5058 pub default_workflow: ::core::option::Option<WorkflowDefinition>,
5059 /// New industry vertical. UNSPECIFIED leaves unchanged.
5060 #[prost(enumeration="Industry", tag="3")]
5061 pub industry: i32,
5062 /// New employee headcount range. UNSPECIFIED leaves unchanged.
5063 #[prost(enumeration="CompanySize", tag="4")]
5064 pub company_size: i32,
5065 /// New default language for new users. Empty string leaves unchanged.
5066 /// Valid values: en, es, pt-BR, zh, ja.
5067 #[prost(string, tag="5")]
5068 pub default_locale: ::prost::alloc::string::String,
5069 /// New ML cold-start threshold. 0 leaves unchanged, otherwise must be in \[1, 100\].
5070 #[prost(int32, tag="6")]
5071 pub ml_retrain_cold_threshold: i32,
5072 /// New ML cancelled-counts flag. Uses google.protobuf.BoolValue-style semantics
5073 /// via optional to distinguish "not provided" from "set to false".
5074 #[prost(bool, optional, tag="7")]
5075 pub ml_cancelled_counts: ::core::option::Option<bool>,
5076 /// New ML monthly manual limit. Negative leaves unchanged, otherwise must be in \[0, 10\].
5077 /// Encoded as int32 with -1 meaning "leave unchanged".
5078 #[prost(int32, tag="8")]
5079 pub ml_manual_limit_monthly: i32,
5080 /// Set the synthetic-aggregates override; unset leaves it unchanged.
5081 #[prost(bool, optional, tag="9")]
5082 pub include_synthetic_in_aggregates: ::core::option::Option<bool>,
5083 /// New provisional-archetypes opt-in for standard organizations.
5084 /// Unset leaves unchanged. Rejected for sandbox organizations, which
5085 /// are always eligible automatically.
5086 #[prost(bool, optional, tag="10")]
5087 pub provisional_archetypes_enabled: ::core::option::Option<bool>,
5088}
5089/// Response after updating the organization.
5090#[derive(Clone, PartialEq, ::prost::Message)]
5091pub struct UpdateOrganizationResponse {
5092 /// The updated organization.
5093 #[prost(message, optional, tag="1")]
5094 pub organization: ::core::option::Option<Organization>,
5095}
5096/// Request to replace all SSO attribute mappings for the organization.
5097#[derive(Clone, PartialEq, ::prost::Message)]
5098pub struct UpdateSsoAttributeMappingsRequest {
5099 /// Complete list of SSO mappings (replaces all existing mappings).
5100 #[prost(message, repeated, tag="1")]
5101 pub sso_attribute_mappings: ::prost::alloc::vec::Vec<SsoAttributeMapping>,
5102}
5103/// Response after updating SSO attribute mappings.
5104#[derive(Clone, PartialEq, ::prost::Message)]
5105pub struct UpdateSsoAttributeMappingsResponse {
5106 /// The updated organization with the new SSO mappings.
5107 #[prost(message, optional, tag="1")]
5108 pub organization: ::core::option::Option<Organization>,
5109}
5110/// Request to rotate the analytics salt and optionally increase the bucket count.
5111#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5112pub struct RotateAnalyticsSaltRequest {
5113 /// New bucket count. Must be >= current bucket count. 0 means keep current.
5114 #[prost(int32, tag="1")]
5115 pub new_bucket_count: i32,
5116}
5117/// Response after rotating the analytics salt.
5118#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5119pub struct RotateAnalyticsSaltResponse {
5120 /// The new bucket count after rotation.
5121 #[prost(int32, tag="1")]
5122 pub bucket_count: i32,
5123}
5124/// Request to update the analytics epsilon (differential privacy parameter).
5125#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5126pub struct UpdateAnalyticsEpsilonRequest {
5127 /// New epsilon value. Must be in range \[0.5, 5.0\].
5128 #[prost(float, tag="1")]
5129 pub epsilon: f32,
5130}
5131/// Response after updating the analytics epsilon.
5132#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5133pub struct UpdateAnalyticsEpsilonResponse {
5134 /// The new epsilon value.
5135 #[prost(float, tag="1")]
5136 pub epsilon: f32,
5137}
5138/// Request to create a sandbox organization for testing.
5139#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5140pub struct CreateSandboxOrganizationRequest {
5141 /// Name for the sandbox organization.
5142 /// Constraints: Max length 200 characters.
5143 #[prost(string, tag="1")]
5144 pub name: ::prost::alloc::string::String,
5145 /// Required expiration time. Max 30 days from now for interactive callers;
5146 /// API-key callers may set shorter TTLs for ephemeral test sandboxes.
5147 #[prost(message, optional, tag="2")]
5148 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
5149 /// Data governance framework. Defaults to "US" if omitted.
5150 /// Valid values: EU, LATAM, BR, APAC, US.
5151 #[prost(string, tag="3")]
5152 pub data_governance_region: ::prost::alloc::string::String,
5153 /// Optional bootstrap fixture to seed the sandbox with starter data.
5154 /// Empty string means the default fixture.
5155 /// Must match an id returned by ListSandboxFixtures.
5156 #[prost(string, tag="4")]
5157 pub fixture_id: ::prost::alloc::string::String,
5158}
5159/// Response after creating a sandbox organization.
5160#[derive(Clone, PartialEq, ::prost::Message)]
5161pub struct CreateSandboxOrganizationResponse {
5162 /// The newly created sandbox organization (org_type: SANDBOX).
5163 #[prost(message, optional, tag="1")]
5164 pub organization: ::core::option::Option<Organization>,
5165 /// The admin user created for the sandbox.
5166 #[prost(message, optional, tag="2")]
5167 pub admin_user: ::core::option::Option<User>,
5168}
5169/// Request to delete a sandbox organization. Only callable for orgs with
5170/// org_type=SANDBOX. Allowed for super admins of the sandbox or the creator.
5171#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5172pub struct DeleteSandboxOrganizationRequest {
5173 /// ID of the sandbox organization to delete.
5174 #[prost(string, tag="1")]
5175 pub org_id: ::prost::alloc::string::String,
5176}
5177/// Response after requesting deletion. Deletion runs asynchronously via
5178/// the DeleteOrgWorkflow; a success response means the workflow started.
5179#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5180pub struct DeleteSandboxOrganizationResponse {
5181 /// ID of the Temporal workflow handling the deletion.
5182 #[prost(string, tag="1")]
5183 pub workflow_id: ::prost::alloc::string::String,
5184}
5185/// A bootstrap fixture that can be applied when creating a new organization.
5186#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5187pub struct SandboxFixture {
5188 /// Stable slug for referencing this fixture (e.g. "starter", "empty",
5189 /// "fintech", "sales"). Pass it back as the fixture_id on create.
5190 #[prost(string, tag="1")]
5191 pub id: ::prost::alloc::string::String,
5192 /// Display name for admin UI (e.g. "Starter").
5193 #[prost(string, tag="2")]
5194 pub name: ::prost::alloc::string::String,
5195 /// Description shown alongside the fixture option in the UI.
5196 #[prost(string, tag="3")]
5197 pub description: ::prost::alloc::string::String,
5198 /// Exactly one fixture has is_default=true. Clients that show a simple
5199 /// "seed initial data" control select this fixture's id by default.
5200 #[prost(bool, tag="4")]
5201 pub is_default: bool,
5202}
5203/// Request to list all bootstrap fixtures available for seeding.
5204/// No parameters — catalog is the same for all callers.
5205#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5206pub struct ListSandboxFixturesRequest {
5207}
5208/// Response containing the bootstrap fixture catalog.
5209#[derive(Clone, PartialEq, ::prost::Message)]
5210pub struct ListSandboxFixturesResponse {
5211 /// All registered fixtures, ordered by name.
5212 #[prost(message, repeated, tag="1")]
5213 pub fixtures: ::prost::alloc::vec::Vec<SandboxFixture>,
5214}
5215/// Request to list all organizations the authenticated user belongs to.
5216/// No parameters — user identity is extracted from the JWT sub claim.
5217#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5218pub struct ListUserOrganizationsRequest {
5219}
5220/// Response containing all organizations the authenticated user belongs to.
5221#[derive(Clone, PartialEq, ::prost::Message)]
5222pub struct ListUserOrganizationsResponse {
5223 /// Organizations the user belongs to, ordered by created_at ascending.
5224 /// Excludes expired sandbox organizations.
5225 #[prost(message, repeated, tag="1")]
5226 pub organizations: ::prost::alloc::vec::Vec<Organization>,
5227}
5228/// Request to list only the sandbox organizations the authenticated user
5229/// belongs to (i.e. orgs where org_type = SANDBOX, filtered from the full
5230/// membership set). No parameters — user identity is extracted from the JWT
5231/// sub claim.
5232#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5233pub struct ListUserSandboxesRequest {
5234}
5235/// Response containing the user's sandbox organizations.
5236#[derive(Clone, PartialEq, ::prost::Message)]
5237pub struct ListUserSandboxesResponse {
5238 /// Sandbox organizations the user belongs to, ordered by expires_at
5239 /// ascending (soonest-expiring first — matches the admin UI
5240 /// /organization/sandboxes ordering). Excludes already-expired sandboxes
5241 /// (those are pending cleanup by SandboxCleanupWorkflow).
5242 #[prost(message, repeated, tag="1")]
5243 pub sandboxes: ::prost::alloc::vec::Vec<Organization>,
5244}
5245/// A single org-level data-processing toggle with consent-trace metadata.
5246/// The metadata records who flipped the toggle last and when, so the admin
5247/// consent-trace UI can show a verifiable change trail.
5248#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5249pub struct OrgPrivacyToggle {
5250 /// Whether this category of processing is enabled for the organization.
5251 #[prost(bool, tag="1")]
5252 pub enabled: bool,
5253 /// Email of the admin who last changed this toggle.
5254 /// Empty if the toggle has never been changed from its default.
5255 #[prost(string, tag="2")]
5256 pub last_changed_by_email: ::prost::alloc::string::String,
5257 /// When this toggle was last changed.
5258 /// Empty if the toggle has never been changed from its default.
5259 #[prost(message, optional, tag="3")]
5260 pub last_changed_at: ::core::option::Option<::prost_types::Timestamp>,
5261}
5262/// Org-level data-processing settings (compliance consent surface).
5263/// Each toggle gates an entire category of processing for every user in
5264/// the organization.
5265#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5266pub struct OrgPrivacySettings {
5267 /// Gates ML archetype clustering and ACK predictions.
5268 #[prost(message, optional, tag="1")]
5269 pub ai_clustering: ::core::option::Option<OrgPrivacyToggle>,
5270 /// Gates behavioral analytics (session replay, heatmaps, dwell metrics).
5271 #[prost(message, optional, tag="2")]
5272 pub behavioral_analytics: ::core::option::Option<OrgPrivacyToggle>,
5273 /// Gates third-party notification channel dispatch (email, Slack, SMS, …).
5274 #[prost(message, optional, tag="3")]
5275 pub third_party_channels: ::core::option::Option<OrgPrivacyToggle>,
5276}
5277/// Request to retrieve the org-level privacy settings.
5278/// The organization is extracted from the JWT.
5279#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5280pub struct GetOrgPrivacySettingsRequest {
5281}
5282/// Response containing the org-level privacy settings with consent-trace
5283/// metadata for each toggle.
5284#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5285pub struct GetOrgPrivacySettingsResponse {
5286 /// The organization's current privacy settings.
5287 #[prost(message, optional, tag="1")]
5288 pub settings: ::core::option::Option<OrgPrivacySettings>,
5289}
5290/// Request to update org-level privacy settings. Only the provided fields
5291/// are changed; unset fields leave the corresponding toggle unchanged.
5292#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5293pub struct UpdateOrgPrivacySettingsRequest {
5294 /// Enable or disable ML archetype clustering and ACK predictions.
5295 /// Unset leaves unchanged.
5296 #[prost(bool, optional, tag="1")]
5297 pub ai_clustering_enabled: ::core::option::Option<bool>,
5298 /// Enable or disable behavioral analytics. Unset leaves unchanged.
5299 #[prost(bool, optional, tag="2")]
5300 pub behavioral_analytics_enabled: ::core::option::Option<bool>,
5301 /// Enable or disable third-party notification channels.
5302 /// Unset leaves unchanged.
5303 #[prost(bool, optional, tag="3")]
5304 pub third_party_channels_enabled: ::core::option::Option<bool>,
5305}
5306/// Response after updating org-level privacy settings.
5307#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5308pub struct UpdateOrgPrivacySettingsResponse {
5309 /// The organization's privacy settings after the update, with refreshed
5310 /// consent-trace metadata.
5311 #[prost(message, optional, tag="1")]
5312 pub settings: ::core::option::Option<OrgPrivacySettings>,
5313}
5314// ─── Enums ───────────────────────────────────────────────────────────────────
5315
5316/// Industry vertical for an organization.
5317#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
5318#[repr(i32)]
5319pub enum Industry {
5320 Unspecified = 0,
5321 Technology = 1,
5322 Finance = 2,
5323 Healthcare = 3,
5324 Education = 4,
5325 Retail = 5,
5326 Manufacturing = 6,
5327 Media = 7,
5328 Other = 8,
5329}
5330impl Industry {
5331 /// String value of the enum field names used in the ProtoBuf definition.
5332 ///
5333 /// The values are not transformed in any way and thus are considered stable
5334 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
5335 pub fn as_str_name(&self) -> &'static str {
5336 match self {
5337 Self::Unspecified => "INDUSTRY_UNSPECIFIED",
5338 Self::Technology => "INDUSTRY_TECHNOLOGY",
5339 Self::Finance => "INDUSTRY_FINANCE",
5340 Self::Healthcare => "INDUSTRY_HEALTHCARE",
5341 Self::Education => "INDUSTRY_EDUCATION",
5342 Self::Retail => "INDUSTRY_RETAIL",
5343 Self::Manufacturing => "INDUSTRY_MANUFACTURING",
5344 Self::Media => "INDUSTRY_MEDIA",
5345 Self::Other => "INDUSTRY_OTHER",
5346 }
5347 }
5348 /// Creates an enum from field names used in the ProtoBuf definition.
5349 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
5350 match value {
5351 "INDUSTRY_UNSPECIFIED" => Some(Self::Unspecified),
5352 "INDUSTRY_TECHNOLOGY" => Some(Self::Technology),
5353 "INDUSTRY_FINANCE" => Some(Self::Finance),
5354 "INDUSTRY_HEALTHCARE" => Some(Self::Healthcare),
5355 "INDUSTRY_EDUCATION" => Some(Self::Education),
5356 "INDUSTRY_RETAIL" => Some(Self::Retail),
5357 "INDUSTRY_MANUFACTURING" => Some(Self::Manufacturing),
5358 "INDUSTRY_MEDIA" => Some(Self::Media),
5359 "INDUSTRY_OTHER" => Some(Self::Other),
5360 _ => None,
5361 }
5362 }
5363}
5364/// Employee headcount range for an organization.
5365#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
5366#[repr(i32)]
5367pub enum CompanySize {
5368 Unspecified = 0,
5369 CompanySize1200 = 1,
5370 CompanySize200500 = 2,
5371 CompanySize5001000 = 3,
5372 CompanySize10005000 = 4,
5373 CompanySize5000Plus = 5,
5374}
5375impl CompanySize {
5376 /// String value of the enum field names used in the ProtoBuf definition.
5377 ///
5378 /// The values are not transformed in any way and thus are considered stable
5379 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
5380 pub fn as_str_name(&self) -> &'static str {
5381 match self {
5382 Self::Unspecified => "COMPANY_SIZE_UNSPECIFIED",
5383 Self::CompanySize1200 => "COMPANY_SIZE_1_200",
5384 Self::CompanySize200500 => "COMPANY_SIZE_200_500",
5385 Self::CompanySize5001000 => "COMPANY_SIZE_500_1000",
5386 Self::CompanySize10005000 => "COMPANY_SIZE_1000_5000",
5387 Self::CompanySize5000Plus => "COMPANY_SIZE_5000_PLUS",
5388 }
5389 }
5390 /// Creates an enum from field names used in the ProtoBuf definition.
5391 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
5392 match value {
5393 "COMPANY_SIZE_UNSPECIFIED" => Some(Self::Unspecified),
5394 "COMPANY_SIZE_1_200" => Some(Self::CompanySize1200),
5395 "COMPANY_SIZE_200_500" => Some(Self::CompanySize200500),
5396 "COMPANY_SIZE_500_1000" => Some(Self::CompanySize5001000),
5397 "COMPANY_SIZE_1000_5000" => Some(Self::CompanySize10005000),
5398 "COMPANY_SIZE_5000_PLUS" => Some(Self::CompanySize5000Plus),
5399 _ => None,
5400 }
5401 }
5402}
5403/// Classification of an organization's lifecycle type.
5404#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
5405#[repr(i32)]
5406pub enum OrgType {
5407 Unspecified = 0,
5408 Standard = 1,
5409 Sandbox = 2,
5410 /// Reserved for platform operations. At most one per deployment, seeded
5411 /// by migration. Cannot be created via CreateOrganization.
5412 Staff = 3,
5413}
5414impl OrgType {
5415 /// String value of the enum field names used in the ProtoBuf definition.
5416 ///
5417 /// The values are not transformed in any way and thus are considered stable
5418 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
5419 pub fn as_str_name(&self) -> &'static str {
5420 match self {
5421 Self::Unspecified => "ORG_TYPE_UNSPECIFIED",
5422 Self::Standard => "ORG_TYPE_STANDARD",
5423 Self::Sandbox => "ORG_TYPE_SANDBOX",
5424 Self::Staff => "ORG_TYPE_STAFF",
5425 }
5426 }
5427 /// Creates an enum from field names used in the ProtoBuf definition.
5428 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
5429 match value {
5430 "ORG_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
5431 "ORG_TYPE_STANDARD" => Some(Self::Standard),
5432 "ORG_TYPE_SANDBOX" => Some(Self::Sandbox),
5433 "ORG_TYPE_STAFF" => Some(Self::Staff),
5434 _ => None,
5435 }
5436 }
5437}
5438// ─── Messages ───────────────────────────────────────────────────────────────
5439
5440/// Per-user rendering context containing variable substitutions.
5441#[derive(Clone, PartialEq, ::prost::Message)]
5442pub struct UserRenderContext {
5443 /// ID of the user being rendered for.
5444 #[prost(string, tag="1")]
5445 pub user_id: ::prost::alloc::string::String,
5446 /// Variable name-value pairs to substitute into the template.
5447 /// Constraints: Max 100 entries. Key max length 100 characters, value max length 10000 characters.
5448 #[prost(map="string, string", tag="2")]
5449 pub variables: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
5450}
5451/// Request to render a template for a batch of users.
5452#[derive(Clone, PartialEq, ::prost::Message)]
5453pub struct RenderBatchRequest {
5454 /// ID of the template to render.
5455 #[prost(string, tag="1")]
5456 pub template_id: ::prost::alloc::string::String,
5457 /// Version of the template to render.
5458 #[prost(int32, tag="2")]
5459 pub version: i32,
5460 /// Per-user rendering contexts with variable substitutions.
5461 /// Constraints: Max 10000 users per batch.
5462 #[prost(message, repeated, tag="3")]
5463 pub users: ::prost::alloc::vec::Vec<UserRenderContext>,
5464}
5465/// Streamed response for each user's rendered message.
5466/// One response is emitted per user in the batch.
5467#[derive(Clone, PartialEq, ::prost::Message)]
5468pub struct RenderBatchResponse {
5469 /// ID of the user this result is for.
5470 #[prost(string, tag="1")]
5471 pub user_id: ::prost::alloc::string::String,
5472 /// The rendered message (set on success).
5473 #[prost(message, optional, tag="2")]
5474 pub message: ::core::option::Option<Message>,
5475 /// Error message if rendering failed for this user (empty on success).
5476 #[prost(string, tag="3")]
5477 pub error: ::prost::alloc::string::String,
5478}
5479// ─── Messages ───────────────────────────────────────────────────────────────
5480
5481/// A session recording summary from the analytics provider.
5482/// Anonymous: no user identifiers are included.
5483#[derive(Clone, PartialEq, ::prost::Message)]
5484pub struct SessionRecording {
5485 /// Recording ID from the analytics provider.
5486 #[prost(string, tag="1")]
5487 pub id: ::prost::alloc::string::String,
5488 /// Timestamp when the recording started.
5489 #[prost(message, optional, tag="2")]
5490 pub start_time: ::core::option::Option<::prost_types::Timestamp>,
5491 /// Timestamp when the recording ended.
5492 #[prost(message, optional, tag="3")]
5493 pub end_time: ::core::option::Option<::prost_types::Timestamp>,
5494 /// Duration of the recording in seconds.
5495 #[prost(int32, tag="4")]
5496 pub duration_seconds: i32,
5497 /// Activity score (0.0–1.0).
5498 #[prost(float, tag="5")]
5499 pub activity_score: f32,
5500}
5501/// Request to list session recordings.
5502#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5503pub struct ListSessionRecordingsRequest {
5504 /// Optional: filter recordings by campaign ID (mapped to analytics property filter).
5505 /// Constraints: UUID format (36 characters).
5506 #[prost(string, tag="1")]
5507 pub campaign_id: ::prost::alloc::string::String,
5508 /// Optional: start of the time range filter (inclusive).
5509 #[prost(message, optional, tag="2")]
5510 pub date_from: ::core::option::Option<::prost_types::Timestamp>,
5511 /// Optional: end of the time range filter (inclusive).
5512 #[prost(message, optional, tag="3")]
5513 pub date_to: ::core::option::Option<::prost_types::Timestamp>,
5514 /// Pagination parameters.
5515 #[prost(message, optional, tag="4")]
5516 pub pagination: ::core::option::Option<Pagination>,
5517}
5518/// Response containing a page of session recordings.
5519#[derive(Clone, PartialEq, ::prost::Message)]
5520pub struct ListSessionRecordingsResponse {
5521 /// List of session recordings in this page.
5522 #[prost(message, repeated, tag="1")]
5523 pub recordings: ::prost::alloc::vec::Vec<SessionRecording>,
5524 /// Pagination metadata for fetching subsequent pages.
5525 #[prost(message, optional, tag="2")]
5526 pub pagination_meta: ::core::option::Option<PaginationMeta>,
5527}
5528/// Request to fetch rrweb snapshot events for a recording.
5529#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5530pub struct GetSessionSnapshotsRequest {
5531 /// Recording ID from the analytics provider.
5532 /// Constraints: Max length 200 characters.
5533 #[prost(string, tag="1")]
5534 pub recording_id: ::prost::alloc::string::String,
5535}
5536/// Response containing rrweb snapshot events.
5537#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5538pub struct GetSessionSnapshotsResponse {
5539 /// JSON-encoded array of rrweb eventWithTime objects.
5540 /// Clients parse this JSON to feed into rrweb-player.
5541 #[prost(string, tag="1")]
5542 pub snapshot_data: ::prost::alloc::string::String,
5543}
5544// ─── Messages ───────────────────────────────────────────────────────────────
5545
5546/// Request to list all roles in the caller's organization.
5547#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5548pub struct ListRolesRequest {
5549}
5550/// Response containing the organization's roles.
5551#[derive(Clone, PartialEq, ::prost::Message)]
5552pub struct ListRolesResponse {
5553 /// All roles in the organization, including their permission sets.
5554 #[prost(message, repeated, tag="1")]
5555 pub roles: ::prost::alloc::vec::Vec<Role>,
5556}
5557/// Request to create a new role in the caller's organization.
5558#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5559pub struct CreateRoleRequest {
5560 /// Display name for the role (e.g. "Team Lead"). Required.
5561 /// A slug is auto-generated from the name.
5562 #[prost(string, tag="1")]
5563 pub name: ::prost::alloc::string::String,
5564 /// Initial permission set for the role.
5565 /// PERMISSION_UNSPECIFIED values are rejected.
5566 #[prost(enumeration="Permission", repeated, tag="2")]
5567 pub permissions: ::prost::alloc::vec::Vec<i32>,
5568}
5569/// Response after creating a role.
5570#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5571pub struct CreateRoleResponse {
5572 /// The newly created role with its generated slug and permission set.
5573 #[prost(message, optional, tag="1")]
5574 pub role: ::core::option::Option<Role>,
5575}
5576/// Request to update a role's name and/or permissions.
5577#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5578pub struct UpdateRoleRequest {
5579 /// ID of the role to update. Required.
5580 #[prost(string, tag="1")]
5581 pub role_id: ::prost::alloc::string::String,
5582 /// New display name. If empty, the name is not changed.
5583 #[prost(string, tag="2")]
5584 pub name: ::prost::alloc::string::String,
5585 /// New permission set (replaces existing permissions entirely).
5586 /// If empty, permissions are not changed.
5587 /// PERMISSION_UNSPECIFIED values are rejected.
5588 #[prost(enumeration="Permission", repeated, tag="3")]
5589 pub permissions: ::prost::alloc::vec::Vec<i32>,
5590}
5591/// Response after updating a role.
5592#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5593pub struct UpdateRoleResponse {
5594 /// The updated role.
5595 #[prost(message, optional, tag="1")]
5596 pub role: ::core::option::Option<Role>,
5597}
5598/// Request to delete a role.
5599#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5600pub struct DeleteRoleRequest {
5601 /// ID of the role to delete. Required.
5602 #[prost(string, tag="1")]
5603 pub role_id: ::prost::alloc::string::String,
5604}
5605/// Response after deleting a role.
5606#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5607pub struct DeleteRoleResponse {
5608}
5609// ─── Messages ───────────────────────────────────────────────────────────────
5610
5611/// Custom SAML attribute name overrides for identity providers that use
5612/// non-standard attribute names. When provided, these override the
5613/// auto-detected values from the metadata URL host.
5614#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5615pub struct SamlAttributeNames {
5616 /// SAML attribute name for the user's email address.
5617 #[prost(string, tag="1")]
5618 pub email: ::prost::alloc::string::String,
5619 /// SAML attribute name for the user's first name.
5620 #[prost(string, tag="2")]
5621 pub given_name: ::prost::alloc::string::String,
5622 /// SAML attribute name for the user's last name.
5623 #[prost(string, tag="3")]
5624 pub family_name: ::prost::alloc::string::String,
5625}
5626/// An SSO identity provider configured for an organization.
5627#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5628pub struct SsoProvider {
5629 /// Unique identifier for the provider.
5630 #[prost(string, tag="1")]
5631 pub id: ::prost::alloc::string::String,
5632 /// Email domain that triggers this SSO provider (e.g. "acme.com").
5633 /// Constraints: Max length 253 characters (RFC 1035).
5634 #[prost(string, tag="2")]
5635 pub domain: ::prost::alloc::string::String,
5636 /// Type of identity provider.
5637 #[prost(enumeration="SsoProviderType", tag="3")]
5638 pub r#type: i32,
5639 /// SAML metadata URL or OIDC discovery URL.
5640 /// Constraints: Max length 2048 characters. HTTPS required.
5641 #[prost(string, tag="4")]
5642 pub metadata_url: ::prost::alloc::string::String,
5643 /// Name of the identity provider (used for signInWithRedirect).
5644 /// Set by the API when the IdP is created.
5645 #[prost(string, tag="5")]
5646 pub idp_provider_name: ::prost::alloc::string::String,
5647 /// Timestamp when the provider was created.
5648 #[prost(message, optional, tag="6")]
5649 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
5650 /// Timestamp when the provider was last updated.
5651 #[prost(message, optional, tag="7")]
5652 pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
5653 /// Optional custom SAML attribute name overrides.
5654 #[prost(message, optional, tag="8")]
5655 pub attribute_mapping: ::core::option::Option<SamlAttributeNames>,
5656}
5657/// Request to check if an email domain has SSO configured.
5658/// This RPC is pre-authentication — no JWT required.
5659#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5660pub struct CheckSsoByDomainRequest {
5661 /// Email address to check. The domain part is extracted.
5662 /// Constraints: Max length 254 characters (RFC 5321).
5663 #[prost(string, tag="1")]
5664 pub email: ::prost::alloc::string::String,
5665}
5666/// Response for SSO domain check.
5667#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5668pub struct CheckSsoByDomainResponse {
5669 /// Whether SSO is enabled for the email's domain.
5670 #[prost(bool, tag="1")]
5671 pub sso_enabled: bool,
5672 /// Identity provider name for signInWithRedirect.
5673 /// Empty if sso_enabled is false.
5674 #[prost(string, tag="2")]
5675 pub provider_name: ::prost::alloc::string::String,
5676}
5677/// Request to create an SSO provider for the organization.
5678#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5679pub struct CreateSsoProviderRequest {
5680 /// Email domain to associate (e.g. "acme.com").
5681 /// Constraints: Max length 253 characters (RFC 1035).
5682 #[prost(string, tag="1")]
5683 pub domain: ::prost::alloc::string::String,
5684 /// Type of identity provider.
5685 #[prost(enumeration="SsoProviderType", tag="2")]
5686 pub r#type: i32,
5687 /// SAML metadata URL or OIDC discovery URL.
5688 /// Constraints: Max length 2048 characters. HTTPS required.
5689 #[prost(string, tag="3")]
5690 pub metadata_url: ::prost::alloc::string::String,
5691 /// Optional custom SAML attribute name overrides.
5692 /// When omitted, attribute names are auto-detected from the metadata URL.
5693 #[prost(message, optional, tag="4")]
5694 pub attribute_mapping: ::core::option::Option<SamlAttributeNames>,
5695}
5696/// Response after creating an SSO provider.
5697#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5698pub struct CreateSsoProviderResponse {
5699 /// The newly created SSO provider.
5700 #[prost(message, optional, tag="1")]
5701 pub provider: ::core::option::Option<SsoProvider>,
5702}
5703/// Request to get the SSO provider for the organization.
5704/// Returns the provider if one is configured, or empty if not.
5705#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5706pub struct GetSsoProviderRequest {
5707}
5708/// Response containing the organization's SSO provider.
5709#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5710pub struct GetSsoProviderResponse {
5711 /// The organization's SSO provider, or null if not configured.
5712 #[prost(message, optional, tag="1")]
5713 pub provider: ::core::option::Option<SsoProvider>,
5714}
5715/// Request to delete the organization's SSO provider.
5716#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5717pub struct DeleteSsoProviderRequest {
5718 /// ID of the provider to delete.
5719 #[prost(string, tag="1")]
5720 pub provider_id: ::prost::alloc::string::String,
5721}
5722/// Response after deleting an SSO provider.
5723#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5724pub struct DeleteSsoProviderResponse {
5725}
5726// ─── Enums ──────────────────────────────────────────────────────────────────
5727
5728/// Type of SSO identity provider.
5729#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
5730#[repr(i32)]
5731pub enum SsoProviderType {
5732 /// Default value; not a valid type.
5733 Unspecified = 0,
5734 /// SAML 2.0 identity provider (e.g. Okta, Azure AD).
5735 Saml = 1,
5736 /// OpenID Connect identity provider (e.g. Google Workspace, Auth0).
5737 Oidc = 2,
5738}
5739impl SsoProviderType {
5740 /// String value of the enum field names used in the ProtoBuf definition.
5741 ///
5742 /// The values are not transformed in any way and thus are considered stable
5743 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
5744 pub fn as_str_name(&self) -> &'static str {
5745 match self {
5746 Self::Unspecified => "SSO_PROVIDER_TYPE_UNSPECIFIED",
5747 Self::Saml => "SSO_PROVIDER_TYPE_SAML",
5748 Self::Oidc => "SSO_PROVIDER_TYPE_OIDC",
5749 }
5750 }
5751 /// Creates an enum from field names used in the ProtoBuf definition.
5752 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
5753 match value {
5754 "SSO_PROVIDER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
5755 "SSO_PROVIDER_TYPE_SAML" => Some(Self::Saml),
5756 "SSO_PROVIDER_TYPE_OIDC" => Some(Self::Oidc),
5757 _ => None,
5758 }
5759 }
5760}
5761// ─── Messages ───────────────────────────────────────────────────────────────
5762
5763/// An organizational unit within an organization (e.g. department, division).
5764/// Teams represent the organizational structure and can serve as sender identity
5765/// in campaigns.
5766#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5767pub struct Team {
5768 /// Unique identifier for the team.
5769 #[prost(string, tag="1")]
5770 pub id: ::prost::alloc::string::String,
5771 /// Human-readable display name (unique within the organization).
5772 /// Constraints: Max length 200 characters.
5773 #[prost(string, tag="2")]
5774 pub name: ::prost::alloc::string::String,
5775 /// Optional description of the team's purpose.
5776 /// Constraints: Max length 1000 characters.
5777 #[prost(string, tag="3")]
5778 pub description: ::prost::alloc::string::String,
5779 /// Number of users currently in the team.
5780 #[prost(int32, tag="4")]
5781 pub member_count: i32,
5782 /// Timestamp when the team was created.
5783 #[prost(message, optional, tag="5")]
5784 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
5785 /// Timestamp when the team was last updated.
5786 #[prost(message, optional, tag="6")]
5787 pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
5788 /// Whether this is the organization's default team (cannot be deleted or renamed).
5789 #[prost(bool, tag="7")]
5790 pub is_default: bool,
5791 /// ID of the user who created this team. Empty for system-seeded defaults.
5792 #[prost(string, tag="8")]
5793 pub created_by: ::prost::alloc::string::String,
5794}
5795/// Request to create a new team.
5796#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5797pub struct CreateTeamRequest {
5798 /// Display name for the team. Required.
5799 /// Constraints: Max length 200 characters.
5800 #[prost(string, tag="1")]
5801 pub name: ::prost::alloc::string::String,
5802 /// Optional description.
5803 /// Constraints: Max length 1000 characters.
5804 #[prost(string, tag="2")]
5805 pub description: ::prost::alloc::string::String,
5806}
5807/// Response after creating a team.
5808#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5809pub struct CreateTeamResponse {
5810 /// The newly created team.
5811 #[prost(message, optional, tag="1")]
5812 pub team: ::core::option::Option<Team>,
5813}
5814/// Request to retrieve a team by ID.
5815#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5816pub struct GetTeamRequest {
5817 /// ID of the team to retrieve. Required.
5818 #[prost(string, tag="1")]
5819 pub team_id: ::prost::alloc::string::String,
5820}
5821/// Response containing the requested team.
5822#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5823pub struct GetTeamResponse {
5824 /// The requested team.
5825 #[prost(message, optional, tag="1")]
5826 pub team: ::core::option::Option<Team>,
5827}
5828/// Request to list teams in the organization with pagination.
5829#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5830pub struct ListTeamsRequest {
5831 /// Pagination parameters.
5832 #[prost(message, optional, tag="1")]
5833 pub pagination: ::core::option::Option<Pagination>,
5834}
5835/// Response containing a page of teams.
5836#[derive(Clone, PartialEq, ::prost::Message)]
5837pub struct ListTeamsResponse {
5838 /// Teams in this page.
5839 #[prost(message, repeated, tag="1")]
5840 pub teams: ::prost::alloc::vec::Vec<Team>,
5841 /// Pagination metadata for fetching subsequent pages.
5842 #[prost(message, optional, tag="2")]
5843 pub pagination_meta: ::core::option::Option<PaginationMeta>,
5844}
5845/// Request to update a team's name and/or description.
5846#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5847pub struct UpdateTeamRequest {
5848 /// ID of the team to update. Required.
5849 #[prost(string, tag="1")]
5850 pub team_id: ::prost::alloc::string::String,
5851 /// New display name. If empty, the name is not changed.
5852 /// Default teams cannot be renamed.
5853 /// Constraints: Max length 200 characters.
5854 #[prost(string, tag="2")]
5855 pub name: ::prost::alloc::string::String,
5856 /// New description. If empty, the description is not changed.
5857 /// Constraints: Max length 1000 characters.
5858 #[prost(string, tag="3")]
5859 pub description: ::prost::alloc::string::String,
5860}
5861/// Response after updating a team.
5862#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5863pub struct UpdateTeamResponse {
5864 /// The updated team.
5865 #[prost(message, optional, tag="1")]
5866 pub team: ::core::option::Option<Team>,
5867}
5868/// Request to delete a team.
5869#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5870pub struct DeleteTeamRequest {
5871 /// ID of the team to delete. Required.
5872 /// Default teams cannot be deleted.
5873 #[prost(string, tag="1")]
5874 pub team_id: ::prost::alloc::string::String,
5875}
5876/// Response after deleting a team.
5877#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5878pub struct DeleteTeamResponse {
5879}
5880/// Request to add users to a team.
5881#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5882pub struct AddTeamMembersRequest {
5883 /// ID of the team to add members to. Required.
5884 #[prost(string, tag="1")]
5885 pub team_id: ::prost::alloc::string::String,
5886 /// IDs of users to add. Must belong to the same organization.
5887 /// Adding an existing member is a no-op (idempotent).
5888 /// Constraints: Max 100 user IDs per request.
5889 #[prost(string, repeated, tag="2")]
5890 pub user_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
5891}
5892/// Response after adding team members.
5893#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5894pub struct AddTeamMembersResponse {
5895 /// The team with updated member_count.
5896 #[prost(message, optional, tag="1")]
5897 pub team: ::core::option::Option<Team>,
5898}
5899/// Request to remove users from a team.
5900#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5901pub struct RemoveTeamMembersRequest {
5902 /// ID of the team to remove members from. Required.
5903 #[prost(string, tag="1")]
5904 pub team_id: ::prost::alloc::string::String,
5905 /// IDs of users to remove. Removing a non-member is a no-op (idempotent).
5906 /// Constraints: Max 100 user IDs per request.
5907 #[prost(string, repeated, tag="2")]
5908 pub user_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
5909}
5910/// Response after removing team members.
5911#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5912pub struct RemoveTeamMembersResponse {
5913 /// The team with updated member_count.
5914 #[prost(message, optional, tag="1")]
5915 pub team: ::core::option::Option<Team>,
5916}
5917/// Request to list members of a team with pagination.
5918#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5919pub struct ListTeamMembersRequest {
5920 /// ID of the team whose members to list. Required.
5921 #[prost(string, tag="1")]
5922 pub team_id: ::prost::alloc::string::String,
5923 /// Pagination parameters.
5924 #[prost(message, optional, tag="2")]
5925 pub pagination: ::core::option::Option<Pagination>,
5926}
5927/// Response containing a page of team members.
5928#[derive(Clone, PartialEq, ::prost::Message)]
5929pub struct ListTeamMembersResponse {
5930 /// Users in this page.
5931 #[prost(message, repeated, tag="1")]
5932 pub users: ::prost::alloc::vec::Vec<User>,
5933 /// Pagination metadata for fetching subsequent pages.
5934 #[prost(message, optional, tag="2")]
5935 pub pagination_meta: ::core::option::Option<PaginationMeta>,
5936}
5937// ─── Messages ───────────────────────────────────────────────────────────────
5938
5939/// A variable placeholder within a template that gets substituted during rendering.
5940#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5941pub struct TemplateVariable {
5942 /// Variable name used in the template body (e.g. "employee_name").
5943 /// Constraints: Max length 100 characters.
5944 #[prost(string, tag="1")]
5945 pub name: ::prost::alloc::string::String,
5946 /// Human-readable description of what this variable represents.
5947 /// Constraints: Max length 500 characters.
5948 #[prost(string, tag="2")]
5949 pub description: ::prost::alloc::string::String,
5950 /// Whether this variable must be provided during rendering.
5951 #[prost(bool, tag="3")]
5952 pub required: bool,
5953 /// Where this variable's value comes from (profile attribute or campaign config).
5954 #[prost(enumeration="TemplateVariableSource", tag="4")]
5955 pub source: i32,
5956 /// Fallback value used when the source does not provide a value.
5957 /// Constraints: Max length 1000 characters.
5958 #[prost(string, tag="5")]
5959 pub default_value: ::prost::alloc::string::String,
5960 /// When true, this variable's rendered value is masked in session replay
5961 /// and heatmap screenshots. Org admin controls per variable.
5962 #[prost(bool, tag="6")]
5963 pub pii: bool,
5964}
5965/// A versioned message template with variable placeholders.
5966/// Templates are append-only — updates create new versions.
5967#[derive(Clone, PartialEq, ::prost::Message)]
5968pub struct Template {
5969 /// Unique identifier for the template.
5970 #[prost(string, tag="1")]
5971 pub id: ::prost::alloc::string::String,
5972 /// Human-readable template name (admin-facing label).
5973 /// Constraints: Max length 200 characters.
5974 #[prost(string, tag="2")]
5975 pub name: ::prost::alloc::string::String,
5976 /// Template body with {{variable}} placeholders for substitution.
5977 /// Constraints: Max length 50000 characters.
5978 #[prost(string, tag="3")]
5979 pub body: ::prost::alloc::string::String,
5980 /// Variables that can be substituted into the template body.
5981 #[prost(message, repeated, tag="4")]
5982 pub variables: ::prost::alloc::vec::Vec<TemplateVariable>,
5983 /// Version number (auto-incremented on each update).
5984 #[prost(int32, tag="5")]
5985 pub version: i32,
5986 /// Timestamp when this version was created.
5987 #[prost(message, optional, tag="6")]
5988 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
5989 /// Timestamp of the most recent update (same as created_at for the latest version).
5990 #[prost(message, optional, tag="7")]
5991 pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
5992 /// User-facing title shown as the message subject to recipients.
5993 /// Serves as the default title; campaigns can override it.
5994 /// Constraints: Max length 200 characters.
5995 #[prost(string, tag="8")]
5996 pub title: ::prost::alloc::string::String,
5997 /// Content format of this template (markdown, rich, HTML).
5998 /// UNSPECIFIED is treated as MARKDOWN for backward compatibility.
5999 #[prost(enumeration="TemplateType", tag="9")]
6000 pub r#type: i32,
6001 /// Language of the template body content (e.g., "en", "es", "ja").
6002 /// Defaults to the org's default_locale, falling back to "en".
6003 /// Translations are created as locale variants of this source.
6004 #[prost(string, tag="10")]
6005 pub source_locale: ::prost::alloc::string::String,
6006}
6007/// A locale-specific translation of a template's title and body.
6008/// Translations are created per template version and go through a review workflow.
6009#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6010pub struct TemplateTranslation {
6011 /// Unique identifier for this translation.
6012 #[prost(string, tag="1")]
6013 pub id: ::prost::alloc::string::String,
6014 /// ID of the source template.
6015 #[prost(string, tag="2")]
6016 pub template_id: ::prost::alloc::string::String,
6017 /// Version of the source template this translation is for.
6018 #[prost(int32, tag="3")]
6019 pub version: i32,
6020 /// Target locale (e.g., "es", "pt-BR", "zh", "ja").
6021 #[prost(string, tag="4")]
6022 pub locale: ::prost::alloc::string::String,
6023 /// Translated title.
6024 /// Constraints: Max length 200 characters.
6025 #[prost(string, tag="5")]
6026 pub title: ::prost::alloc::string::String,
6027 /// Translated body content with {{variable}} placeholders preserved.
6028 /// Constraints: Max length 50000 characters.
6029 #[prost(string, tag="6")]
6030 pub body: ::prost::alloc::string::String,
6031 /// Current review status.
6032 #[prost(enumeration="TranslationStatus", tag="7")]
6033 pub status: i32,
6034 /// Who created this translation ("ai:bedrock", "ai:deepl", or user UUID).
6035 #[prost(string, tag="8")]
6036 pub translated_by: ::prost::alloc::string::String,
6037 /// User who approved the translation. Empty until approved.
6038 #[prost(string, tag="9")]
6039 pub reviewed_by: ::prost::alloc::string::String,
6040 /// When the translation was approved.
6041 #[prost(message, optional, tag="10")]
6042 pub reviewed_at: ::core::option::Option<::prost_types::Timestamp>,
6043 /// When the translation was created.
6044 #[prost(message, optional, tag="11")]
6045 pub created_at: ::core::option::Option<::prost_types::Timestamp>,
6046}
6047/// Request to create a new template.
6048#[derive(Clone, PartialEq, ::prost::Message)]
6049pub struct CreateTemplateRequest {
6050 /// Human-readable template name (admin-facing label).
6051 /// Constraints: Max length 200 characters.
6052 #[prost(string, tag="1")]
6053 pub name: ::prost::alloc::string::String,
6054 /// Template body with {{variable}} placeholders.
6055 /// Constraints: Max length 50000 characters.
6056 #[prost(string, tag="2")]
6057 pub body: ::prost::alloc::string::String,
6058 /// Variables available for substitution in the body.
6059 #[prost(message, repeated, tag="3")]
6060 pub variables: ::prost::alloc::vec::Vec<TemplateVariable>,
6061 /// User-facing title shown as the message subject to recipients.
6062 /// Constraints: Max length 200 characters.
6063 #[prost(string, tag="4")]
6064 pub title: ::prost::alloc::string::String,
6065 /// Content format of the template. Defaults to MARKDOWN if unspecified.
6066 #[prost(enumeration="TemplateType", tag="5")]
6067 pub r#type: i32,
6068 /// Language of the template body content. Defaults to org's default_locale.
6069 /// Valid values: en, es, pt-BR, zh, ja.
6070 #[prost(string, tag="6")]
6071 pub source_locale: ::prost::alloc::string::String,
6072}
6073/// Response after creating a template.
6074#[derive(Clone, PartialEq, ::prost::Message)]
6075pub struct CreateTemplateResponse {
6076 /// The newly created template (version 1).
6077 #[prost(message, optional, tag="1")]
6078 pub template: ::core::option::Option<Template>,
6079}
6080/// Request to update a template, creating a new version.
6081#[derive(Clone, PartialEq, ::prost::Message)]
6082pub struct UpdateTemplateRequest {
6083 /// ID of the template to update.
6084 #[prost(string, tag="1")]
6085 pub template_id: ::prost::alloc::string::String,
6086 /// New template body with {{variable}} placeholders.
6087 /// Constraints: Max length 50000 characters.
6088 #[prost(string, tag="2")]
6089 pub body: ::prost::alloc::string::String,
6090 /// Updated variables for substitution.
6091 #[prost(message, repeated, tag="3")]
6092 pub variables: ::prost::alloc::vec::Vec<TemplateVariable>,
6093}
6094/// Response after updating a template.
6095#[derive(Clone, PartialEq, ::prost::Message)]
6096pub struct UpdateTemplateResponse {
6097 /// The updated template with incremented version number.
6098 #[prost(message, optional, tag="1")]
6099 pub template: ::core::option::Option<Template>,
6100}
6101/// Request to retrieve a specific template version.
6102#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6103pub struct GetTemplateRequest {
6104 /// ID of the template to retrieve.
6105 #[prost(string, tag="1")]
6106 pub template_id: ::prost::alloc::string::String,
6107 /// Version to retrieve. 0 returns the latest version.
6108 #[prost(int32, tag="2")]
6109 pub version: i32,
6110}
6111/// Response containing the requested template.
6112#[derive(Clone, PartialEq, ::prost::Message)]
6113pub struct GetTemplateResponse {
6114 /// The requested template.
6115 #[prost(message, optional, tag="1")]
6116 pub template: ::core::option::Option<Template>,
6117}
6118/// Request to list templates with pagination.
6119#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6120pub struct ListTemplatesRequest {
6121 /// Pagination parameters.
6122 #[prost(message, optional, tag="1")]
6123 pub pagination: ::core::option::Option<Pagination>,
6124 /// Filter by template type. UNSPECIFIED returns all templates.
6125 #[prost(enumeration="TemplateType", tag="2")]
6126 pub r#type: i32,
6127}
6128/// Response containing a page of templates.
6129#[derive(Clone, PartialEq, ::prost::Message)]
6130pub struct ListTemplatesResponse {
6131 /// List of templates in this page (latest version of each).
6132 #[prost(message, repeated, tag="1")]
6133 pub templates: ::prost::alloc::vec::Vec<Template>,
6134 /// Pagination metadata for fetching subsequent pages.
6135 #[prost(message, optional, tag="2")]
6136 pub pagination_meta: ::core::option::Option<PaginationMeta>,
6137}
6138/// Request to create a translation for a template.
6139#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6140pub struct CreateTemplateTranslationRequest {
6141 /// ID of the template to translate.
6142 #[prost(string, tag="1")]
6143 pub template_id: ::prost::alloc::string::String,
6144 /// Version of the template to translate.
6145 #[prost(int32, tag="2")]
6146 pub version: i32,
6147 /// Target locale.
6148 #[prost(string, tag="3")]
6149 pub locale: ::prost::alloc::string::String,
6150 /// Translated title.
6151 #[prost(string, tag="4")]
6152 pub title: ::prost::alloc::string::String,
6153 /// Translated body content.
6154 #[prost(string, tag="5")]
6155 pub body: ::prost::alloc::string::String,
6156 /// Who created this translation ("ai:bedrock" or user UUID).
6157 #[prost(string, tag="6")]
6158 pub translated_by: ::prost::alloc::string::String,
6159 /// Initial status (typically DRAFT or AI_TRANSLATED).
6160 #[prost(enumeration="TranslationStatus", tag="7")]
6161 pub status: i32,
6162}
6163/// Response after creating a template translation.
6164#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6165pub struct CreateTemplateTranslationResponse {
6166 /// The created translation.
6167 #[prost(message, optional, tag="1")]
6168 pub translation: ::core::option::Option<TemplateTranslation>,
6169}
6170/// Request to update an existing template translation.
6171#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6172pub struct UpdateTemplateTranslationRequest {
6173 /// ID of the translation to update.
6174 #[prost(string, tag="1")]
6175 pub translation_id: ::prost::alloc::string::String,
6176 /// Updated title. Empty leaves unchanged.
6177 #[prost(string, tag="2")]
6178 pub title: ::prost::alloc::string::String,
6179 /// Updated body. Empty leaves unchanged.
6180 #[prost(string, tag="3")]
6181 pub body: ::prost::alloc::string::String,
6182 /// Updated status.
6183 #[prost(enumeration="TranslationStatus", tag="4")]
6184 pub status: i32,
6185}
6186/// Response after updating a template translation.
6187#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6188pub struct UpdateTemplateTranslationResponse {
6189 /// The updated translation.
6190 #[prost(message, optional, tag="1")]
6191 pub translation: ::core::option::Option<TemplateTranslation>,
6192}
6193/// Request to list translations for a template version.
6194#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6195pub struct ListTemplateTranslationsRequest {
6196 /// ID of the template.
6197 #[prost(string, tag="1")]
6198 pub template_id: ::prost::alloc::string::String,
6199 /// Version of the template. 0 returns translations for the latest version.
6200 #[prost(int32, tag="2")]
6201 pub version: i32,
6202}
6203/// Response containing all translations for a template version.
6204#[derive(Clone, PartialEq, ::prost::Message)]
6205pub struct ListTemplateTranslationsResponse {
6206 /// Translations for the requested template version.
6207 #[prost(message, repeated, tag="1")]
6208 pub translations: ::prost::alloc::vec::Vec<TemplateTranslation>,
6209}
6210/// Request to approve a template translation.
6211#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6212pub struct ApproveTemplateTranslationRequest {
6213 /// ID of the translation to approve.
6214 #[prost(string, tag="1")]
6215 pub translation_id: ::prost::alloc::string::String,
6216}
6217/// Response after approving a template translation.
6218#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6219pub struct ApproveTemplateTranslationResponse {
6220 /// The approved translation (status: APPROVED, reviewed_by and reviewed_at set).
6221 #[prost(message, optional, tag="1")]
6222 pub translation: ::core::option::Option<TemplateTranslation>,
6223}
6224// ─── Enums ──────────────────────────────────────────────────────────────────
6225
6226/// Content format of a template, determining which editor and renderer to use.
6227#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
6228#[repr(i32)]
6229pub enum TemplateType {
6230 /// Default value; treated as MARKDOWN for backward compatibility.
6231 Unspecified = 0,
6232 /// Markdown with {{variable}} placeholders.
6233 Markdown = 1,
6234 /// Rich text format (reserved for future use).
6235 Rich = 2,
6236 /// Raw HTML format (reserved for future use).
6237 Html = 3,
6238}
6239impl TemplateType {
6240 /// String value of the enum field names used in the ProtoBuf definition.
6241 ///
6242 /// The values are not transformed in any way and thus are considered stable
6243 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
6244 pub fn as_str_name(&self) -> &'static str {
6245 match self {
6246 Self::Unspecified => "TEMPLATE_TYPE_UNSPECIFIED",
6247 Self::Markdown => "TEMPLATE_TYPE_MARKDOWN",
6248 Self::Rich => "TEMPLATE_TYPE_RICH",
6249 Self::Html => "TEMPLATE_TYPE_HTML",
6250 }
6251 }
6252 /// Creates an enum from field names used in the ProtoBuf definition.
6253 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
6254 match value {
6255 "TEMPLATE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
6256 "TEMPLATE_TYPE_MARKDOWN" => Some(Self::Markdown),
6257 "TEMPLATE_TYPE_RICH" => Some(Self::Rich),
6258 "TEMPLATE_TYPE_HTML" => Some(Self::Html),
6259 _ => None,
6260 }
6261 }
6262}
6263/// Source from which a template variable's value is resolved at render time.
6264#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
6265#[repr(i32)]
6266pub enum TemplateVariableSource {
6267 /// Default value; treated as CUSTOM for backward compatibility.
6268 Unspecified = 0,
6269 /// Auto-resolved from the target user's profile attributes.
6270 Profile = 1,
6271 /// Provided manually in the campaign or workflow step configuration.
6272 Custom = 2,
6273}
6274impl TemplateVariableSource {
6275 /// String value of the enum field names used in the ProtoBuf definition.
6276 ///
6277 /// The values are not transformed in any way and thus are considered stable
6278 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
6279 pub fn as_str_name(&self) -> &'static str {
6280 match self {
6281 Self::Unspecified => "TEMPLATE_VARIABLE_SOURCE_UNSPECIFIED",
6282 Self::Profile => "TEMPLATE_VARIABLE_SOURCE_PROFILE",
6283 Self::Custom => "TEMPLATE_VARIABLE_SOURCE_CUSTOM",
6284 }
6285 }
6286 /// Creates an enum from field names used in the ProtoBuf definition.
6287 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
6288 match value {
6289 "TEMPLATE_VARIABLE_SOURCE_UNSPECIFIED" => Some(Self::Unspecified),
6290 "TEMPLATE_VARIABLE_SOURCE_PROFILE" => Some(Self::Profile),
6291 "TEMPLATE_VARIABLE_SOURCE_CUSTOM" => Some(Self::Custom),
6292 _ => None,
6293 }
6294 }
6295}
6296/// Review status of a template translation.
6297#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
6298#[repr(i32)]
6299pub enum TranslationStatus {
6300 Unspecified = 0,
6301 /// Translation draft, not yet reviewed.
6302 Draft = 1,
6303 /// Translation generated by AI, pending human review.
6304 AiTranslated = 2,
6305 /// Translation is being reviewed by a human.
6306 InReview = 3,
6307 /// Translation has been approved for use.
6308 Approved = 4,
6309}
6310impl TranslationStatus {
6311 /// String value of the enum field names used in the ProtoBuf definition.
6312 ///
6313 /// The values are not transformed in any way and thus are considered stable
6314 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
6315 pub fn as_str_name(&self) -> &'static str {
6316 match self {
6317 Self::Unspecified => "TRANSLATION_STATUS_UNSPECIFIED",
6318 Self::Draft => "TRANSLATION_STATUS_DRAFT",
6319 Self::AiTranslated => "TRANSLATION_STATUS_AI_TRANSLATED",
6320 Self::InReview => "TRANSLATION_STATUS_IN_REVIEW",
6321 Self::Approved => "TRANSLATION_STATUS_APPROVED",
6322 }
6323 }
6324 /// Creates an enum from field names used in the ProtoBuf definition.
6325 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
6326 match value {
6327 "TRANSLATION_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
6328 "TRANSLATION_STATUS_DRAFT" => Some(Self::Draft),
6329 "TRANSLATION_STATUS_AI_TRANSLATED" => Some(Self::AiTranslated),
6330 "TRANSLATION_STATUS_IN_REVIEW" => Some(Self::InReview),
6331 "TRANSLATION_STATUS_APPROVED" => Some(Self::Approved),
6332 _ => None,
6333 }
6334 }
6335}
6336// ─── Messages ───────────────────────────────────────────────────────────────
6337
6338/// Decoded deeplink-token payload. Populated by ValidateDeeplinkToken
6339/// only when validation succeeds.
6340#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6341pub struct DeeplinkTokenPayload {
6342 /// Campaign UUID the deeplink targets. The native app uses this for the
6343 /// authenticated GetCampaign follow-up post-recipient-auth.
6344 #[prost(string, tag="1")]
6345 pub campaign_id: ::prost::alloc::string::String,
6346 /// Recipient UUID the token authorizes. The token does not authenticate
6347 /// the recipient (that's the auth flow's job); it authorizes "this
6348 /// deeplink path is for this recipient" so the native app can refuse
6349 /// to render a token whose embedded recipient mismatches the signed-in
6350 /// user.
6351 #[prost(string, tag="2")]
6352 pub recipient_user_id: ::prost::alloc::string::String,
6353 /// Step kind the deeplink targets — REMINDER vs ESCALATION. Lets the
6354 /// native app pick the right campaign-card variant before the auth
6355 /// gate.
6356 #[prost(enumeration="ChannelStepKind", tag="3")]
6357 pub step_kind: i32,
6358 /// Expiry the token carries. Validation rejects tokens past this time
6359 /// even if the signature checks out.
6360 #[prost(message, optional, tag="4")]
6361 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
6362}
6363#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6364pub struct SignDeeplinkTokenRequest {
6365 /// Campaign whose deeplink this token authorizes. Constraints: required,
6366 /// must be a UUID and exist within the caller's organization.
6367 #[prost(string, tag="1")]
6368 pub campaign_id: ::prost::alloc::string::String,
6369 /// Recipient the token authorizes. Constraints: required, must be a UUID
6370 /// and a member of the campaign's audience.
6371 #[prost(string, tag="2")]
6372 pub recipient_user_id: ::prost::alloc::string::String,
6373 /// Step kind the deeplink targets. Required.
6374 #[prost(enumeration="ChannelStepKind", tag="3")]
6375 pub step_kind: i32,
6376 /// Token lifetime in seconds from now. Constraints: required, must be
6377 /// in (0, 30 * 24 * 3600] (1 second to 30 days). 30 days matches the
6378 /// platform's outer bound on actionable campaign lifetimes; longer
6379 /// tokens are not signed.
6380 #[prost(int64, tag="4")]
6381 pub ttl_seconds: i64,
6382}
6383#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6384pub struct SignDeeplinkTokenResponse {
6385 /// The signed token, ready to URL-embed in
6386 /// links.pidgr.com/c/{short_code}?t={token}. Format: base64url-encoded
6387 /// payload (JSON) + base64url-encoded HMAC-SHA256 trailer, joined by
6388 /// a single dot. Implementation detail — clients SHOULD NOT parse or
6389 /// mutate the token; they pass it back to ValidateDeeplinkToken.
6390 #[prost(string, tag="1")]
6391 pub token: ::prost::alloc::string::String,
6392 /// The expiry the token carries. Echoed back so clients don't need to
6393 /// redo the time-math the caller passed in via ttl_seconds.
6394 #[prost(message, optional, tag="2")]
6395 pub expires_at: ::core::option::Option<::prost_types::Timestamp>,
6396 /// The platform key version used to sign. Clients MAY record for
6397 /// telemetry but SHOULD NOT branch logic on it — the platform manages
6398 /// overlap windows during rotation transparently.
6399 #[prost(int32, tag="3")]
6400 pub key_version: i32,
6401}
6402#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6403pub struct ValidateDeeplinkTokenRequest {
6404 /// The token bytes from the deeplink URL's `t` query parameter.
6405 /// Constraints: required, non-empty.
6406 #[prost(string, tag="1")]
6407 pub token: ::prost::alloc::string::String,
6408 /// Campaign UUID embedded in the URL path (translated from the
6409 /// short-code by the native app via CampaignService.GetCampaignByShortCode).
6410 /// Validation rejects when the token's embedded campaign_id does not
6411 /// match — defense against replay attacks that swap the short-code
6412 /// path component while reusing a signed token from a different
6413 /// campaign.
6414 #[prost(string, tag="2")]
6415 pub campaign_id: ::prost::alloc::string::String,
6416}
6417#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6418pub struct ValidateDeeplinkTokenResponse {
6419 /// True when signature + expiry both check out under any active or
6420 /// overlap-window key version.
6421 #[prost(bool, tag="1")]
6422 pub valid: bool,
6423 /// Reason validation failed. Set only when valid=false; UNSPECIFIED
6424 /// when valid=true. The native app uses this to drive UX (silent retry
6425 /// vs. "this link expired" message vs. "this link looks tampered").
6426 #[prost(enumeration="ValidationFailureReason", tag="2")]
6427 pub failure_reason: i32,
6428 /// Decoded payload. Populated only when valid=true. The native app
6429 /// SHOULD compare payload.recipient_user_id against the signed-in user
6430 /// and refuse to render the campaign card on mismatch.
6431 #[prost(message, optional, tag="3")]
6432 pub payload: ::core::option::Option<DeeplinkTokenPayload>,
6433}
6434// ─── Enums ──────────────────────────────────────────────────────────────────
6435
6436/// Reason a deeplink-token validation failed. Empty when valid=true.
6437#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
6438#[repr(i32)]
6439pub enum ValidationFailureReason {
6440 Unspecified = 0,
6441 /// Token bytes parsed but the HMAC signature did not verify under any
6442 /// active or overlap-window key version.
6443 InvalidSignature = 1,
6444 /// Token signature verified but its embedded expiry has passed.
6445 Expired = 2,
6446 /// Signature would have verified, but the key version that signed the
6447 /// token is past the rotation overlap window and has been hard-deleted.
6448 /// This means the token is older than the platform's retention bound
6449 /// (rotation cadence + overlap window) — operationally equivalent to
6450 /// EXPIRED but distinguishable for telemetry.
6451 KeyRetired = 3,
6452 /// Token bytes could not be parsed at all (not base64url, wrong length,
6453 /// missing payload separator, etc.). Indicates a tampered or
6454 /// truncated URL.
6455 Malformed = 4,
6456}
6457impl ValidationFailureReason {
6458 /// String value of the enum field names used in the ProtoBuf definition.
6459 ///
6460 /// The values are not transformed in any way and thus are considered stable
6461 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
6462 pub fn as_str_name(&self) -> &'static str {
6463 match self {
6464 Self::Unspecified => "VALIDATION_FAILURE_REASON_UNSPECIFIED",
6465 Self::InvalidSignature => "VALIDATION_FAILURE_REASON_INVALID_SIGNATURE",
6466 Self::Expired => "VALIDATION_FAILURE_REASON_EXPIRED",
6467 Self::KeyRetired => "VALIDATION_FAILURE_REASON_KEY_RETIRED",
6468 Self::Malformed => "VALIDATION_FAILURE_REASON_MALFORMED",
6469 }
6470 }
6471 /// Creates an enum from field names used in the ProtoBuf definition.
6472 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
6473 match value {
6474 "VALIDATION_FAILURE_REASON_UNSPECIFIED" => Some(Self::Unspecified),
6475 "VALIDATION_FAILURE_REASON_INVALID_SIGNATURE" => Some(Self::InvalidSignature),
6476 "VALIDATION_FAILURE_REASON_EXPIRED" => Some(Self::Expired),
6477 "VALIDATION_FAILURE_REASON_KEY_RETIRED" => Some(Self::KeyRetired),
6478 "VALIDATION_FAILURE_REASON_MALFORMED" => Some(Self::Malformed),
6479 _ => None,
6480 }
6481 }
6482}
6483include!("pidgr.v1.tonic.rs");
6484// @@protoc_insertion_point(module)