using MudBlazor;

namespace DeepDrftPublic.Client.Layout;

public class PageRoute
{
    public string Name { get; set; } = string.Empty;
    public string Route { get; set; } = string.Empty;
    public string? Icon { get; set; } = null;

    // Optional one-level fan-out. A node with children is a dual-role node: its own Route is a
    // real destination (desktop click / mobile tap navigate to it), and Children render as a
    // hover dropdown on desktop and an indented sub-list on mobile. Depth is capped at one level
    // by convention — children are not themselves expected to carry children.
    public IReadOnlyList<PageRoute> Children { get; set; } = [];

    public bool HasChildren => Children.Count > 0;
}

public static class Pages
{
    // ARCHIVE (→ the release-cardinal /archive browser) carries the three medium modes as Children.
    // Above the medium breakpoint the desktop nav flattens them into inline appbar links beside
    // ARCHIVE (no popover); below the breakpoint the mobile hamburger renders them as an indented
    // sub-list under ARCHIVE. /genres is intentionally absent from the nav (8.I) — its route
    // (GenresView) remains reachable by direct URL.
    public static readonly List<PageRoute> MenuPages =
    [
        new()
        {
            Name = "Archive", Route = "/archive", Icon = Icons.Material.Filled.Inventory2,
            Children =
            [
                new() { Name = "Cuts",     Route = "/cuts",     Icon = Icons.Material.Filled.Album },
                new() { Name = "Sessions", Route = "/sessions", Icon = Icons.Material.Filled.Piano },
                new() { Name = "Mixes",    Route = "/mixes",    Icon = Icons.Material.Filled.GraphicEq },
            ],
        },
        new() { Name = "About", Route = "/about", Icon = Icons.Material.Filled.Groups },
    ];

    public static readonly List<PageRoute> AllPages =
        new List<PageRoute>
        {
            new() { Name = "Home", Route = "/", Icon = Icons.Material.Filled.Home }
        }.Concat(MenuPages).ToList();
}