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