/**
 * Single source of truth for config sub-navigation and breadcrumb routes.
 * Add new config pages here and create the matching `app/admin/(shell)/config/.../page.tsx`.
 *
 * ## 导航层级约定（避免「侧栏 + 顶栏 + 页内 Tab」叠三层）
 * 1. **侧栏**：模块入口（如「运营配置」）— 全站唯一一级。
 * 2. **本文件顶栏（ConfigSubNav）**：运营配置下的「业务子域」切换（玩法、赔率、奖池…）— 最多一层。
 * 3. **页面内**：默认 **禁止再建 Tab/子路由**；改参数与查流水用 **同页分区（ConfigSection）** 或锚点 `#records`。
 *    仅当子域体量极大、且与配置完全无关时再考虑独立路由，且不得与顶栏同名。
 */

export type ConfigNavGroup = {
  id: string;
  items: readonly {
    href: string;
    key: string;
  }[];
};

export const CONFIG_NAV_GROUPS: readonly ConfigNavGroup[] = [
  {
    id: "betting",
    items: [
      {
        href: "/admin/config/plays",
        key: "plays",
      },
      {
        href: "/admin/config/jackpot",
        key: "jackpot",
      },
    ],
  },
  {
    id: "risk",
    items: [
      {
        href: "/admin/config/risk-cap",
        key: "risk-cap",
      },
    ],
  },
] as const;

export function flattenConfigNavHrefs(): string[] {
  const out: string[] = [];
  for (const g of CONFIG_NAV_GROUPS) {
    for (const it of g.items) {
      out.push(it.href);
    }
  }
  return out;
}
