mod text;
mod select;
mod checkbox;
pub use text::TextInput;
pub use select::Select;
pub use checkbox::Checkbox;
use crossterm::event::KeyEvent;
use ratatui::buffer::Buffer;
use ratatui::layout::Rect;
use serde_json::Value;
use crate::validation::ValidationError;
use crate::style::FormStyle;
pub trait Field: Send + Sync {
fn id(&self) -> &str;
fn label(&self) -> &str;
fn render(&self, area: Rect, buf: &mut Buffer, focused: bool, style: &FormStyle);
fn handle_input(&mut self, event: &KeyEvent) -> bool;
fn value(&self) -> Value;
fn validate(&self) -> Result<(), Vec<ValidationError>>;
fn height(&self) -> u16 {
1
}
fn is_required(&self) -> bool {
false
}
}