Skip to main content

cloudillo_types/
action_types.rs

1//! Action-related types shared between server and adapters.
2
3use serde::{Deserialize, Serialize};
4use serde_with::skip_serializing_none;
5
6use crate::types::Timestamp;
7
8pub use crate::auth_adapter::ACCESS_TOKEN_EXPIRY;
9
10#[skip_serializing_none]
11#[derive(Debug, Default, Clone, Serialize, Deserialize)]
12pub struct CreateAction {
13	#[serde(rename = "type")]
14	pub typ: Box<str>,
15	#[serde(rename = "subType")]
16	pub sub_typ: Option<Box<str>>,
17	#[serde(rename = "parentId")]
18	pub parent_id: Option<Box<str>>,
19	#[serde(rename = "audienceTag")]
20	pub audience_tag: Option<Box<str>>,
21	pub content: Option<serde_json::Value>,
22	pub attachments: Option<Vec<Box<str>>>,
23	pub subject: Option<Box<str>>,
24	#[serde(rename = "expiresAt")]
25	pub expires_at: Option<Timestamp>,
26	pub visibility: Option<char>,
27	/// Action flags (R/r=reactions, C/c=comments, O/o=open)
28	pub flags: Option<Box<str>>,
29	/// Extensible metadata (stored in x column, not in JWT)
30	/// Used for server-side data like x.role for SUBS actions
31	pub x: Option<serde_json::Value>,
32}
33
34/// Action status codes for tracking action lifecycle state
35pub mod status {
36	/// Active/Accepted/Approved - Unified status for actions in good standing
37	/// Used for: new actions, manually accepted actions, auto-approved actions
38	pub const ACTIVE: char = 'A';
39
40	/// Confirmation required - Action awaits user decision (accept/reject)
41	/// Used for: CONN requests without mutual, FSHR file shares
42	pub const CONFIRMATION: char = 'C';
43
44	/// Notification - Auto-processed, informational only
45	/// Used for: mutual CONN auto-accepted, REACT notifications
46	pub const NOTIFICATION: char = 'N';
47
48	/// Deleted/Rejected - Action was rejected or deleted
49	/// Used for: rejected requests, deleted content
50	pub const DELETED: char = 'D';
51}
52
53// vim: ts=4