import type {navLink} from "@interfaces/site-layout.ts"

export const siteLayout: navLink[] = [
    {navText: "About", path: ""},
    {
        navText: "Experiences",
        path: "experience",
        children: [
            {
                navText: "SpaceX",
                path: "spacex",
                children: [
                    {
                        navText: "Hardware Test Engineer I/II",
                        path: "hardware-test-engineer-i-ii"
                    },
                    {
                        navText: "Avionics Test Engineering Internship",
                        path: "avionics-test-engineering-internship"
                    }
                ]
            },
            {
                navText: "OSU CEOAS",
                path: "osu-ceoas-ocean-mixing-group",
                children: [
                    {
                        navText: "Robotics Oceanographic Surface Sampler",
                        path: "robotic-oceanographic-surface-sampler",
                    },
                    {
                        navText: "LeConte Glacier Deployments",
                        path: "leconte-glacier-deployments",
                    }
                ]
            },
            {
                navText: "OSU SARL",
                path: "osu-sinnhuber-aquatic-research-laboratory",
                children: [
                    {
                        navText: "Team Lead",
                        path: "team-lead",
                    },
                    {
                        navText: "Zebrafish Embryo Pick and Plate",
                        path: "zebrafish-embryo-pick-and-plate",
                    },
                    {
                        navText: "Shuttlebox Behavior System",
                        path: "shuttlebox-behavior-system",
                    },
                    {
                        navText: "Dechorionator",
                        path: "dechorionator",
                    },
                    {
                        navText: "Denso Embryo Pick and Plate",
                        path: "denso-embryo-pick-and-plate",
                    },
                    {
                        navText: "ZScan Processor",
                        path: "zscan-processor",
                    }
                ]
            },
            {
                navText: "OSU Robotics Club",
                path: "osu-robotics-club",
                children: [
                    {
                        navText: "Club Officer",
                        path: "club-officer",
                    },
                    {
                        navText: "Mars Rover Software Team Lead",
                        path: "mars-rover-software-team-lead",
                    },
                    {
                        navText: "Mars Rover Emergency Software Team Lead",
                        path: "mars-rover-emergency-software-team-lead",
                    },
                    {
                        navText: "Mars Rover Electrical Team Lead",
                        path: "mars-rover-electrical-team-lead",
                    }
                ]
            },
        ]
    },
    {
        navText: "Hobbies",
        path: "hobby",
        children: [

            {
                navText: "Homelab", path: "homelab",
                children: [
                    {navText: "Home Server Rack", path: "home-server-rack"},
                    {navText: "Offsite Backup Rack", path: "offsite-backup-rack"},
                    // {title: "Kubernetes Cluster", path: "kubernetes-cluster"},
                    {navText: "Home Automation", path: "home-automation"},
                ]
            },
            {
                navText: "Motorcycling",
                path: "motorcycling",
                children: [
                    {navText: "Lineup", path: "lineup"},
                    // {
                    //   title: "Custom Accessories",
                    //   path: "custom-accessories",
                    //   children: [
                    //       {title: "Chubby Buttons 2 Mount", path: "chubby-buttons-2-mount"},
                    //   ]
                    // },
                    // {
                    //     title: "Trips",
                    //     path: "trips",
                    //     children: [
                    //         {title: "2025-08 | Alaska ", path: "2025-08-alaska"},
                    //         {title: "2024-10 | Norway ", path: "2024-10-norway"}
                    //     ]
                    // },
                ]
            },
            // {
            //     title: "Projects", path: "projects",
            //     children: [
            //         {title: "Shed Solar", path: "shed-solar"},
            //         {title: "OSSM Overkill Edition", path: "ossm-overkill-edition"},
            //     ]
            // },
            // {title: "NixOS", path: "nixos"},
            // {title: "Body Mods", path: "body-mods"},
        ]
    },
    {
        navText: "Resumes",
        path: "resume",
        children: [
            // {title: "2025-11-10 | Complete CV", path: "2025-11-10-complete-cv"},
            {navText: "2025-11-10 | Infrastructure Engineer", path: "2025-11-10-infrastructure-engineer"},
            {navText: "2019-07-01 | Hardware Test Engineer", path: "2019-07-01-hardware-test-engineer"},
        ]
    },
    {navText: "Github", pubpath: "https://github.com/caperren"},
    {navText: "LinkedIn", pubpath: "https://www.linkedin.com/in/caperren/"}
]

export const pathToMetadata = (path: string): navLink => {
    const paths = path.split("/").filter((entry) => entry);
    let currentEntries: navLink[] = siteLayout;
    let foundEntry: navLink | undefined;

    for (const path of paths) {
        for (const currentEntry of currentEntries) {
            if (currentEntry.path === path) {
                foundEntry = currentEntry;

                if (foundEntry.children && foundEntry.children.length > 0) {
                    currentEntries = foundEntry.children;
                }
            }
        }
    }

    if (foundEntry === undefined) {
        throw new Error(`${path} not found in site layout!`);
    }

    return foundEntry;
}