/**
 * Resolves the dynamic subtitle shown next to the brand in the AppShell
 * header. Reflects the current section so the user always sees where they
 * are without scanning the nav row.
 *
 * Special-cases case routes (`/cases/{caseNumber}`) so the subtitle includes
 * the case number — the most useful piece of context during decision drafting.
 */
export function headerSubtitle(pathname: string): string {
  if (pathname === "/") return "בית";

  if (pathname.startsWith("/cases/")) {
    const [, , slug] = pathname.split("/");
    if (!slug || slug === "new") return "תיק חדש";
    const decoded = decodeURIComponent(slug);
    return `ערר ${decoded}`;
  }

  if (pathname.startsWith("/archive"))     return "ארכיון";
  if (pathname.startsWith("/training"))    return "אימון סגנון";
  if (pathname.startsWith("/precedents"))  return "ספריית פסיקה";
  if (pathname.startsWith("/digests"))     return "יומונים";
  if (pathname.startsWith("/methodology")) return "מתודולוגיה";
  if (pathname.startsWith("/skills"))      return "מיומנויות";
  if (pathname.startsWith("/diagnostics")) return "אבחון";
  if (pathname.startsWith("/settings"))    return "הגדרות";
  if (pathname.startsWith("/feedback"))    return "הערות יו״ר";

  return "ניהול תיקים";
}
