Skip to main content

systemprompt_models/artifacts/dashboard/
hints.rs

1//! Layout hints for dashboard artifacts.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use schemars::JsonSchema;
7use serde::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, JsonSchema)]
10pub struct DashboardHints {
11    pub layout: LayoutMode,
12    pub refreshable: bool,
13    pub refresh_interval_seconds: Option<u32>,
14    pub drill_down_enabled: bool,
15}
16
17#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, JsonSchema)]
18#[serde(rename_all = "lowercase")]
19pub enum LayoutMode {
20    #[default]
21    Vertical,
22    Grid,
23    Tabs,
24}
25
26impl DashboardHints {
27    pub fn new() -> Self {
28        Self::default()
29    }
30
31    pub const fn with_refreshable(mut self, refreshable: bool) -> Self {
32        self.refreshable = refreshable;
33        self
34    }
35
36    pub const fn with_refresh_interval(mut self, seconds: u32) -> Self {
37        self.refresh_interval_seconds = Some(seconds);
38        self
39    }
40
41    pub const fn with_drill_down(mut self, enabled: bool) -> Self {
42        self.drill_down_enabled = enabled;
43        self
44    }
45
46    pub const fn with_layout(mut self, layout: LayoutMode) -> Self {
47        self.layout = layout;
48        self
49    }
50}