use anyhow::Result;
use jsonschema::Validator;
use serde_json::Value;
use crate::core::ui_ast::{UiAst, UiLayout};
#[cfg(feature = "tui")]
use crate::tui::app::UiOptions;
#[cfg(feature = "web")]
use crate::web::session::ServeOptions;
#[derive(Debug)]
pub struct FrontendContext {
pub title: Option<String>,
pub description: Option<String>,
pub ui_ast: UiAst,
pub layout: UiLayout,
pub initial_data: Value,
pub schema: Value,
pub validator: Validator,
}
#[derive(Debug, Clone)]
pub enum FrontendOptions {
#[cfg(feature = "tui")]
Tui(UiOptions),
#[cfg(feature = "web")]
Web(ServeOptions),
}
pub trait Frontend {
fn run(self, ctx: FrontendContext) -> Result<Value>;
}