import type { RouteRecordRaw } from "vue-router";

// @todo: sample view routes
import RemoveTableView from "@/views/Sample/RemoveTableView.vue";
import LocalTableView from "@/views/Sample/LocalTableView.vue";
// import { PRIVILEGE } from "@/constants/privileges";

export enum ROUTE_VIEWS {
  REMOTE_SAMPLE_PAGE_VIEW = "RemoteSamplePageView",
  LOCAL_SAMPLE_PAGE_VIEW = "LocalSamplePageView",
}

export const sampleRoutes: RouteRecordRaw[] = [
  {
    path: "",
    name: "Redirect - SampleViews",
    redirect: { name: ROUTE_VIEWS.REMOTE_SAMPLE_PAGE_VIEW },
  },
  {
    path: "remote/:rowId?",
    name: ROUTE_VIEWS.REMOTE_SAMPLE_PAGE_VIEW,
    component: RemoveTableView,
    meta: {
      title: "SampleView.remotePageTitle",
      label: "SampleView.remotePageLabel",
    },
  },
  {
    path: "local/:rowId?",
    name: ROUTE_VIEWS.LOCAL_SAMPLE_PAGE_VIEW,
    component: LocalTableView,
    meta: {
      title: "SampleView.localPageTitle",
      label: "SampleView.localPageLabel",

      // Privilege usages:
      // - as plain string
      // privileges: PRIVILEGE.SAMPLE_ENTITY_PRIVILEGE,

      // - as array of strings (allowed if any of them matched)
      // privileges: [PRIVILEGE.SAMPLE_ENTITY_PRIVILEGE, PRIVILEGE.SAMPLE_ENTITY_PRIVILEGE],

      // - as predicate function
      // privileges: () => Boolean(useAuthentication().isDevUser),

      // - as object
      // privileges: {
      //   privileges: [
      //     // might be string or array
      //     PRIVILEGE.SAMPLE_ENTITY_PRIVILEGE,
      //     () => Boolean(useAuthentication().isDevUser),
      //   ],
      //   every: true, // if need to match all of them
      // },
    },
  },
];
