Skip to main content

pidgr_proto/pidgr/v1/
pidgr.v1.rs

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