1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3use systemprompt_identifiers::CategoryId;
4
5pub use crate::commands::shared::{ValidationIssue, ValidationOutput};
6
7#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
8pub struct ContentTypeListOutput {
9 pub content_types: Vec<ContentTypeSummary>,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
13pub struct ContentTypeSummary {
14 pub name: String,
15 #[serde(rename = "source_id")]
16 pub source: String,
17 pub category_id: CategoryId,
18 pub enabled: bool,
19 pub path: String,
20 pub url_pattern: Option<String>,
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
24pub struct ContentTypeDetailOutput {
25 pub name: String,
26 #[serde(rename = "source_id")]
27 pub source: String,
28 pub category_id: CategoryId,
29 pub enabled: bool,
30 pub path: String,
31 pub description: String,
32 pub allowed_content_types: Vec<String>,
33 pub sitemap: Option<SitemapInfo>,
34 pub branding: Option<BrandingInfo>,
35 pub indexing: Option<IndexingInfo>,
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
39pub struct SitemapInfo {
40 pub enabled: bool,
41 pub url_pattern: String,
42 pub priority: f32,
43 pub changefreq: String,
44 pub fetch_from: String,
45 pub parent_route: Option<ParentRouteInfo>,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
49pub struct ParentRouteInfo {
50 pub enabled: bool,
51 pub url: String,
52 pub priority: f32,
53 pub changefreq: String,
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
57pub struct BrandingInfo {
58 pub name: Option<String>,
59 pub description: Option<String>,
60 pub image: Option<String>,
61 pub keywords: Option<String>,
62}
63
64#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema)]
65pub struct IndexingInfo {
66 pub clear_before: bool,
67 pub recursive: bool,
68 pub override_existing: bool,
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
72pub struct ContentTypeCreateOutput {
73 pub name: String,
74 pub message: String,
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
78pub struct ContentTypeEditOutput {
79 pub name: String,
80 pub message: String,
81 pub changes: Vec<String>,
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
85pub struct ContentTypeDeleteOutput {
86 pub deleted: Vec<String>,
87 pub message: String,
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
91pub struct TemplateListOutput {
92 pub templates: Vec<TemplateSummary>,
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
96pub struct TemplateSummary {
97 pub name: String,
98 pub content_types: Vec<String>,
99 pub file_exists: bool,
100 pub file_path: String,
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
104pub struct TemplateDetailOutput {
105 pub name: String,
106 pub content_types: Vec<String>,
107 pub file_path: String,
108 pub file_exists: bool,
109 pub variables: Vec<String>,
110 pub preview_lines: Vec<String>,
111}
112
113#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
114pub struct TemplateCreateOutput {
115 pub name: String,
116 pub file_path: String,
117 pub message: String,
118}
119
120#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
121pub struct TemplateEditOutput {
122 pub name: String,
123 pub message: String,
124 pub changes: Vec<String>,
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
128pub struct TemplateDeleteOutput {
129 pub deleted: String,
130 pub file_deleted: bool,
131 pub message: String,
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
135pub struct AssetListOutput {
136 pub assets: Vec<AssetSummary>,
137}
138
139#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
140pub struct AssetSummary {
141 pub path: String,
142 pub asset_type: AssetType,
143 pub size_bytes: u64,
144 pub modified: String,
145}
146
147#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
148#[serde(rename_all = "lowercase")]
149pub enum AssetType {
150 Css,
151 Logo,
152 Favicon,
153 Font,
154 Image,
155 Other,
156}
157
158impl std::fmt::Display for AssetType {
159 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
160 match self {
161 Self::Css => write!(f, "css"),
162 Self::Logo => write!(f, "logo"),
163 Self::Favicon => write!(f, "favicon"),
164 Self::Font => write!(f, "font"),
165 Self::Image => write!(f, "image"),
166 Self::Other => write!(f, "other"),
167 }
168 }
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
172pub struct AssetDetailOutput {
173 pub path: String,
174 pub absolute_path: String,
175 pub asset_type: AssetType,
176 pub size_bytes: u64,
177 pub modified: String,
178 pub referenced_in: Vec<String>,
179}
180
181#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
182pub struct SitemapShowOutput {
183 pub routes: Vec<SitemapRoute>,
184 pub total_routes: usize,
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
188pub struct SitemapRoute {
189 pub url: String,
190 pub priority: f32,
191 pub changefreq: String,
192 pub source: String,
193}
194
195#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
196pub struct SitemapGenerateOutput {
197 pub output_path: String,
198 pub routes_count: usize,
199 pub message: String,
200}
201
202#[derive(Debug, Clone, Serialize, Deserialize)]
203pub struct TemplatesConfig {
204 pub templates: std::collections::HashMap<String, TemplateEntry>,
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
208pub struct TemplateEntry {
209 pub content_types: Vec<String>,
210}