export type AcAppKey =
  | 'home'
  | 'persona'
  | 'jobs'
  | 'schedule'
  | 'template'
  | 'settings'
  | 'profile'
  | 'permissions'
  | 'easter'
  | 'threads'
  | 'more'

export type NavItem = {
  to: string
  label: string
  icon: AcAppKey
  end?: boolean
  matchPrefix?: string
  adminOnly?: boolean
}

/** 外層雙軌：流程 A 拷貝忍者 + 流程 B 找 TA（主題列表 + 子步驟） */
export const coreWorkflowNavGroup = (): { label: string; items: NavItem[] } => ({
  label: '核心工作流',
  items: [
    { to: '/matrix', label: '拷貝忍者', icon: 'jobs', matchPrefix: '/matrix' },
    { to: '/placement/topics', label: '找 TA', icon: 'threads', matchPrefix: '/placement' },
  ],
})

/** @deprecated 使用 coreWorkflowNavGroup */
export const placementFlowNavGroup = coreWorkflowNavGroup

export const navGroups: { label: string; items: NavItem[] }[] = [
  {
    label: '工作區',
    items: [
      { to: '/', label: '總覽', icon: 'home', end: true },
      { to: '/brands', label: '品牌', icon: 'profile', matchPrefix: '/brands' },
      { to: '/personas', label: '人設', icon: 'persona', matchPrefix: '/personas' },
      { to: '/jobs', label: '任務', icon: 'jobs', matchPrefix: '/jobs' },
      { to: '/job-schedules', label: '排程', icon: 'schedule' },
    ],
  },
  {
    label: '系統',
    items: [
      { to: '/job-templates', label: '模板', icon: 'template', adminOnly: true },
      { to: '/settings', label: '設定', icon: 'settings' },
      { to: '/profile', label: '會員', icon: 'profile' },
      { to: '/permissions', label: '權限', icon: 'permissions', adminOnly: true },
      { to: '/easter-eggs', label: '彩蛋手冊', icon: 'easter', adminOnly: true },
    ],
  },
]

export const navApps = navGroups.flatMap((group) => group.items)