import AreaFavoritesPage from "../features/areas/pages/AreaFavoritesPage.vue";
import AreaTreePage from "../features/areas/pages/AreaTreePage.vue";
import AreaDetailPage from "../features/areas/pages/AreaDetailPage.vue";
import DevicesListPage from "../features/devices/pages/DevicesListPage.vue";
import DevicesScanningPage from "../features/devices/pages/DevicesScanningPage.vue";
import DeviceDetailPage from "../features/devices/pages/DeviceDetailPage.vue";
import ScriptsActionsPage from "../features/scripts/pages/ScriptsActionsPage.vue";
import ScriptsRegularPage from "../features/scripts/pages/ScriptsRegularPage.vue";
import ScriptsScopesPage from "../features/scripts/pages/ScriptsScopesPage.vue";
import ScriptDetailPage from "../features/scripts/pages/ScriptDetailPage.vue";
import FirmwaresListPage from "../features/firmwares/pages/FirmwaresListPage.vue";
import ModesListPage from "../features/modes/pages/ModesListPage.vue";
import LoginPage from "../features/auth/pages/LoginPage.vue";
import MobileSetupPage from "../features/auth/pages/MobileSetupPage.vue";
import MobileAuthPage from "../features/auth/pages/MobileAuthPage.vue";

export const routes = [
  {
    path: "/",
    redirect: "/areas/favorites",
  },
  {
    path: "/login",
    name: "login",
    component: LoginPage,
    meta: { public: true },
  },
  {
    path: "/mobile-setup",
    name: "mobile-setup",
    component: MobileSetupPage,
    meta: { public: true },
  },
  {
    path: "/mobile-auth",
    name: "mobile-auth",
    component: MobileAuthPage,
    meta: { public: true },
  },
  {
    path: "/areas/favorites",
    name: "areas-favorites",
    component: AreaFavoritesPage,
    meta: { permission: "areas.view" },
  },
  {
    path: "/areas/tree",
    name: "areas-tree",
    component: AreaTreePage,
    meta: { permission: "areas.view" },
  },
  {
    path: "/areas/:id",
    name: "area-detail",
    component: AreaDetailPage,
    meta: { permission: "areas.view" },
  },
  {
    path: "/devices",
    name: "devices",
    component: DevicesListPage,
    meta: { permission: "devices.view" },
  },
  {
    path: "/devices/scanning",
    name: "devices-scanning",
    component: DevicesScanningPage,
    meta: { permission: "devices.scan" },
  },
  {
    path: "/devices/:id",
    name: "device-detail",
    component: DeviceDetailPage,
    meta: { permission: "devices.view" },
  },
  {
    path: "/scripts/actions",
    name: "scripts-actions",
    component: ScriptsActionsPage,
    meta: { permission: "scripts.run" },
  },
  {
    path: "/scripts/regular",
    name: "scripts-regular",
    component: ScriptsRegularPage,
    meta: { permission: "scripts.view" },
  },
  {
    path: "/scripts/scopes",
    name: "scripts-scopes",
    component: ScriptsScopesPage,
    meta: { permission: "scripts.view" },
  },
  {
    path: "/scripts/:type(actions|regular|scopes)/:id",
    name: "script-detail",
    component: ScriptDetailPage,
    meta: { permission: "scripts.view" },
  },
  {
    path: "/firmwares",
    name: "firmwares",
    component: FirmwaresListPage,
    meta: { permission: "firmware.view" },
  },
  {
    path: "/modes",
    name: "modes",
    component: ModesListPage,
    meta: { permission: "scripts.view" },
  },
  {
    path: "/:pathMatch(.*)*",
    name: "not-found",
    component: () => import("../features/system/NotFoundPage.vue"),
  },
];
