import { DASHBOARD_PATH, RANKING_LIST_PATH } from "../../../shared/routes.ts"

export interface BreadcrumbItem {
  label: string
  /** Absolute route to link to. Omitted for the current (last) page. */
  to?: string
}

interface TrailLabels {
  dashboard: string
  ranking: string
}

/** `Dashboard > Ranking` — the list view; `Ranking` is the current page. */
export function buildRankingListBreadcrumbs(labels: TrailLabels): BreadcrumbItem[] {
  return [{ label: labels.dashboard, to: DASHBOARD_PATH }, { label: labels.ranking }]
}

/** `Dashboard > Ranking > <selected ranking>` — the settings view. */
export function buildRankingSettingsBreadcrumbs(
  labels: TrailLabels,
  rankingLabel: string,
): BreadcrumbItem[] {
  return [
    { label: labels.dashboard, to: DASHBOARD_PATH },
    { label: labels.ranking, to: RANKING_LIST_PATH },
    { label: rankingLabel },
  ]
}
