use crossterm::event::KeyEvent;
use oxi_tui::Theme;
use ratatui::{layout::Rect, Frame};
pub mod factories;
pub mod questionnaire;
pub use factories::{logout_select, model_select, resume_select};
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub enum OverlayAction {
None,
Close,
SwitchSession(String),
NewSession,
ExecuteSlashCommand(String),
SendPrompt(String),
}
pub trait OverlayComponent: std::fmt::Debug {
fn handle_key(&mut self, key: KeyEvent) -> OverlayAction;
fn render(&mut self, frame: &mut Frame, area: Rect, theme: &Theme);
fn hint(&self) -> &str;
}
pub fn centered_popup(area: Rect, width_pct: f32, height_pct: f32) -> Rect {
let w = (area.width as f32 * width_pct) as u16;
let h = (area.height as f32 * height_pct) as u16;
Rect {
x: area.x + area.width.saturating_sub(w) / 2,
y: area.y + area.height.saturating_sub(h) / 2,
width: w.min(area.width),
height: h.min(area.height),
}
}