/**
 * Breadcrumb type definitions
 * @countermeasure/web-components/navigation/breadcrumb
 */

export interface BreadcrumbItem {
  /** Visible label rendered for the breadcrumb item. */
  label: string
  /** Optional URL the item navigates to. Omit for non-link items. */
  href?: string
  /** Optional icon HTML rendered before the label. */
  icon?: string
  /** Marks the item as the current page (rendered with `aria-current`). */
  current?: boolean
}

export interface BreadcrumbConfig {
  /** Container element (or selector) the breadcrumb is mounted into. */
  container: HTMLElement | string
  /** Ordered list of crumbs from root to current page. */
  items: BreadcrumbItem[]
  /**
   * Visual separator placed between crumbs.
   * @default '/'
   */
  separator?: string
  /**
   * Maximum number of crumbs to render. Excess items collapse into an
   * ellipsis between the first and last entries.
   */
  maxVisible?: number
  /** Additional CSS class names. */
  className?: string
  /** Called when a crumb link is clicked. */
  onNavigate?: (item: BreadcrumbItem, index: number) => void
}
