export const defaultAuthenticatedRoute = {
  name: "dashboard",
}

export const adminNavigationSections = [
  {
    key: "current",
    label: "目前主線",
    description: "新版模組",
    items: [
      {
        index: "/dashboard",
        label: "總覽儀表板",
        icon: "Grid",
        matchPrefixes: ["/dashboard"],
      },
      {
        index: "/experiments",
        label: "銷售實驗",
        icon: "DataAnalysis",
        matchPrefixes: ["/experiments", "/variants", "/releases", "/editor"],
      },
    ],
  },
  {
    key: "legacy",
    label: "舊版模組",
    description: "過渡沿用",
    items: [
      {
        index: "/ose-card",
        label: "行銷圖卡",
        icon: "Postcard",
        matchPrefixes: ["/ose-card"],
      },
      {
        index: "/conutdown-timer",
        label: "倒數計時器",
        icon: "Refresh",
        matchPrefixes: ["/conutdown-timer"],
      },
    ],
  },
]

export const adminNavigationItems = adminNavigationSections.flatMap(
  (section) => section.items
)

export const findNavigationItemByPath = (path = "") =>
  adminNavigationItems.find((item) =>
    item.matchPrefixes.some((prefix) => path.startsWith(prefix))
  )
