/**
 * `<nav-ui>` — Navigation rail. Consolidates the prior `app-nav-ui` + `section-nav-ui`
pair per ADR-0015 § Nav consolidation. [variant] drives visual
treatment; behavior is unified.

Default variant ("primary") is the app-sidebar nav: ResizeObserver
collapses to icon-only below 96px, groups open a popover when
collapsed. [variant="section"] is a subnav rail with quieter chrome
and a [heading] kicker rendered via CSS.

 *
 * @see https://ui-kit.exe.xyz/site/components/nav
 *
 * Type declarations generated by scripts/build/dts-codegen.mjs from
 * the component's `.a2ui.json` sidecar(s). Edit the source `.yaml`,
 * run `npm run build:components`, then `npm run codegen:dts` to
 * regenerate; or hand-author this file fully if rich event types are
 * needed beyond what the yaml `events:` block can express.
 */

import { UIElement } from '../../core/element.js';

export interface NavSelectEventDetail {
  /** Selected nav-item element. */
  item: Record<string, unknown>;
  /** Item text content. */
  text: string;
  /** Item value attribute. */
  value: string;
}

export type NavSelectEvent = CustomEvent<NavSelectEventDetail>;

export class UINav extends UIElement {
  /** Primary-variant only. Force icon-only collapse regardless of viewport width. */
  collapsed: boolean;
  /** Auto-place dividers between adjacent groups + items. */
  divider: boolean;
  /** Optional kicker label. Section variant renders it via ::before; primary uses it as aria-label only. */
  heading: string;
  /** Visual treatment. primary = app sidebar; section = subnav rail. */
  variant: 'primary' | 'section';

  addEventListener<K extends keyof HTMLElementEventMap>(
    type: K,
    listener: (this: UINav, ev: HTMLElementEventMap[K]) => unknown,
    options?: boolean | AddEventListenerOptions,
  ): void;
  addEventListener(type: 'nav-select', listener: (ev: NavSelectEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
}
