use crate::app::Message;
use crate::io::protocol::Protocol;
use anyhow::Result;
use std::sync::mpsc;

#[allow(dead_code)]
pub struct StdioProtocol {
    #[allow(dead_code)]
    message_tx: mpsc::Sender<Message>,
}

impl StdioProtocol {
    #[allow(dead_code)]
    pub fn new(message_tx: mpsc::Sender<Message>) -> Result<Self> {
        Ok(Self { message_tx })
    }
}

impl Protocol for StdioProtocol {
    fn run(&mut self) -> Result<()> {
        // DO NOT read from stdin here!
        // The TUI needs stdin for keyboard input via crossterm.
        // This protocol is a no-op for now.
        // In the future, we can use a named pipe or socket for IPC.

        // Just sleep forever to keep the thread alive
        loop {
            std::thread::sleep(std::time::Duration::from_secs(3600));
        }
    }
}
