1use serde::{Deserialize, Serialize};
2
3use super::super::{CodeParseStatus, SymbolRole};
4use super::RepositoryCodeRange;
5
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8pub struct RepositoryCodeFileRecord {
9 pub repository_id: String,
10 pub source_scope: String,
11 pub file_id: String,
12 pub path: String,
13 pub language_id: String,
14 pub blob_hash: String,
15 pub byte_len: usize,
16 pub line_count: usize,
17 pub parse_status: CodeParseStatus,
18 #[serde(default)]
19 pub is_generated: bool,
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub degraded_reason: Option<String>,
22}
23
24#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
26pub struct CodeFileFingerprint {
27 pub path: String,
28 pub blob_hash: String,
29}
30
31#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
33pub struct RepositoryCodeSymbolRecord {
34 pub repository_id: String,
35 pub source_scope: String,
36 pub symbol_snapshot_id: String,
37 pub canonical_symbol_id: String,
38 pub file_id: String,
39 pub path: String,
40 pub language_id: String,
41 pub name: String,
42 pub qualified_name: String,
43 pub kind: String,
44 pub signature: String,
45 #[serde(skip_serializing_if = "Option::is_none")]
46 pub doc_comment: Option<String>,
47 pub byte_range: RepositoryCodeRange,
48 pub line_range: RepositoryCodeRange,
49 #[serde(default, skip_serializing_if = "Option::is_none")]
50 pub symbol_role: Option<SymbolRole>,
51}
52
53#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
55pub struct RepositoryCodeReferenceRecord {
56 pub repository_id: String,
57 pub source_scope: String,
58 pub reference_id: String,
59 pub file_id: String,
60 pub path: String,
61 pub name: String,
62 pub kind: String,
63 #[serde(skip_serializing_if = "Option::is_none")]
64 pub target_symbol_snapshot_id: Option<String>,
65 #[serde(skip_serializing_if = "Option::is_none")]
66 pub target_hint: Option<String>,
67 pub resolution_state: String,
68 pub confidence_basis_points: u16,
69 pub confidence_tier: String,
70 pub byte_range: RepositoryCodeRange,
71 pub line_range: RepositoryCodeRange,
72}
73
74#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
76pub struct CodeImportRecord {
77 pub repository_id: String,
78 pub source_scope: String,
79 pub import_id: String,
80 pub file_id: String,
81 pub path: String,
82 pub module: String,
83 #[serde(skip_serializing_if = "Option::is_none")]
84 pub target_hint: Option<String>,
85 pub resolution_state: String,
86 pub confidence_basis_points: u16,
87 pub confidence_tier: String,
88 pub line_range: RepositoryCodeRange,
89}
90
91#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
93pub struct CodeCallRecord {
94 pub repository_id: String,
95 pub source_scope: String,
96 pub call_id: String,
97 pub file_id: String,
98 pub path: String,
99 pub caller_symbol_snapshot_id: Option<String>,
100 pub caller_name: Option<String>,
101 #[serde(skip_serializing_if = "Option::is_none")]
102 pub callee_symbol_snapshot_id: Option<String>,
103 pub callee_name: String,
104 #[serde(skip_serializing_if = "Option::is_none")]
105 pub target_hint: Option<String>,
106 pub resolution_state: String,
107 pub confidence_basis_points: u16,
108 pub confidence_tier: String,
109 pub line_range: RepositoryCodeRange,
110}
111
112#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
114pub struct CodeRouteRecord {
115 pub repository_id: String,
116 pub source_scope: String,
117 pub route_id: String,
118 pub file_id: String,
119 pub path: String,
120 pub language_id: String,
121 pub url: String,
122 pub http_method: String,
124 pub handler_name: String,
125 #[serde(skip_serializing_if = "Option::is_none")]
126 pub handler_symbol_snapshot_id: Option<String>,
127 pub framework: String,
128 pub line_range: RepositoryCodeRange,
129}
130
131#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
133pub struct CodeFeatureFlagRecord {
134 pub repository_id: String,
135 pub source_scope: String,
136 pub feature_flag_id: String,
137 pub usage_id: String,
138 pub file_id: String,
139 pub path: String,
140 pub language_id: String,
141 pub name: String,
142 pub source_kind: String,
143 pub source_key: String,
144 pub edge_kind: String,
145 pub confidence_basis_points: u16,
146 pub confidence_tier: String,
147 pub byte_range: RepositoryCodeRange,
148 pub line_range: RepositoryCodeRange,
149 pub excerpt: String,
150}
151
152#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
154pub struct RepositoryCodeChunkRecord {
155 pub repository_id: String,
156 pub source_scope: String,
157 pub chunk_id: String,
158 pub file_id: String,
159 pub path: String,
160 pub language_id: String,
161 pub content: String,
162 pub byte_range: RepositoryCodeRange,
163 pub line_range: RepositoryCodeRange,
164 pub symbol_snapshot_id: Option<String>,
165}
166
167#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
169pub struct CodeFileDiagnostic {
170 pub repository_id: String,
171 pub source_scope: String,
172 pub path: String,
173 pub parse_status: CodeParseStatus,
174 pub message: String,
175}
176
177#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
179pub struct CodePathTombstone {
180 pub repository_id: String,
181 pub source_scope: String,
182 pub old_path: String,
183 pub new_path: Option<String>,
184 pub base_ref: String,
185 pub head_ref: String,
186}