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