//! Abstract Syntax Tree for markup

use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MarkupAst {
    pub nodes: Vec<MarkupNode>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MarkupNode {
    Agent(AgentConfig),
    Input(InputDecl),
    Import(ImportDecl),
    Shell(ShellDecl),
    If(IfBlock),
    Validate(ValidationRules),
    Variable(String),
    Text(String),
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AgentConfig {
    pub role: String,
    pub llm: String,
    pub tools: Vec<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct InputDecl {
    pub name: String,
    pub type_spec: String,
    pub optional: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ImportDecl {
    pub path: String,
    pub alias: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ShellDecl {
    pub command: String,
    pub alias: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct IfBlock {
    pub condition: String,
    pub body: Vec<MarkupNode>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ValidationRules {
    pub must_contain: Vec<String>,
    pub format: String,
}
