import {
	createBrowserRouter,
	IndexRouteObject,
	Link,
	NonIndexRouteObject,
	useParams,
} from "react-router-dom";
import ErrorPage from "../app/error";
import LoginPage from "../app/login";
import HomePage from "../app/main/home/page";
import StaffMessage from "../app/main/staffinfo_show/staffmessage_page";
import MainLayout from "../app/main/layout/MainLayout";
import DailyPage from "../app/main/daily/page";
import Dashboard from "../app/main/home/page";
import WeekPlanPage from "../app/main/plan/weekplan/page";
import StaffInformation from "../app/main/staffinfo_write/staffinfo_write.page";
import DeptSettingPage from "../app/main/admin/deptsettingpage/page";
import { adminRoute } from "./admin-route";
import AdminLayout from "../components/layout/admin/AdminLayout";
import SystemLogPage from "../app/main/systemlog/SystemLogPage";
interface CustomIndexRouteObject extends IndexRouteObject {
	name?: string;
	breadcrumb?: string;
}
interface CustomIndexRouteObject extends IndexRouteObject {
	name?: string;
	breadcrumb?: string;
}

export interface CustomNonIndexRouteObject extends NonIndexRouteObject {
	name?: string;
	children?: CustomRouteObject[];
	breadcrumb?: string;
	handle?: {
		crumb: (data?: any) => void;
	};
}
export type CustomRouteObject =
	| CustomIndexRouteObject
	| CustomNonIndexRouteObject;
export const routes: CustomRouteObject[] = [
	// {
	// 	path: "/",
	// 	errorElement: <ErrorPage />,
	// 	handle: {
	// 		crumb() {
	// 			return <Link to={"/"}>主页</Link>;
	// 		},
	// 	},
	// 	children: [
	// 		{
	// 			element: <MainLayout></MainLayout>,
	// 			children: [
	// 				{
	// 					index: true,
	// 					element:<Dashboard></Dashboard>,
	// 				},
	// 				{
	// 					path: "/staffinformation",
	// 					element: <StaffInformation></StaffInformation>,
	// 				},
	// 				{
	// 					path: "/staff",
	// 					element: <StaffMessage></StaffMessage>,
	// 				},
	// 				{
	// 					path: "/systemlog",
	// 					element: <SystemLogPage></SystemLogPage>,
	// 				},
	// 				{
	// 					path: "/admin",
	// 					element: <AdminLayout></AdminLayout>,
	// 					children:adminRoute.children
	// 				},
					

	// 			],
	// 		},
			
	// 	],
	// },
	// {
	// 	path: "/login",
	// 	breadcrumb: "登录",
	// 	element: <LoginPage></LoginPage>,
	// },
	{
		index: true,
		path: "/",
		element:<DeptSettingPage></DeptSettingPage>,
		errorElement: <ErrorPage />,
	}
];

export const router = createBrowserRouter(routes);
