//! Events fed into the application's update function. //! //! `AppEvent` is the single input type the runtime delivers to //! `App::update`. Synthetic instances drive Tier 3 integration //! tests (see ADR-0008), so the type is plain data with no //! runtime dependency. use crossterm::event::KeyEvent; use crate::db::{DataResult, DeleteResult, InsertResult, TableDescription, UpdateResult}; use crate::dsl::Command; #[derive(Debug, Clone)] pub enum AppEvent { Key(KeyEvent), Resize { cols: u16, rows: u16, }, Tick, /// A DSL command finished successfully. `description` is /// `Some` for commands that produce a table view (create, /// add column) and `None` for commands that don't (drop). DslSucceeded { command: Command, description: Option, }, /// A `show data` query succeeded. DslDataSucceeded { command: Command, data: DataResult }, DslInsertSucceeded { command: Command, result: InsertResult, }, DslUpdateSucceeded { command: Command, result: UpdateResult, }, DslDeleteSucceeded { command: Command, result: DeleteResult, }, /// A DSL command failed. `error` is already a friendly /// message produced via `DbError::friendly_message`. DslFailed { command: Command, error: String, }, /// Refreshed list of tables in the database. TablesRefreshed(Vec), /// A persistence failure occurred (ADR-0015 ยง8). The /// application surfaces a fatal banner and exits cleanly so /// the message remains above the shell prompt. PersistenceFatal { operation: String, path: std::path::PathBuf, message: String, }, }