/** @format */

import { Navigate, RouteObject } from "react-router-dom";

import NoFound from "@/views/404/404";
import Login from "./modules/login/index.ts";
import Register from "./modules/register/index.ts";
import Main from "./modules/main/index.ts";
import ComponentLoading from "@/components/ComponentLoading";
import Loading from "./modules/loading";
import Forget from "@/router/modules/forget";
import Home from "@/router/modules/home";
import MainHome from "@/router/modules/main/home";
import MainBucket from "@/router/modules/main/bucket";
import MainFile from "@/router/modules/main/file";
import MainUserInfo from "@/router/modules/main/user/userInfo";
import MainUserSetting from "@/router/modules/main/user/userSetting";
import MainShare from "@/router/modules/main/share";
import MainSetting from "@/router/modules/main/settings";
import Ali from "@/router/modules/main/settings/ali/ali.ts";
import Tencent from "@/router/modules/main/settings/tencent/tencent.ts";
import Baidu from "@/router/modules/main/settings/baidu/baidu.ts";
import Huawei from "@/router/modules/main/settings/huawei/huawei.ts";
import Aws from "@/router/modules/main/settings/aws/aws.ts";
import Jd from "@/router/modules/main/settings/jd/jd.ts";
import Minio from "@/router/modules/main/settings/minio/minio.ts";
import Pingan from "@/router/modules/main/settings/pinan/pingan.ts";
import Qingyun from "@/router/modules/main/settings/qingyun/qingyun.ts";
import Ucloud from "@/router/modules/main/settings/ucloud/ucloud.ts";
import Up from "@/router/modules/main/settings/up/up.ts";
import Wangyi from "@/router/modules/main/settings/wangyi/wangyi.ts";
import Jinshan from "@/router/modules/main/settings/jinshan/jinshan.ts";
import Qiniu from "@/router/modules/main/settings/qiniu/qiniu.ts";
import ShareList from "@/router/modules/main/share/modules/shareList.tsx";
import ShareDetail from "@/router/modules/main/share/modules/shareDetail.tsx";
import minioBucket from "@/router/modules/main/bucket/createBuckets/minio.ts";
import tencentBucket from "@/router/modules/main/bucket/createBuckets/tencent.ts";
import aliBucket from "@/router/modules/main/bucket/createBuckets/ali.ts";
import baiduBucket from "@/router/modules/main/bucket/createBuckets/baidu.ts";
import huaweiBucket from "@/router/modules/main/bucket/createBuckets/huawei.ts";
import jdBucket from "@/router/modules/main/bucket/createBuckets/jd.ts";
import jinshanBucket from "@/router/modules/main/bucket/createBuckets/jinshan.ts";
import pinganBucket from "@/router/modules/main/bucket/createBuckets/pingan.ts";
import qingyunBucket from "@/router/modules/main/bucket/createBuckets/qingyun.ts";
import qiniuBucket from "@/router/modules/main/bucket/createBuckets/qiniu.ts";
import ucloudBucket from "@/router/modules/main/bucket/createBuckets/ucloud.ts";
import upBucket from "@/router/modules/main/bucket/createBuckets/up.ts";
import wangyiBucket from "@/router/modules/main/bucket/createBuckets/wangyi.ts";
import ShareAdd from "@/router/modules/main/share/modules/shareAdd.tsx";
import MyShare from "@/router/modules/main/user/myShare";
import MyFavorites from "@/router/modules/main/user/myFavorites";

const routes: RouteObject[] = [
	{
		path: "/",
		Component: (props) => ComponentLoading(Home, props),
	},
	{
		path: "/register",
		Component: (props) => ComponentLoading(Register, props),
	},
	{
		path: "/404",
		Component: (props) => ComponentLoading(NoFound, props),
	},
	{
		path: "/login",
		Component: (props) => ComponentLoading(Login, props),
	},
	{
		path: "/forget",
		Component: (props) => ComponentLoading(Forget, props),
	},
	{
		path: "/main",
		element: <Navigate to={"/main/home"} />,
	},
	{
		path: "/main",
		Component: (props) => ComponentLoading(Main, props),
		children: [
			{
				index: true,
				path: "/main/home",
				Component: MainHome,
			},
			{
				path: "/main/bucket",
				Component: MainBucket,
				children: [
					{
						path: "/main/bucket/minio",
						Component: minioBucket,
					},
					{
						path: "/main/bucket/ali",
						Component: aliBucket,
					},
					{
						path: "/main/bucket/tencent",
						Component: tencentBucket,
					},
					{
						path: "/main/bucket/baidu",
						Component: baiduBucket,
					},
					{
						path: "/main/bucket/huawei",
						Component: huaweiBucket,
					},
					{
						path: "/main/bucket/jd",
						Component: jdBucket,
					},
					{
						path: "/main/bucket/jinshan",
						Component: jinshanBucket,
					},
					{
						path: "/main/bucket/pingan",
						Component: pinganBucket,
					},
					{
						path: "/main/bucket/qingyun",
						Component: qingyunBucket,
					},
					{
						path: "/main/bucket/qiniu",
						Component: qiniuBucket,
					},
					{
						path: "/main/bucket/ucloud",
						Component: ucloudBucket,
					},
					{
						path: "/main/bucket/up",
						Component: upBucket,
					},
					{
						path: "/main/bucket/wangyi",
						Component: wangyiBucket,
					},
				],
			},
			{
				path: "/main/file",
				Component: MainFile,
			},
			{
				path: "/main/file/:bucket",
				Component: MainFile,
			},
			{
				path: "/main/user/info",
				Component: MainUserInfo,
			},
			{
				path: "/main/user/setting",
				Component: MainUserSetting,
			},
			{
				path: "/main/user/myshare",
				Component: MyShare,
			},
			{
				path: "/main/user/favorites",
				Component: MyFavorites,
			},

			{
				path: "/main/share",
				Component: MainShare,
			},
			{
				path: "/main/share/list/:id",
				Component: ShareList,
			},
			{
				path: "/main/share/detail/:id",
				Component: ShareDetail,
			},
			{
				path: "/main/share/add",
				Component: ShareAdd,
			},
			{
				path: "/main/setting",
				Component: MainSetting,
				children: [
					{
						path: "/main/setting/ali",
						Component: Ali,
					},
					{
						path: "/main/setting/tencent",
						Component: Tencent,
					},
					{
						path: "/main/setting/baidu",
						Component: Baidu,
					},
					{
						path: "/main/setting/huawei",
						Component: Huawei,
					},
					{
						path: "/main/setting/aws",
						Component: Aws,
					},
					{
						path: "/main/setting/jd",
						Component: Jd,
					},
					{
						path: "/main/setting/minio",
						Component: Minio,
					},
					{
						path: "/main/setting/pinan",
						Component: Pingan,
					},
					{
						path: "/main/setting/qingyun",
						Component: Qingyun,
					},
					{
						path: "/main/setting/qiniu",
						Component: Qiniu,
					},
					{
						path: "/main/setting/ucloud",
						Component: Ucloud,
					},
					{
						path: "/main/setting/up",
						Component: Up,
					},
					{
						path: "/main/setting/wangyi",
						Component: Wangyi,
					},
					{
						path: "/main/setting/jinshan",
						Component: Jinshan,
					},
				],
			},
		],
	},
	{
		path: "/home",
		Component: (props) => ComponentLoading(Home, props),
	},
	{
		path: "/loading",
		Component: Loading,
	},
];

export default routes;
