use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::BTreeMap;
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PrimitiveInfo {
pub name: String,
pub description: String,
#[serde(default)]
pub tags: Vec<String>,
#[serde(default)]
pub props: BTreeMap<String, PrimitiveProp>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PrimitiveProp {
#[serde(rename = "type")]
pub prop_type: String,
#[serde(default)]
pub required: bool,
#[serde(default)]
pub description: String,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PrimitivesManifest {
pub version: String,
pub primitives: Vec<PrimitiveInfo>,
}
#[derive(Debug, Clone)]
pub struct PresetInfo {
pub name: String,
pub category: String,
pub title: String,
pub description: String,
pub tags: Vec<String>,
pub use_cases: Vec<String>,
pub example: Value,
pub schema: Value,
pub template_source: String,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Category {
pub name: String,
pub display_name: String,
pub description: String,
pub presets: Vec<String>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Catalog {
pub categories: Vec<Category>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Theme {
pub name: String,
pub display_name: String,
#[serde(default)]
pub description: String,
pub tokens: BTreeMap<String, Value>,
#[serde(default)]
pub host_config: Value,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PackMetadata {
pub name: String,
pub version: String,
#[serde(default)]
pub description: String,
#[serde(default)]
pub author: String,
}
#[derive(Debug, Clone, Deserialize)]
#[serde(untagged)]
pub enum RenderRequest {
Preset {
#[serde(alias = "template")]
preset: String,
#[serde(default)]
theme: Option<String>,
#[serde(default)]
data: Value,
},
Compose {
preset: String, #[serde(default)]
theme: Option<String>,
sections: Vec<ComposeSection>,
},
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ComposeSection {
pub primitive: String,
#[serde(flatten)]
pub data: Value,
}
#[derive(Debug, Clone, Serialize)]
pub struct RenderResponse {
pub card: Value,
pub host_config: Value,
pub preset: String,
pub theme: String,
}