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