//! Package dependencies for assist actions.
//!
//! These are the new-style `Dependency` definitions using the unified
//! package management system.

use crate::common::package::{Dependency, PackageDefinition, PackageManager};
use crate::common::requirements::InstallTest;

// =============================================================================
// Package Definitions using new Dependency format
// =============================================================================

/// Playerctl - MPRIS media player controller
pub static PLAYERCTL: Dependency = Dependency {
    name: "playerctl",
    packages: &[
        PackageDefinition::new("playerctl", PackageManager::Pacman),
        PackageDefinition::new("playerctl", PackageManager::Apt),
        PackageDefinition::new("playerctl", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("playerctl")],
};

/// QR code encoder
pub static QRENCODE: Dependency = Dependency {
    name: "qrencode",
    packages: &[
        PackageDefinition::new("qrencode", PackageManager::Pacman),
        PackageDefinition::new("qrencode", PackageManager::Apt),
        PackageDefinition::new("qrencode", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("qrencode")],
};

/// ZBar - barcode/QR code reader
pub static ZBAR: Dependency = Dependency {
    name: "zbar",
    packages: &[
        PackageDefinition::new("zbar", PackageManager::Pacman),
        PackageDefinition::new("zbar-tools", PackageManager::Apt),
        PackageDefinition::new("zbar", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("zbarimg")],
};

/// Flameshot - screenshot tool
pub static FLAMESHOT: Dependency = Dependency {
    name: "flameshot",
    packages: &[
        PackageDefinition::new("flameshot", PackageManager::Pacman),
        PackageDefinition::new("flameshot", PackageManager::Apt),
        PackageDefinition::new("flameshot", PackageManager::Dnf),
        PackageDefinition::new("org.flameshot.Flameshot", PackageManager::Flatpak),
    ],
    tests: &[InstallTest::WhichSucceeds("flameshot")],
};

/// pass - unix password store
pub static PASS: Dependency = Dependency {
    name: "pass",
    packages: &[
        PackageDefinition::new("pass", PackageManager::Pacman),
        PackageDefinition::new("pass", PackageManager::Apt),
        PackageDefinition::new("pass", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("pass")],
};

/// gpg - backend for pass
pub static GPG: Dependency = Dependency {
    name: "gpg",
    packages: &[
        PackageDefinition::new("gnupg", PackageManager::Pacman),
        PackageDefinition::new("gnupg", PackageManager::Apt),
        PackageDefinition::new("gnupg2", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("gpg")],
};

/// mpv - minimal video player
pub static MPV: Dependency = Dependency {
    name: "mpv",
    packages: &[
        PackageDefinition::new("mpv", PackageManager::Pacman),
        PackageDefinition::new("mpv", PackageManager::Apt),
        PackageDefinition::new("mpv", PackageManager::Dnf),
        PackageDefinition::new("io.mpv.Mpv", PackageManager::Flatpak),
    ],
    tests: &[InstallTest::WhichSucceeds("mpv")],
};

/// Tesseract OCR
pub static TESSERACT: Dependency = Dependency {
    name: "tesseract",
    packages: &[
        PackageDefinition::new("tesseract", PackageManager::Pacman),
        PackageDefinition::new("tesseract-ocr", PackageManager::Apt),
        PackageDefinition::new("tesseract", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("tesseract")],
};

/// Brightness control
pub static BRIGHTNESSCTL: Dependency = Dependency {
    name: "brightnessctl",
    packages: &[
        PackageDefinition::new("brightnessctl", PackageManager::Pacman),
        PackageDefinition::new("brightnessctl", PackageManager::Apt),
        PackageDefinition::new("brightnessctl", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("brightnessctl")],
};

/// ASCII aquarium animation
pub static ASCIIQUARIUM: Dependency = Dependency {
    name: "asciiquarium",
    packages: &[
        PackageDefinition::new("asciiquarium", PackageManager::Pacman),
        PackageDefinition::new("asciiquarium", PackageManager::Apt),
    ],
    tests: &[InstallTest::WhichSucceeds("asciiquarium")],
};

/// Matrix animation
pub static CMATRIX: Dependency = Dependency {
    name: "cmatrix",
    packages: &[
        PackageDefinition::new("cmatrix", PackageManager::Pacman),
        PackageDefinition::new("cmatrix", PackageManager::Apt),
        PackageDefinition::new("cmatrix", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("cmatrix")],
};

/// Slurp - Wayland region selector
pub static SLURP: Dependency = Dependency {
    name: "slurp",
    packages: &[
        PackageDefinition::new("slurp", PackageManager::Pacman),
        PackageDefinition::new("slurp", PackageManager::Apt),
        PackageDefinition::new("slurp", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("slurp")],
};

/// Slop - X11 region selector
pub static SLOP: Dependency = Dependency {
    name: "slop",
    packages: &[
        PackageDefinition::new("slop", PackageManager::Pacman),
        PackageDefinition::new("slop", PackageManager::Apt),
    ],
    tests: &[InstallTest::WhichSucceeds("slop")],
};

/// Grim - Wayland screenshot tool
pub static GRIM: Dependency = Dependency {
    name: "grim",
    packages: &[
        PackageDefinition::new("grim", PackageManager::Pacman),
        PackageDefinition::new("grim", PackageManager::Apt),
        PackageDefinition::new("grim", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("grim")],
};

/// wl-mirror - Wayland screen mirroring
pub static WL_MIRROR: Dependency = Dependency {
    name: "wl-mirror",
    packages: &[
        PackageDefinition::new("wl-mirror", PackageManager::Pacman),
        PackageDefinition::new("wl-mirror", PackageManager::Apt),
        PackageDefinition::new("wl-mirror", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("wl-mirror")],
};

/// xrandr - X11 extension for screen configuration
pub static XRANDR: Dependency = Dependency {
    name: "xrandr",
    packages: &[
        PackageDefinition::new("xorg-xrandr", PackageManager::Pacman),
        PackageDefinition::new("x11-xserver-utils", PackageManager::Apt),
        PackageDefinition::new("xrandr", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("xrandr")],
};

/// autorandr - Automatic X11 display configuration
pub static AUTORANDR: Dependency = Dependency {
    name: "autorandr",
    packages: &[
        PackageDefinition::new("autorandr", PackageManager::Pacman),
        PackageDefinition::new("autorandr", PackageManager::Apt),
        PackageDefinition::new("autorandr", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("autorandr")],
};

/// ImageMagick - image manipulation
pub static IMAGEMAGICK: Dependency = Dependency {
    name: "imagemagick",
    packages: &[
        PackageDefinition::new("imagemagick", PackageManager::Pacman),
        PackageDefinition::new("imagemagick", PackageManager::Apt),
        PackageDefinition::new("ImageMagick", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("import")],
};

/// Wayland clipboard utilities
pub static WL_CLIPBOARD: Dependency = Dependency {
    name: "wl-clipboard",
    packages: &[
        PackageDefinition::new("wl-clipboard", PackageManager::Pacman),
        PackageDefinition::new("wl-clipboard", PackageManager::Apt),
        PackageDefinition::new("wl-clipboard", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("wl-copy")],
};

/// X11 clipboard utility
pub static XCLIP: Dependency = Dependency {
    name: "xclip",
    packages: &[
        PackageDefinition::new("xclip", PackageManager::Pacman),
        PackageDefinition::new("xclip", PackageManager::Apt),
        PackageDefinition::new("xclip", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("xclip")],
};

/// libnotify - notification library
pub static LIBNOTIFY: Dependency = Dependency {
    name: "libnotify",
    packages: &[
        PackageDefinition::new("libnotify", PackageManager::Pacman),
        PackageDefinition::new("libnotify-bin", PackageManager::Apt),
        PackageDefinition::new("libnotify", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("notify-send")],
};

/// Hyprpicker - Hyprland color picker
pub static HYPRPICKER: Dependency = Dependency {
    name: "hyprpicker",
    packages: &[
        PackageDefinition::new("hyprpicker", PackageManager::Pacman),
        PackageDefinition::new("hyprpicker", PackageManager::Aur),
    ],
    tests: &[InstallTest::WhichSucceeds("hyprpicker")],
};

/// xcolor - X11 color picker (with Cargo fallback)
pub static XCOLOR: Dependency = Dependency {
    name: "xcolor",
    packages: &[
        PackageDefinition::new("xcolor", PackageManager::Pacman),
        PackageDefinition::new("xcolor", PackageManager::Cargo),
    ],
    tests: &[InstallTest::WhichSucceeds("xcolor")],
};

/// kdialog - KDE dialog utility (includes color picker)
pub static KDIALOG: Dependency = Dependency {
    name: "kdialog",
    packages: &[
        PackageDefinition::new("kdialog", PackageManager::Pacman),
        PackageDefinition::new("kdialog", PackageManager::Dnf),
        PackageDefinition::new("kdialog", PackageManager::Apt),
    ],
    tests: &[InstallTest::WhichSucceeds("kdialog")],
};

/// Emote - emoji picker (Flatpak only)
pub static EMOTE: Dependency = Dependency {
    name: "Emote",
    packages: &[PackageDefinition::new(
        "com.tomjwatson.Emote",
        PackageManager::Flatpak,
    )],
    tests: &[InstallTest::CommandSucceeds {
        program: "flatpak",
        args: &["info", "com.tomjwatson.Emote"],
    }],
};

/// wf-recorder - Wayland screen recorder
pub static WF_RECORDER: Dependency = Dependency {
    name: "wf-recorder",
    packages: &[
        PackageDefinition::new("wf-recorder", PackageManager::Pacman),
        PackageDefinition::new("wf-recorder", PackageManager::Apt),
        PackageDefinition::new("wf-recorder", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("wf-recorder")],
};

/// FFmpeg - Multimedia framework
pub static FFMPEG: Dependency = Dependency {
    name: "ffmpeg",
    packages: &[
        PackageDefinition::new("ffmpeg", PackageManager::Pacman),
        PackageDefinition::new("ffmpeg", PackageManager::Apt),
        PackageDefinition::new("ffmpeg", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("ffmpeg")],
};

/// feh - lightweight image viewer
pub static FEH: Dependency = Dependency {
    name: "feh",
    packages: &[
        PackageDefinition::new("feh", PackageManager::Pacman),
        PackageDefinition::new("feh", PackageManager::Apt),
        PackageDefinition::new("feh", PackageManager::Dnf),
    ],
    tests: &[InstallTest::WhichSucceeds("feh")],
};
