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 pub domain: Option<String>,
13 pub source_agent: Option<String>,
14 pub confidence: Option<f32>,
15 pub confirmed: bool,
16 pub created_at: i64,
17 pub updated_at: i64,
18}
19
20#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct EntitySearchResult {
23 pub entity: Entity,
24 pub distance: f32,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct EntityDetail {
30 pub entity: Entity,
31 pub observations: Vec<Observation>,
32 pub relations: Vec<RelationWithEntity>,
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct Observation {
38 pub id: String,
39 pub entity_id: String,
40 pub content: String,
41 pub source_agent: Option<String>,
42 pub confidence: Option<f32>,
43 pub confirmed: bool,
44 pub created_at: i64,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49pub struct Relation {
50 pub id: String,
51 pub from_entity: String,
52 pub to_entity: String,
53 pub relation_type: String,
54 pub source_agent: Option<String>,
55 pub created_at: i64,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60pub struct RelationWithEntity {
61 pub id: String,
62 pub relation_type: String,
63 pub direction: String,
64 pub entity_id: String,
65 pub entity_name: String,
66 pub entity_type: String,
67 pub source_agent: Option<String>,
68 pub created_at: i64,
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize)]
73pub struct RecentRelation {
74 pub id: String,
75 pub from_entity_id: String,
76 pub relation_type: String,
77 pub to_entity_id: String,
78 pub from_entity_name: String,
79 pub to_entity_name: String,
80 pub created_at_ms: i64,
82}
83
84#[derive(Debug, Serialize, Deserialize)]
86pub struct EntitySuggestion {
87 pub id: String,
88 pub entity_name: Option<String>,
89 pub source_ids: Vec<String>,
90 pub confidence: f64,
91 pub created_at: String,
92}