namespace NexusShell.Services;

using System.Windows.Media;

/// <summary>Lucide-inspired 24×24 stroke path data (viewBox 0 0 24 24).</summary>
public static class NexusLucideIcons
{
    public const string Folder = "M4,6 L10,6 L12,8 L20,8 L20,18 L4,18 Z";
    public const string FolderOpen = "M4,6 L10,6 L12,8 L20,8 L18,18 L6,18 L4,6 M6,10 L18,10";
    public const string File = "M6,4 L14,4 L18,8 L18,20 L6,20 Z M14,4 L14,8 L18,8";
    public const string FileText = "M6,4 L14,4 L18,8 L18,20 L6,20 Z M14,4 L14,8 L18,8 M8,13 L16,13 M8,17 L13,17";
    public const string Image = "M4,6 L20,6 L20,18 L4,18 Z M8,10 A1.5,1.5 0 1 0 8,13 A1.5,1.5 0 1 0 8,10 M4,16 L10,11 L14,14 L20,9";
    public const string Film = "M4,6 L20,6 L20,18 L4,18 Z M8,6 L8,18 M16,6 L16,18 M4,10 L8,10 M4,14 L8,14 M16,10 L20,10 M16,14 L20,14";
    public const string Music = "M12,4 L12,16 M12,16 A3,3 0 1 0 15,16 A3,3 0 1 0 12,16 M12,4 L18,6 L18,12";
    public const string Download = "M12,4 L12,14 M8,10 L12,14 L16,10 M6,18 L18,18";
    public const string Monitor = "M4,6 L20,6 L20,16 L4,16 Z M8,20 L16,20 M12,16 L12,20";
    public const string HardDrive = "M4,8 L20,8 L20,16 L4,16 Z M8,12 A1,1 0 1 0 8,12 M16,12 A1,1 0 1 0 16,12";
    public const string Pin = "M12,4 L12,10 M8,10 L16,10 L14,20 L10,20 Z";
    public const string PinOff = "M8,10 L16,10 L14,18 M6,6 L18,18 M12,4 L12,8";
    public const string Search = "M10,4 A6,6 0 1 0 10,16 A6,6 0 1 0 10,4 M16,16 L20,20";
    public const string ChevronLeft = "M14,6 L8,12 L14,18";
    public const string ChevronRight = "M10,6 L16,12 L10,18";
    public const string ArrowLeft = "M12,6 L6,12 L12,18 M6,12 L18,12";
    public const string ArrowRight = "M12,6 L18,12 L12,18 M18,12 L6,12";
    public const string ArrowUp = "M12,18 L12,6 M6,12 L12,6 L18,12";
    public const string Refresh = "M12,4 A8,8 0 1 1 4,12 M4,12 L4,8 M4,12 L8,12";
    public const string Computer = "M4,7 L20,7 L20,15 L4,15 Z M8,19 L16,19 M12,15 L12,19";
    public const string Briefcase = "M4,9 L20,9 L20,19 L4,19 Z M8,9 L8,7 C8,5.9 8.9,5 10,5 L14,5 C15.1,5 16,5.9 16,7 L16,9 M4,13 L20,13";
    public const string LayoutGrid = "M4,4 L10,4 L10,10 L4,10 Z M14,4 L20,4 L20,10 L14,10 Z M4,14 L10,14 L10,20 L4,20 Z M14,14 L20,14 L20,20 L14,20";
    public const string Clock = "M12,4 A8,8 0 1 0 12,20 A8,8 0 1 0 12,4 M12,8 L12,12 L15,14";
    public const string Archive = "M4,8 L20,8 L20,18 L4,18 Z M4,8 L4,6 L20,6 L20,8 M10,12 L14,12";
    public const string X = "M8,8 L16,16 M16,8 L8,16";
    public const string Home = "M4,11 L12,5 L20,11 L20,19 L4,19 Z M9,19 L9,13 L15,13 L15,19";
    public const string Star = "M12,3 L14.5,9 L21,9.5 L16,14 L17.5,21 L12,17.5 L6.5,21 L8,14 L3,9.5 L9.5,9 Z";
    public const string Package = "M12,3 L20,7 L20,17 L12,21 L4,17 L4,7 Z M12,3 L12,21 M4,7 L12,11 L20,7";
    public const string ShoppingBag = "M6,8 L18,8 L17,20 L7,20 Z M9,8 C9,6 10,4 12,4 C14,4 15,6 15,8";
    public const string CheckCircle = "M12,4 A8,8 0 1 0 12,20 A8,8 0 1 0 12,4 M9,12 L11,14 L15,10";
    public const string Hexagon = "M12,3 L19,7.5 L19,16.5 L12,21 L5,16.5 L5,7.5 Z";
    public const string Globe = "M12,4 A8,8 0 1 0 12,20 A8,8 0 1 0 12,4 M4,12 L20,12 M12,4 C9,8 9,16 12,20 M12,4 C15,8 15,16 12,20";
    public const string Terminal = "M6,8 L10,12 L6,16 M12,16 L18,16";
    public const string Settings = "M12,4 A2,2 0 0,1 14,6 L16,6.5 A1,1 0 0,1 16.7,8 L15.5,9.5 A6,6 0 0,1 15.5,14.5 L16.7,16 A1,1 0 0,1 16,17.5 L14,18 A2,2 0 0,1 12,20 A2,2 0 0,1 10,18 L8,17.5 A1,1 0 0,1 7.3,16 L8.5,14.5 A6,6 0 0,1 8.5,9.5 L7.3,8 A1,1 0 0,1 8,6.5 L10,6 A2,2 0 0,1 12,4";
    public const string Calculator = "M6,4 L18,4 L18,20 L6,20 Z M9,8 L15,8 M9,12 L11,12 M13,12 L15,12 M9,16 L11,16 M13,16 L15,16";
    public const string Code = "M8,8 L4,12 L8,16 M16,8 L20,12 L16,16 M14,6 L10,18";
    public const string Camera = "M4,8 L8,8 L10,6 L14,6 L16,8 L20,8 L20,18 L4,18 Z M12,14 A2.5,2.5 0 1 0 12,9 A2.5,2.5 0 1 0 12,14";
    public const string Mail = "M4,7 L20,7 L20,17 L4,17 Z M4,7 L12,13 L20,7";
    public const string MessageCircle = "M12,4 A8,8 0 0 0 4,12 A8,8 0 0 0 6,16 L4,20 L8,18 A8,8 0 0 0 12,20 A8,8 0 0 0 20,12 A8,8 0 0 0 12,4";
    public const string Heart = "M12,20 C12,20 4,14 4,9 A3,3 0 0,1 12,7 A3,3 0 0,1 20,9 C20,14 12,20 12,20";
    public const string HeartFilled = "M12,20 C12,20 4,14 4,9 A3,3 0 0,1 12,7 A3,3 0 0,1 20,9 C20,14 12,20 12,20 Z";
    public const string ZoomIn = "M10,4 A6,6 0 1 0 10,16 A6,6 0 1 0 10,4 M16,16 L20,20 M13,10 L7,10 M10,7 L10,13";
    public const string Info = "M12,4 A8,8 0 1 0 12,20 A8,8 0 1 0 12,4 M12,10 L12,16 M12,8 L12,8";
    public const string Play = "M8,6 L18,12 L8,18 Z";
    public const string Pause = "M8,6 L8,18 M16,6 L16,18";
    public const string Stop = "M7,7 L17,7 L17,17 L7,17 Z";
    public const string SkipBack = "M8,6 L8,18 M14,6 L20,12 L14,18 Z";
    public const string SkipForward = "M10,6 L16,12 L10,18 Z M16,6 L16,18";
    public const string Shuffle = "M16,4 L20,8 L16,12 M4,8 L10,8 M14,16 L20,16 M4,16 L8,12 L4,8";
    public const string Repeat = "M6,8 L6,6 L18,6 L18,16 L16,16 M18,6 L14,10 M6,16 L6,18 L18,18 L18,8 L20,8";
    public const string Volume2 = "M6,10 L10,10 L14,6 L14,18 L10,14 L6,14 Z M16,8 A4,4 0 0,1 16,16";
    public const string Maximize = "M6,6 L18,6 L18,18 L6,18 Z M9,9 L15,9 L15,15 L9,15 Z";
    public const string ListMusic = "M6,6 L6,18 M10,8 L18,8 M10,12 L18,12 M10,16 L16,16";
    public const string Disc = "M12,4 A8,8 0 1 0 12,20 A8,8 0 1 0 12,4 M12,10 A2,2 0 1 0 12,14 A2,2 0 1 0 12,10";
    public const string Images = "M4,6 L20,6 L20,18 L4,18 Z M8,10 A1.5,1.5 0 1 0 8,13 A1.5,1.5 0 1 0 8,10 M4,16 L10,11 L14,14 L20,9 M16,4 L18,6 L20,4";
    public const string FolderTree = "M4,6 L10,6 L12,8 L20,8 L20,18 L4,18 Z M4,12 L20,12";
    public const string Plus = "M12,6 L12,18 M6,12 L18,12";

    public static Geometry SearchGeometry { get; } = ParsePath(Search);
    public static Geometry LayoutGridGeometry { get; } = ParsePath(LayoutGrid);
    public static Geometry FolderGeometry { get; } = ParsePath(Folder);
    public static Geometry GlobeGeometry { get; } = ParsePath(Globe);
    public static Geometry TerminalGeometry { get; } = ParsePath(Terminal);
    public static Geometry SettingsGeometry { get; } = ParsePath(Settings);
    public static Geometry PlusGeometry { get; } = ParsePath(Plus);

    private static Geometry ParsePath(string data)
    {
        var geometry = Geometry.Parse(data);
        if (geometry.CanFreeze)
        {
            geometry.Freeze();
        }

        return geometry;
    }

    /// <summary>24×24 Lucide path data for bottom-dock navigation keys.</summary>
    public static string ForDockIconKey(string iconKey) => iconKey.ToLowerInvariant() switch
    {
        "search" => Search,
        "nexus" => Home,
        "apps" => LayoutGrid,
        "files" => Folder,
        "browser" => Globe,
        "terminal" => Terminal,
        "calculator" => Calculator,
        "settings" => Settings,
        "activity" => Monitor,
        "download" => Download,
        "store" => ShoppingBag,
        "add" => Plus,
        _ => LayoutGrid,
    };

    public static string ForStoreIconKey(string iconKey) => iconKey.ToLowerInvariant() switch
    {
        "folder" => Folder,
        "globe" => Globe,
        "terminal" => Terminal,
        "settings" => Settings,
        "calculator" => Calculator,
        "code" => Code,
        "image" => Image,
        "film" => Film,
        "music" => Music,
        "mail" => Mail,
        "message" => MessageCircle,
        "camera" => Camera,
        "download" => Download,
        "monitor" => Monitor,
        "store" => ShoppingBag,
        "package" => Package,
        _ => Package,
    };

    public static string ForExtension(string extension) => extension.ToLowerInvariant() switch
    {
        ".pdf" or ".doc" or ".docx" or ".txt" or ".md" => FileText,
        ".png" or ".jpg" or ".jpeg" or ".webp" or ".gif" or ".bmp" or ".svg" => Image,
        ".mp4" or ".mkv" or ".avi" or ".mov" or ".wmv" => Film,
        ".mp3" or ".wav" or ".flac" or ".ogg" or ".aac" => Music,
        ".zip" or ".rar" or ".7z" => Archive,
        _ => File,
    };

    public static string ForFavoriteId(string id) => id switch
    {
        NexusPaths.DesktopId => Monitor,
        NexusPaths.DocumentsId => Folder,
        NexusPaths.DownloadsId => Download,
        NexusPaths.PicturesId => Image,
        NexusPaths.VideosId => Film,
        NexusPaths.MusicId => Music,
        NexusPaths.ThisPc => Computer,
        NexusPaths.Projects => Briefcase,
        NexusPaths.Workspaces => LayoutGrid,
        NexusPaths.Recent => Clock,
        _ => Folder,
    };
}
