use crate::client::KeepClient;
use clap::Command;
use log::debug;

pub fn mode(
    client: &KeepClient,
    _cmd: &mut Command,
    _settings: &crate::config::Settings,
    ids: &[i64],
) -> Result<(), anyhow::Error> {
    debug!("CLIENT_DIFF: Getting diff via remote server");

    if ids.len() != 2 {
        return Err(anyhow::anyhow!("Diff requires exactly 2 item IDs"));
    }

    let diff_lines = client.diff_items(ids[0], ids[1])?;

    for line in &diff_lines {
        println!("{line}");
    }

    Ok(())
}
