systemprompt_models/documents/
comment_events.rs1use chrono::{DateTime, Utc};
12use schemars::JsonSchema;
13use serde::{Deserialize, Serialize};
14use systemprompt_identifiers::{DocumentCommentId, DocumentId, UserId};
15
16#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
17pub struct DocumentCommentUpdatedEvent {
18 pub document_id: DocumentId,
19 pub comment_id: DocumentCommentId,
20 pub edited_by: UserId,
21 #[serde(default, skip_serializing_if = "Vec::is_empty")]
22 pub mentions: Vec<UserId>,
23}
24
25impl DocumentCommentUpdatedEvent {
26 pub const NAME: &'static str = "document.comment.updated";
27}
28
29#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
30pub struct DocumentCommentDeletedEvent {
31 pub document_id: DocumentId,
32 pub comment_id: DocumentCommentId,
33 pub deleted_by: UserId,
34}
35
36impl DocumentCommentDeletedEvent {
37 pub const NAME: &'static str = "document.comment.deleted";
38}
39
40#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
51pub struct DocumentCommentMentionedEvent {
52 pub document_id: DocumentId,
53 pub comment_id: DocumentCommentId,
54 pub mentioned_user_id: UserId,
55 pub author_id: UserId,
56 #[serde(default)]
57 pub v: u32,
58 #[serde(default, skip_serializing_if = "Option::is_none")]
59 pub via_agent: Option<String>,
60 #[serde(default)]
61 pub mentions: Vec<UserId>,
62 #[serde(default)]
63 pub granted: Vec<UserId>,
64 #[serde(default)]
65 pub excerpt: String,
66 #[serde(default, skip_serializing_if = "Option::is_none")]
67 pub anchor_quote: Option<String>,
68 #[serde(default, skip_serializing_if = "Option::is_none")]
69 pub created_at: Option<DateTime<Utc>>,
70}
71
72pub const MENTION_EVENT_VERSION: u32 = 1;
73
74pub const MENTION_EXCERPT_CHARS: usize = 280;
75
76impl DocumentCommentMentionedEvent {
77 pub const NAME: &'static str = "document.comment.mentioned";
78}