stt-cli 0.2.1

Speech to text Cli using Groq API and OpenAI API
mod error;

use crate::shutdown_handler::ShutdownManager;
use anyhow::Result;
pub use error::Error;

/// Platform-agnostic interface for cursor position tracking
pub trait CursorPositionProvider {
    /// Get current cursor position in screen coordinates
    fn get_cursor_position(&self) -> Result<(i32, i32)>;
    
    /// Get information about the active window
    fn get_active_window(&self) -> Result<WindowInfo>;
}

#[derive(Debug, Clone, Default)]
pub struct InsertOptions {
    /// Automatically capitalize the first letter of the text
    pub auto_capitalize: bool,
    /// Automatically add trailing punctuation if missing
    pub auto_punctuate: bool,
    /// Delay between each character insertion
    pub insertion_delay: Option<std::time::Duration>,
}

/// Platform-agnostic interface for text insertion
pub trait TextInserter {
    /// Insert text at current cursor position with default options
    fn insert_text(&self, text: &str) -> Result<()>;
    
    /// Insert text with specific options (delay, formatting, etc)
    fn insert_text_with_options(&self, text: &str, options: InsertOptions) -> Result<()>;
}

/// Combined platform handler with shutdown capabilities
pub trait PlatformHandler: CursorPositionProvider + TextInserter {
    /// Check if this platform handler is supported on the current OS
    fn is_supported() -> bool where Self: Sized;
    
    /// Register shutdown handlers with the ShutdownManager
    fn register_shutdown(&self, manager: &ShutdownManager) -> Result<()>;
}

/// Window information structure
#[derive(Debug, Clone)]
pub struct WindowInfo {
    pub id: u64,
    pub title: String,
    pub app_name: String,
}

// /// Options for text insertion
// #[derive(Debug, Default, Clone)]
// pub struct InsertOptions {
//     pub insertion_delay: Option<std::time::Duration>,
//     pub simulate_typing: bool,
//     pub format: TextFormat,
// }

/// Text formatting options
#[derive(Debug, Default, Clone)]
pub enum TextFormat {
    #[default]
    Plain,
    RichText(Vec<TextStyle>),
}

/// Individual text style component
#[derive(Debug, Clone)]
pub enum TextStyle {
    Bold,
    Italic,
    Underline,
    FontSize(u8),
}