Skip to main content

oxirs_chat/
rich_content_types.rs

1//! Rich content types — the data model for the rich messaging layer.
2//!
3//! Sibling module of [`crate::rich_content`]. Defines [`RichContent`] and
4//! its supporting structures: code themes, query stats, graph nodes and
5//! edges, table cells, chart datasets, timeline events, maps, 3D scenes,
6//! dashboards, and multimedia descriptors. Also exposes the shared
7//! [`ChatError`] / [`ChatResult`] aliases used throughout the layer.
8
9use serde::{Deserialize, Serialize};
10use std::collections::HashMap;
11use std::path::PathBuf;
12
13/// Chat-specific error type.
14#[derive(Debug, thiserror::Error)]
15pub enum ChatError {
16    #[error("Processing error: {0}")]
17    Processing(String),
18    #[error("Validation error: {0}")]
19    Validation(String),
20    #[error("IO error: {0}")]
21    Io(#[from] std::io::Error),
22    #[error("Serialization error: {0}")]
23    Serialization(#[from] serde_json::Error),
24}
25
26/// Chat result type alias.
27pub type ChatResult<T> = Result<T, ChatError>;
28
29/// Rich content types supported in chat messages.
30#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
31pub enum RichContent {
32    /// Plain text content.
33    Text(String),
34    /// Code snippet with syntax highlighting.
35    CodeSnippet {
36        code: String,
37        language: String,
38        filename: Option<String>,
39        line_numbers: bool,
40        highlight_lines: Vec<usize>,
41        theme: CodeTheme,
42    },
43    /// SPARQL query block with validation.
44    SparqlQuery {
45        query: String,
46        valid: bool,
47        error_message: Option<String>,
48        execution_plan: Option<String>,
49        performance_stats: Option<QueryPerformanceStats>,
50    },
51    /// Advanced graph visualization data.
52    GraphVisualization {
53        nodes: Vec<GraphNode>,
54        edges: Vec<GraphEdge>,
55        layout: GraphLayout,
56        styling: GraphStyling,
57        interactive_features: InteractiveFeatures,
58        metadata: HashMap<String, String>,
59    },
60    /// Enhanced table output with advanced features.
61    Table {
62        headers: Vec<TableHeader>,
63        rows: Vec<TableRow>,
64        pagination: Option<TablePagination>,
65        sorting: Option<TableSorting>,
66        filtering: Option<TableFiltering>,
67        styling: TableStyling,
68        metadata: HashMap<String, String>,
69    },
70    /// Interactive chart visualization.
71    Chart {
72        chart_type: ChartType,
73        data: ChartData,
74        configuration: ChartConfiguration,
75        styling: ChartStyling,
76        interactive_features: ChartInteractivity,
77    },
78    /// Timeline visualization.
79    Timeline {
80        events: Vec<TimelineEvent>,
81        range: TimelineRange,
82        styling: TimelineStyling,
83        zoom_levels: Vec<TimelineZoomLevel>,
84        interactive: bool,
85    },
86    /// Geographic map visualization.
87    Map {
88        map_type: MapType,
89        center: GeoCoordinate,
90        zoom_level: u8,
91        markers: Vec<MapMarker>,
92        layers: Vec<MapLayer>,
93        styling: MapStyling,
94    },
95    /// 3D visualization.
96    ThreeDVisualization {
97        objects: Vec<ThreeDObject>,
98        camera: CameraSettings,
99        lighting: LightingSettings,
100        materials: Vec<Material>,
101        animations: Vec<Animation>,
102    },
103    /// Data dashboard with multiple widgets.
104    Dashboard {
105        widgets: Vec<DashboardWidget>,
106        layout: DashboardLayout,
107        refresh_interval: Option<std::time::Duration>,
108        real_time_updates: bool,
109    },
110    /// Image attachment with annotations.
111    Image {
112        url: String,
113        alt_text: Option<String>,
114        width: Option<u32>,
115        height: Option<u32>,
116        annotations: Vec<ImageAnnotation>,
117        filters: Vec<ImageFilter>,
118    },
119    /// Audio content.
120    Audio {
121        url: String,
122        duration: Option<std::time::Duration>,
123        waveform: Option<Vec<f32>>,
124        transcript: Option<String>,
125    },
126    /// Video content.
127    Video {
128        url: String,
129        duration: Option<std::time::Duration>,
130        thumbnail: Option<String>,
131        subtitles: Vec<SubtitleTrack>,
132        chapters: Vec<VideoChapter>,
133    },
134    /// File upload with preview.
135    File {
136        path: PathBuf,
137        filename: String,
138        mime_type: String,
139        size: u64,
140        preview: Option<FilePreview>,
141        metadata: FileMetadata,
142    },
143    /// Interactive widget.
144    Widget {
145        widget_type: WidgetType,
146        configuration: serde_json::Value,
147        state: serde_json::Value,
148        interactive: bool,
149    },
150}
151
152// ---------------------------------------------------------------------
153// Code visualization types
154// ---------------------------------------------------------------------
155
156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
157pub enum CodeTheme {
158    #[default]
159    Light,
160    Dark,
161    HighContrast,
162    Monokai,
163    Solarized,
164    GitHub,
165    VSCode,
166    Custom(String),
167}
168
169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
170pub struct QueryPerformanceStats {
171    pub execution_time_ms: u64,
172    pub result_count: usize,
173    pub memory_used_mb: f64,
174    pub query_plan_complexity: u32,
175}
176
177impl Default for QueryPerformanceStats {
178    fn default() -> Self {
179        Self {
180            execution_time_ms: 0,
181            result_count: 0,
182            memory_used_mb: 0.0,
183            query_plan_complexity: 0,
184        }
185    }
186}
187
188// ---------------------------------------------------------------------
189// Graph visualization types
190// ---------------------------------------------------------------------
191
192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
193pub struct GraphNode {
194    pub id: String,
195    pub label: String,
196    pub node_type: String,
197    pub properties: HashMap<String, String>,
198    pub position: Option<NodePosition>,
199    pub styling: NodeStyling,
200    pub size: f64,
201    pub shape: NodeShape,
202}
203
204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
205pub struct GraphEdge {
206    pub source: String,
207    pub target: String,
208    pub label: String,
209    pub edge_type: String,
210    pub properties: HashMap<String, String>,
211    pub styling: EdgeStyling,
212    pub weight: f64,
213    pub directed: bool,
214}
215
216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
217pub struct NodePosition {
218    pub x: f64,
219    pub y: f64,
220    pub z: Option<f64>,
221}
222
223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
224pub struct NodeStyling {
225    pub color: String,
226    pub border_color: String,
227    pub border_width: f64,
228    pub opacity: f64,
229    pub font_size: f64,
230    pub font_color: String,
231}
232
233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
234pub enum NodeShape {
235    Circle,
236    Square,
237    Triangle,
238    Diamond,
239    Star,
240    Hexagon,
241    Custom(String),
242}
243
244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
245pub struct EdgeStyling {
246    pub color: String,
247    pub width: f64,
248    pub opacity: f64,
249    pub style: EdgeStyle,
250    pub arrow_type: ArrowType,
251}
252
253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
254pub enum EdgeStyle {
255    Solid,
256    Dashed,
257    Dotted,
258    Curved,
259    Straight,
260}
261
262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
263pub enum ArrowType {
264    None,
265    Standard,
266    Filled,
267    Open,
268    Diamond,
269    Circle,
270}
271
272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
273pub enum NodeSize {
274    Small,
275    Medium,
276    Large,
277    ExtraLarge,
278    Custom(f64),
279}
280
281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
282pub enum EdgeThickness {
283    Thin,
284    Medium,
285    Thick,
286    ExtraThick,
287    Custom(f64),
288}
289
290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
291pub enum GraphLayout {
292    #[default]
293    ForceDirected,
294    Circular,
295    Hierarchical,
296    Grid,
297    Tree,
298    Cluster,
299    Custom {
300        algorithm: String,
301        parameters: HashMap<String, f64>,
302    },
303}
304
305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
306pub struct GraphStyling {
307    pub background_color: String,
308    pub grid_enabled: bool,
309    pub physics_enabled: bool,
310    pub clustering_enabled: bool,
311    pub smooth_curves: bool,
312    pub node_color: String,
313    pub edge_color: String,
314    pub node_size: NodeSize,
315    pub edge_thickness: EdgeThickness,
316    pub layout_algorithm: String,
317    pub show_labels: bool,
318}
319
320impl Default for GraphStyling {
321    fn default() -> Self {
322        Self {
323            background_color: "#ffffff".to_string(),
324            grid_enabled: false,
325            physics_enabled: true,
326            clustering_enabled: false,
327            smooth_curves: true,
328            node_color: "#3498db".to_string(),
329            edge_color: "#7f8c8d".to_string(),
330            node_size: NodeSize::Medium,
331            edge_thickness: EdgeThickness::Medium,
332            layout_algorithm: "force".to_string(),
333            show_labels: true,
334        }
335    }
336}
337
338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
339pub struct InteractiveFeatures {
340    pub pan_enabled: bool,
341    pub zoom_enabled: bool,
342    pub node_selection: bool,
343    pub edge_selection: bool,
344    pub hover_effects: bool,
345    pub click_to_expand: bool,
346    pub context_menu: bool,
347}
348
349impl Default for InteractiveFeatures {
350    fn default() -> Self {
351        Self {
352            pan_enabled: true,
353            zoom_enabled: true,
354            node_selection: true,
355            edge_selection: true,
356            hover_effects: true,
357            click_to_expand: true,
358            context_menu: true,
359        }
360    }
361}
362
363// ---------------------------------------------------------------------
364// Table types
365// ---------------------------------------------------------------------
366
367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
368pub struct TableHeader {
369    pub name: String,
370    pub data_type: TableDataType,
371    pub sortable: bool,
372    pub filterable: bool,
373    pub width: Option<u32>,
374    pub alignment: TextAlignment,
375}
376
377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
378pub struct TableRow {
379    pub cells: Vec<TableCell>,
380    pub metadata: HashMap<String, String>,
381    pub styling: Option<RowStyling>,
382}
383
384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
385pub struct TableCell {
386    pub value: String,
387    pub data_type: TableDataType,
388    pub formatting: Option<CellFormatting>,
389    pub link: Option<String>,
390}
391
392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
393pub enum TableDataType {
394    Text,
395    Number,
396    Date,
397    Boolean,
398    Image,
399    Link,
400    Currency,
401    Percentage,
402}
403
404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
405pub enum TextAlignment {
406    Left,
407    Center,
408    Right,
409    Justify,
410}
411
412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
413pub struct TablePagination {
414    pub page_size: usize,
415    pub current_page: usize,
416    pub total_pages: usize,
417    pub show_page_numbers: bool,
418}
419
420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
421pub struct TableSorting {
422    pub column_index: usize,
423    pub direction: SortDirection,
424    pub secondary_sorts: Vec<(usize, SortDirection)>,
425}
426
427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
428pub enum SortDirection {
429    Ascending,
430    Descending,
431}
432
433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
434pub struct TableFiltering {
435    pub filters: Vec<ColumnFilter>,
436    pub global_filter: Option<String>,
437    pub case_sensitive: bool,
438}
439
440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
441pub struct ColumnFilter {
442    pub column_index: usize,
443    pub filter_type: FilterType,
444    pub value: String,
445}
446
447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
448pub enum FilterType {
449    Contains,
450    Equals,
451    StartsWith,
452    EndsWith,
453    GreaterThan,
454    LessThan,
455    Range(String, String),
456}
457
458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
459pub struct TableStyling {
460    pub theme: TableTheme,
461    pub striped_rows: bool,
462    pub border_style: BorderStyle,
463    pub header_styling: HeaderStyling,
464    pub cell_padding: u32,
465}
466
467impl Default for TableStyling {
468    fn default() -> Self {
469        Self {
470            theme: TableTheme::Default,
471            striped_rows: true,
472            border_style: BorderStyle::Solid,
473            header_styling: HeaderStyling::default(),
474            cell_padding: 8,
475        }
476    }
477}
478
479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
480pub enum TableTheme {
481    Default,
482    Minimal,
483    Modern,
484    Classic,
485    Dark,
486    Custom(String),
487}
488
489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
490pub enum BorderStyle {
491    None,
492    Solid,
493    Dashed,
494    Dotted,
495}
496
497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
498pub struct HeaderStyling {
499    pub background_color: String,
500    pub text_color: String,
501    pub font_weight: FontWeight,
502    pub fixed_header: bool,
503}
504
505impl Default for HeaderStyling {
506    fn default() -> Self {
507        Self {
508            background_color: "#f8f9fa".to_string(),
509            text_color: "#212529".to_string(),
510            font_weight: FontWeight::Bold,
511            fixed_header: false,
512        }
513    }
514}
515
516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
517pub enum FontWeight {
518    Normal,
519    Bold,
520    Light,
521    ExtraBold,
522}
523
524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
525pub struct RowStyling {
526    pub background_color: Option<String>,
527    pub text_color: Option<String>,
528    pub highlighted: bool,
529}
530
531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
532pub struct CellFormatting {
533    pub color: Option<String>,
534    pub background_color: Option<String>,
535    pub font_weight: Option<FontWeight>,
536    pub italic: bool,
537    pub underline: bool,
538}
539
540// ---------------------------------------------------------------------
541// Chart types
542// ---------------------------------------------------------------------
543
544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
545pub enum ChartType {
546    Line,
547    Bar,
548    Pie,
549    Scatter,
550    Area,
551    Histogram,
552    BoxPlot,
553    Radar,
554    Heatmap,
555    Treemap,
556    Sunburst,
557    Sankey,
558    Gantt,
559    Candlestick,
560    Bubble,
561}
562
563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
564pub struct ChartData {
565    pub datasets: Vec<ChartDataset>,
566    pub categories: Vec<String>,
567    pub metadata: HashMap<String, String>,
568}
569
570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
571pub struct ChartDataset {
572    pub label: String,
573    pub data: Vec<f64>,
574    pub color: String,
575    pub secondary_data: Option<Vec<f64>>,
576}
577
578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
579pub struct ChartConfiguration {
580    pub title: Option<String>,
581    pub width: u32,
582    pub height: u32,
583    pub responsive: bool,
584    pub animations_enabled: bool,
585    pub legend_position: LegendPosition,
586}
587
588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
589pub enum LegendPosition {
590    Top,
591    Bottom,
592    Left,
593    Right,
594    Hidden,
595}
596
597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
598pub struct ChartStyling {
599    pub theme: ChartTheme,
600    pub color_palette: Vec<String>,
601    pub grid_lines: bool,
602    pub background_color: String,
603}
604
605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
606pub enum ChartTheme {
607    Default,
608    Dark,
609    Minimal,
610    Colorful,
611    Professional,
612    Custom(String),
613}
614
615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
616pub struct ChartInteractivity {
617    pub hover_enabled: bool,
618    pub click_enabled: bool,
619    pub zoom_enabled: bool,
620    pub pan_enabled: bool,
621    pub tooltip_enabled: bool,
622    pub crossfilter_enabled: bool,
623}
624
625// ---------------------------------------------------------------------
626// Timeline types
627// ---------------------------------------------------------------------
628
629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
630pub struct TimelineEvent {
631    pub id: String,
632    pub title: String,
633    pub description: Option<String>,
634    pub start_time: chrono::DateTime<chrono::Utc>,
635    pub end_time: Option<chrono::DateTime<chrono::Utc>>,
636    pub category: String,
637    pub importance: EventImportance,
638    pub styling: EventStyling,
639    pub attachments: Vec<String>,
640}
641
642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
643pub enum EventImportance {
644    Low,
645    Medium,
646    High,
647    Critical,
648}
649
650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
651pub struct EventStyling {
652    pub color: String,
653    pub icon: Option<String>,
654    pub size: EventSize,
655}
656
657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
658pub enum EventSize {
659    Small,
660    Medium,
661    Large,
662}
663
664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
665pub struct TimelineRange {
666    pub start: chrono::DateTime<chrono::Utc>,
667    pub end: chrono::DateTime<chrono::Utc>,
668    pub default_view: TimelineView,
669}
670
671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
672pub enum TimelineView {
673    Day,
674    Week,
675    Month,
676    Year,
677    Decade,
678    Custom(std::time::Duration),
679}
680
681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
682pub struct TimelineStyling {
683    pub orientation: TimelineOrientation,
684    pub background_color: String,
685    pub axis_color: String,
686    pub show_grid: bool,
687    pub compact_mode: bool,
688}
689
690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
691pub enum TimelineOrientation {
692    Horizontal,
693    Vertical,
694}
695
696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
697pub struct TimelineZoomLevel {
698    pub level: u8,
699    pub unit: TimeUnit,
700    pub granularity: std::time::Duration,
701}
702
703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
704pub enum TimeUnit {
705    Millisecond,
706    Second,
707    Minute,
708    Hour,
709    Day,
710    Week,
711    Month,
712    Year,
713}
714
715// ---------------------------------------------------------------------
716// Map types
717// ---------------------------------------------------------------------
718
719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
720pub enum MapType {
721    Road,
722    Satellite,
723    Hybrid,
724    Terrain,
725    OpenStreetMap,
726    Custom(String),
727}
728
729#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
730pub struct GeoCoordinate {
731    pub latitude: f64,
732    pub longitude: f64,
733    pub altitude: Option<f64>,
734}
735
736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
737pub struct MapMarker {
738    pub id: String,
739    pub position: GeoCoordinate,
740    pub label: String,
741    pub description: Option<String>,
742    pub icon: MarkerIcon,
743    pub popup_content: Option<String>,
744    pub clickable: bool,
745}
746
747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
748pub struct MarkerIcon {
749    pub icon_type: IconType,
750    pub color: String,
751    pub size: IconSize,
752}
753
754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
755pub enum IconType {
756    Pin,
757    Circle,
758    Square,
759    Custom(String),
760}
761
762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
763pub enum IconSize {
764    Small,
765    Medium,
766    Large,
767}
768
769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
770pub struct MapLayer {
771    pub id: String,
772    pub layer_type: LayerType,
773    pub data_source: String,
774    pub visible: bool,
775    pub opacity: f32,
776}
777
778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
779pub enum LayerType {
780    Markers,
781    Heatmap,
782    Polygons,
783    Polylines,
784    Circles,
785    GeoJSON,
786    Tiles,
787}
788
789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
790pub struct MapStyling {
791    pub theme: MapTheme,
792    pub show_controls: bool,
793    pub show_scale: bool,
794    pub show_attribution: bool,
795    pub custom_style: Option<String>,
796}
797
798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
799pub enum MapTheme {
800    Default,
801    Dark,
802    Light,
803    Satellite,
804    Custom(String),
805}
806
807// ---------------------------------------------------------------------
808// 3D Visualization types
809// ---------------------------------------------------------------------
810
811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
812pub struct ThreeDObject {
813    pub id: String,
814    pub object_type: ObjectType,
815    pub position: Vector3D,
816    pub rotation: Vector3D,
817    pub scale: Vector3D,
818    pub material_id: String,
819    pub animation_id: Option<String>,
820}
821
822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
823pub enum ObjectType {
824    Cube,
825    Sphere,
826    Cylinder,
827    Plane,
828    Mesh,
829    PointCloud,
830    Model(String),
831}
832
833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
834pub struct Vector3D {
835    pub x: f64,
836    pub y: f64,
837    pub z: f64,
838}
839
840#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
841pub struct CameraSettings {
842    pub position: Vector3D,
843    pub target: Vector3D,
844    pub field_of_view: f64,
845    pub near_plane: f64,
846    pub far_plane: f64,
847    pub camera_type: CameraType,
848}
849
850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
851pub enum CameraType {
852    Perspective,
853    Orthographic,
854}
855
856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
857pub struct LightingSettings {
858    pub ambient_light: LightSource,
859    pub directional_lights: Vec<LightSource>,
860    pub point_lights: Vec<LightSource>,
861    pub spot_lights: Vec<LightSource>,
862}
863
864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
865pub struct LightSource {
866    pub id: String,
867    pub light_type: LightType,
868    pub color: String,
869    pub intensity: f64,
870    pub position: Option<Vector3D>,
871    pub direction: Option<Vector3D>,
872}
873
874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
875pub enum LightType {
876    Ambient,
877    Directional,
878    Point,
879    Spot,
880}
881
882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
883pub struct Material {
884    pub id: String,
885    pub material_type: MaterialType,
886    pub color: String,
887    pub texture: Option<String>,
888    pub metallic: f64,
889    pub roughness: f64,
890    pub opacity: f64,
891}
892
893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
894pub enum MaterialType {
895    Basic,
896    Phong,
897    PhysicallyBased,
898    Wireframe,
899    Points,
900}
901
902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
903pub struct Animation {
904    pub id: String,
905    pub target_object_id: String,
906    pub animation_type: AnimationType,
907    pub duration: std::time::Duration,
908    pub loop_enabled: bool,
909    pub keyframes: Vec<Keyframe>,
910}
911
912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
913pub enum AnimationType {
914    Position,
915    Rotation,
916    Scale,
917    Color,
918    Opacity,
919    Morph,
920}
921
922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
923pub struct Keyframe {
924    pub time: f64,
925    pub value: Vector3D,
926    pub interpolation: InterpolationType,
927}
928
929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
930pub enum InterpolationType {
931    Linear,
932    Bezier,
933    Step,
934}
935
936// ---------------------------------------------------------------------
937// Dashboard types
938// ---------------------------------------------------------------------
939
940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
941pub struct DashboardWidget {
942    pub id: String,
943    pub widget_type: DashboardWidgetType,
944    pub title: String,
945    pub position: WidgetPosition,
946    pub size: WidgetSize,
947    pub data_source: String,
948    pub configuration: serde_json::Value,
949}
950
951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
952pub enum DashboardWidgetType {
953    Chart,
954    Table,
955    Map,
956    Text,
957    Metric,
958    Image,
959    IFrame,
960    Custom(String),
961}
962
963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
964pub struct WidgetPosition {
965    pub x: u32,
966    pub y: u32,
967    pub z_index: u32,
968}
969
970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
971pub struct WidgetSize {
972    pub width: u32,
973    pub height: u32,
974    pub min_width: u32,
975    pub min_height: u32,
976    pub resizable: bool,
977}
978
979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
980pub enum DashboardLayout {
981    Grid,
982    Flexible,
983    Masonry,
984    Custom,
985}
986
987// ---------------------------------------------------------------------
988// Multimedia types
989// ---------------------------------------------------------------------
990
991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
992pub struct ImageAnnotation {
993    pub id: String,
994    pub annotation_type: AnnotationType,
995    pub position: AnnotationPosition,
996    pub content: String,
997    pub styling: AnnotationStyling,
998}
999
1000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1001pub enum AnnotationType {
1002    Text,
1003    Arrow,
1004    Rectangle,
1005    Circle,
1006    Highlight,
1007    Blur,
1008}
1009
1010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1011pub struct AnnotationPosition {
1012    pub x: f64,
1013    pub y: f64,
1014    pub width: Option<f64>,
1015    pub height: Option<f64>,
1016}
1017
1018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1019pub struct AnnotationStyling {
1020    pub color: String,
1021    pub background_color: Option<String>,
1022    pub border_width: f64,
1023    pub font_size: f64,
1024}
1025
1026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1027pub enum ImageFilter {
1028    Blur(f64),
1029    Brightness(f64),
1030    Contrast(f64),
1031    Saturation(f64),
1032    Sepia(f64),
1033    Grayscale,
1034    Invert,
1035}
1036
1037#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1038pub struct SubtitleTrack {
1039    pub language: String,
1040    pub label: String,
1041    pub url: String,
1042    pub default: bool,
1043}
1044
1045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1046pub struct VideoChapter {
1047    pub title: String,
1048    pub start_time: std::time::Duration,
1049    pub end_time: std::time::Duration,
1050    pub thumbnail: Option<String>,
1051}
1052
1053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1054pub enum FilePreview {
1055    Text(String),
1056    Image(String),
1057    Audio(String),
1058    Video(String),
1059    Document(String),
1060    None,
1061}
1062
1063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1064pub struct FileMetadata {
1065    pub created_at: chrono::DateTime<chrono::Utc>,
1066    pub modified_at: chrono::DateTime<chrono::Utc>,
1067    pub author: Option<String>,
1068    pub description: Option<String>,
1069    pub tags: Vec<String>,
1070    pub custom_properties: HashMap<String, String>,
1071}
1072
1073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1074pub enum WidgetType {
1075    Button,
1076    Slider,
1077    Toggle,
1078    Input,
1079    Dropdown,
1080    DatePicker,
1081    ColorPicker,
1082    FileUpload,
1083    RangeSlider,
1084    Custom(String),
1085}
1086
1087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1088pub struct WidgetConfig {
1089    pub interactive: bool,
1090    pub disabled: bool,
1091    pub validation_rules: Vec<ValidationRule>,
1092    pub event_handlers: HashMap<String, String>,
1093}
1094
1095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1096pub struct ValidationRule {
1097    pub rule_type: ValidationType,
1098    pub value: String,
1099    pub error_message: String,
1100}
1101
1102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1103pub enum ValidationType {
1104    Required,
1105    MinLength,
1106    MaxLength,
1107    Pattern,
1108    Range,
1109    Email,
1110    Url,
1111    Custom(String),
1112}