import { Navigate } from "react-router-dom";
import { lazy } from "react";

export interface AppRoute {
  path: string;
  element: React.ReactNode;
  auth?: boolean;
  children?: AppRoute[];
  meta?: {
    title: string;
  };
}
const Home = lazy(() => import("@/view/home"));
const Page404 = lazy(() => import("@/view/error/page404"));
const TranslateDetail = lazy(() => import("@/view/home/detail"));
const TranslateMood = lazy(() => import("@/view/home/mood"));
const TranslateArchives = lazy(() => import("@/view/home/archives"));
export const routes: AppRoute[] = [
  {
    path: "/",
    element: <Navigate to="/translate" replace />,
    auth: false,
    meta: {
      title: "宠物翻译",
    },
  },
  {
    path: "/translate",
    element: <Home />,
    auth: false,
    meta: {
      title: "宠物翻译",
    },
  },
  { path: "/translate/detail", element: <TranslateDetail />, auth: false },
  {
    path: "/translate/mood",
    element: <TranslateMood />,
    auth: false,
    meta: {
      title: "情绪监控",
    },
  },
  {
    path: "/translate/archives",
    element: <TranslateArchives />,
    auth: false,
    meta: {
      title: "宠物档案",
    },
  },
  { path: "*", element: <Page404 />, auth: false },
];
