use indexmap::IndexMap;
#[derive(Debug, Clone)]
pub struct WdocDocument {
pub name: String,
pub title: String,
pub version: Option<String>,
pub author: Option<String>,
pub sections: Vec<Section>,
pub pages: Vec<Page>,
pub styles: Vec<WdocStyle>,
pub extra_css: String,
}
#[derive(Debug, Clone)]
pub struct Section {
pub id: String,
pub short_id: String,
pub title: String,
pub children: Vec<Section>,
}
#[derive(Debug, Clone)]
pub struct Page {
pub id: String,
pub section_id: String,
pub title: String,
pub layout: Layout,
pub signals: Vec<WdocSignal>,
pub bindings: Vec<WdocBinding>,
}
#[derive(Debug, Clone)]
pub struct Layout {
pub children: Vec<LayoutItem>,
}
#[derive(Debug, Clone)]
pub enum LayoutItem {
SplitGroup(SplitGroup),
Content(ContentBlock),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SplitDirection {
Vertical,
Horizontal,
}
#[derive(Debug, Clone)]
pub struct SplitGroup {
pub direction: SplitDirection,
pub splits: Vec<Split>,
}
#[derive(Debug, Clone)]
pub struct Split {
pub size_percent: f64,
pub children: Vec<LayoutItem>,
}
#[derive(Debug, Clone)]
pub struct ContentBlock {
pub kind: String,
pub id: Option<String>,
pub rendered_html: String,
pub style: Option<String>,
}
#[derive(Debug, Clone)]
pub struct WdocSignal {
pub name: String,
pub initial: serde_json::Value,
pub type_name: Option<String>,
}
#[derive(Debug, Clone)]
pub struct WdocBinding {
pub name: Option<String>,
pub signal: String,
pub target: String,
pub property: String,
pub path: Option<String>,
pub format: Option<String>,
}
#[derive(Debug, Clone)]
pub struct WdocStyle {
pub name: String,
pub rules: Vec<StyleRule>,
}
#[derive(Debug, Clone)]
pub struct StyleRule {
pub target: String,
pub properties: IndexMap<String, String>,
}