use crate::worker::DaemonClient;
use anyhow::Result;

#[cfg(target_os = "linux")]
mod linux;

#[cfg(target_os = "macos")]
mod macos;

pub(crate) fn new_daemon_client() -> Result<Box<dyn DaemonClient>> {
    #[cfg(target_os = "linux")]
    {
        Ok(Box::new(linux::DBusClient::new()?))
    }
    #[cfg(target_os = "macos")]
    {
        Ok(Box::new(macos::XpcClient::new()?))
    }
    #[cfg(not(any(target_os = "linux", target_os = "macos")))]
    {
        anyhow::bail!("Unsupported platform")
    }
}

