/**
 * @Author: Kane Wang <wangkane@qq.com>
 * @Date: 2025-10-13 15:31:41
 * @LastEditors: Kane Wang
 * @LastModified: 2025-10-23 17:47:28
 * @FilePath: src/router/index.ts
 * @Description:
 *
 *               Copyright (c) 2025 by Kane All rights reserved
 */
import { createRouter, createWebHashHistory } from "vue-router";
import { type RouteRecordNormalized } from "vue-router";
// import index from "../layout/console/index.vue";

export declare interface SideBarRouteRecordNormalized extends RouteRecordNormalized
{
    hidden?: boolean;
}

const routes = [
    {
        path: "/console",
        name: "Console",
        hidden: true,
        // component: index,
        component: () => import( "../layout/console/Index.vue" ),
    },
];

const router = createRouter({
    history: createWebHashHistory(),
    routes: routes,
});

// 工具函数
/* eslint-disable */
function hasOnlyChild( children: any ): boolean
{
    if ( !children )
    {
        return false;
    }

    const routes = children.filter(( item: any )=>
    {
        return !item.hidden;
    });

    if ( routes.length === 1 )
    {
        return true;
    }

    return false;
}

export { router, hasOnlyChild };