export type HelpPageDef = {
  id: string;
  title: string;
};

export const HELP_PAGES: HelpPageDef[] = [
  { id: "getting-started", title: "Getting Started" },
  { id: "keyboard-shortcuts", title: "Keyboard Shortcuts" },
  { id: "chat-input", title: "Chat & Input" },
  { id: "file-editor", title: "File Editor" },
  { id: "git-panel", title: "Git & Version Control" },
  { id: "theme-customisation", title: "Theme Customisation" },
  { id: "model-config", title: "Model & API Configuration" },
  { id: "session-management", title: "Session Management" },
  { id: "task-loop", title: "Task Loop & Automation" },
  { id: "panels-tools", title: "Panels & Tools" },
  { id: "troubleshooting", title: "Troubleshooting" },
  { id: "changelog", title: "Changelog" },
];

export function nextPage(currentIndex: number, totalPages: number): number {
  return Math.min(currentIndex + 1, totalPages - 1);
}

export function prevPage(currentIndex: number): number {
  return Math.max(currentIndex - 1, 0);
}

export function clampPage(pageIndex: number, totalPages: number): number {
  if (totalPages <= 0) return 0;
  return Math.max(0, Math.min(pageIndex, totalPages - 1));
}

export function isFirstPage(currentIndex: number): boolean {
  return currentIndex === 0;
}

export function isLastPage(currentIndex: number, totalPages: number): boolean {
  return currentIndex >= totalPages - 1;
}
