import { createRouter, createWebHashHistory } from "vue-router";
import Home from "@/pages/home/index.vue";
import YlSysMenu from "@/pages/sys-menu/index.vue";
import YlAccount from "@/pages/account/index.vue";
import YlAccountBill from "@/pages/account-bill/index.vue";
import YlAccountBillDetail from "@/pages/account-bill/month.vue";
import YlFile from "@/pages/files/index.vue";
import ErrorPage from "@/pages/error/index.vue";
import YlVideo from "@/pages/files/yl-video.vue";
import YlSysInfo from "@/pages/sys-info/yl-sys-info.vue";
import YlSysLog from "@/pages/sys-log/yl-sys-log.vue";
import YlChess from "@/pages/games/yl-chess.vue";
import YlChessRoom from "@/pages/games/yl-chess-room.vue";
import YlBackgammon from "@/pages/games/yl-backgammon.vue";
import YlBackgammonRoom from "@/pages/games/yl-backgammon-room.vue";
import YlNote from "@/pages/notes/yl-note.vue";
import YlNoteDetail from "@/pages/notes/yl-note-detail.vue";
import YlSysSettings from "@/pages/sys-settings/yl-sys-settings.vue";
import YlSysUser from "@/pages/sys-user/yl-sys-user.vue";

export const routes = [
  { path: "/", component: Home },
  { path: "/:catchAll(.*)", component: ErrorPage },
  // { path: "/admin/user", component: Home },
  { path: "/admin/menus", component: YlSysMenu },
  { path: "/account", component: YlAccount },
  { path: "/bill", component: YlAccountBill },
  { path: "/bill/:date", component: YlAccountBillDetail },
  { path: "/file", component: YlFile },
  { path: "/file/video", component: YlVideo },
  { path: "/sys-info", component: YlSysInfo },
  { path: "/sys-log", component: YlSysLog },
  { path: "/chess", component: YlChess },
  { path: "/chess/:id", component: YlChessRoom },
  { path: "/backgammon", component: YlBackgammon },
  { path: "/backgammon/:id", component: YlBackgammonRoom },
  { path: "/notes", component: YlNote },
  { path: "/notes/:id", component: YlNoteDetail },
  { path: "/sys-settings", component: YlSysSettings },
  { path: "/sys-user", component: YlSysUser },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes: routes.filter((route) =>
    ["/", "/:catchAll(.*)"].includes(route.path),
  ),
});

export default router;
