1use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct Entity {
9 pub id: String,
10 pub name: String,
11 pub entity_type: String,
12 #[serde(default, alias = "domain")]
13 pub space: Option<String>,
14 pub source_agent: Option<String>,
15 pub confidence: Option<f32>,
16 pub confirmed: bool,
17 pub created_at: i64,
18 pub updated_at: i64,
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct EntitySearchResult {
24 pub entity: Entity,
25 pub distance: f32,
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30pub struct EntityDetail {
31 pub entity: Entity,
32 pub observations: Vec<Observation>,
33 pub relations: Vec<RelationWithEntity>,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct Observation {
39 pub id: String,
40 pub entity_id: String,
41 pub content: String,
42 pub source_agent: Option<String>,
43 pub confidence: Option<f32>,
44 pub confirmed: bool,
45 pub created_at: i64,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct Relation {
51 pub id: String,
52 pub from_entity: String,
53 pub to_entity: String,
54 pub relation_type: String,
55 pub source_agent: Option<String>,
56 pub created_at: i64,
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61pub struct RelationWithEntity {
62 pub id: String,
63 pub relation_type: String,
64 pub direction: String,
65 pub entity_id: String,
66 pub entity_name: String,
67 pub entity_type: String,
68 pub source_agent: Option<String>,
69 pub created_at: i64,
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74pub struct RecentRelation {
75 pub id: String,
76 pub from_entity_id: String,
77 pub relation_type: String,
78 pub to_entity_id: String,
79 pub from_entity_name: String,
80 pub to_entity_name: String,
81 pub created_at_ms: i64,
83}
84
85#[derive(Debug, Serialize, Deserialize)]
87pub struct EntitySuggestion {
88 pub id: String,
89 pub entity_name: Option<String>,
90 pub source_ids: Vec<String>,
91 pub confidence: f64,
92 pub created_at: String,
93}