"""Eingebaute Paket-Bundles — deklarative Paket-Sets nach Use-Case.

Built-ins können nicht editiert werden; User-Bundles in
~/.local/share/taninux/bundles/<id>.toml ergänzen sie (TODO)."""
from __future__ import annotations

from dataclasses import dataclass


@dataclass(frozen=True)
class Bundle:
    id: str
    label: str
    tagline: str
    packages: tuple[str, ...]
    tags: tuple[str, ...] = ()


BUILTIN_BUNDLES: list[Bundle] = [
    Bundle(
        id="cli-essentials",
        label="CLI Essentials",
        tagline="modern terminal tools",
        packages=(
            "bat", "eza", "fd", "ripgrep", "fzf", "zoxide",
            "dust", "bottom", "starship", "tldr",
        ),
        tags=("cli",),
    ),
    Bundle(
        id="rust-dev",
        label="Rust Development",
        tagline="rust toolchain + LSP + qol",
        packages=(
            "rust", "rust-analyzer", "sccache", "cargo-audit",
            "cargo-watch", "cargo-edit",
        ),
        tags=("dev", "rust"),
    ),
    Bundle(
        id="python-dev",
        label="Python Development",
        tagline="python + uv + ruff + ipython",
        packages=(
            "python", "uv", "ruff", "ipython",
            "python-pip", "python-lsp-server",
        ),
        tags=("dev", "python"),
    ),
    Bundle(
        id="web-dev",
        label="Web Development",
        tagline="node + typescript + pnpm",
        packages=(
            "nodejs", "npm", "pnpm", "typescript",
            "yarn",
        ),
        tags=("dev", "web"),
    ),
    Bundle(
        id="go-dev",
        label="Go Development",
        tagline="go toolchain + LSP",
        packages=(
            "go", "gopls", "delve",
        ),
        tags=("dev", "go"),
    ),
    Bundle(
        id="gaming",
        label="Gaming",
        tagline="steam + qol for proton/wine games",
        packages=(
            "steam", "gamemode", "mangohud", "lutris",
            "wine", "wine-mono", "wine-gecko",
            "winetricks", "vulkan-tools",
        ),
        tags=("gaming",),
    ),
    Bundle(
        id="multimedia",
        label="Multimedia",
        tagline="audio/video player, editor, recorder",
        packages=(
            "mpv", "ffmpeg", "obs-studio",
            "kdenlive", "audacity", "imagemagick",
        ),
        tags=("multimedia",),
    ),
    Bundle(
        id="niri",
        label="niri Desktop",
        tagline="niri scrolling compositor + eww bar/dock + launcher (wayland)",
        packages=(
            "niri", "eww", "swaylock", "swayidle", "wlsunset",
            "waypaper", "swaybg", "wl-clipboard", "grim", "slurp",
            "kitty",
        ),
        tags=("wm", "wayland"),
    ),
    Bundle(
        id="security",
        label="Security Tooling",
        tagline="audit + scan + monitoring",
        packages=(
            "nmap", "arch-audit",
            "rkhunter", "lynis", "wireshark-qt",
        ),
        tags=("security",),
    ),
    Bundle(
        id="containers",
        label="Containers",
        tagline="docker + buildah + podman + compose",
        packages=(
            "podman", "buildah", "skopeo",
            "podman-compose", "docker", "docker-compose",
        ),
        tags=("dev", "containers"),
    ),
    Bundle(
        id="virtualization",
        label="Virtualization",
        tagline="KVM/QEMU/libvirt stack",
        packages=(
            "qemu-full", "libvirt", "virt-manager",
            "edk2-ovmf", "dnsmasq", "bridge-utils",
        ),
        tags=("virt",),
    ),
    Bundle(
        id="creative",
        label="Creative Tools",
        tagline="design + 3d + illustration",
        packages=(
            "blender", "krita", "inkscape", "gimp",
            "darktable",
        ),
        tags=("creative",),
    ),
]


def by_id(bid: str) -> Bundle | None:
    for b in BUILTIN_BUNDLES:
        if b.id == bid:
            return b
    return None
