/**
 * Centralized React Query keys.
 *
 * Conventions:
 * - All keys start with a stable label so prefix-based invalidation works
 *   from `lib/syncEvents.ts` when a `memory:changed` event arrives.
 * - Server state only — UI-local state (selection, tab, form input)
 *   stays in component-level useState.
 */

export const qk = {
  workbench: (configPath: string) => ['workbench', configPath] as const,
  record: (configPath: string, recordId: string) =>
    ['record', configPath, recordId] as const,
  history: (configPath: string, recordId: string) =>
    ['history', configPath, recordId] as const,
  sessions: (configPath: string, providerFilter: string, page: number) =>
    ['sessions', configPath, providerFilter, page] as const,
  sessionsList: (configPath: string, providerFilter: string) =>
    ['sessions', configPath, providerFilter] as const,
  sessionDetail: (configPath: string, sessionId: string) =>
    ['sessionDetail', configPath, sessionId] as const,
  wikiLint: (configPath: string) => ['wikiLint', configPath] as const,
  wikiIndex: (configPath: string, projectId: string | null) =>
    ['wikiIndex', configPath, projectId] as const,
} as const
