//! IPC module for communication with the Tauri app.
//!
//! This module provides a Unix socket-based IPC server that allows
//! the Tauri app to configure and control the daemon.

mod handlers;
mod protocol;
mod server;

pub use handlers::{CommandHandler, IpcHandlers};
pub use protocol::{IpcCommand, IpcMessage, IpcNotification, IpcResponse};
pub use server::{IpcServer, IpcServerConfig};

use std::path::PathBuf;

/// Default socket path for the IPC server.
#[cfg(target_os = "linux")]
pub fn default_socket_path() -> PathBuf {
    std::env::var("XDG_RUNTIME_DIR")
        .map(PathBuf::from)
        .unwrap_or_else(|_| PathBuf::from("/tmp"))
        .join("record-daemon.sock")
}

/// Default socket path for the IPC server.
#[cfg(target_os = "windows")]
pub fn default_socket_path() -> PathBuf {
    PathBuf::from(r"\\.\pipe\record-daemon")
}
