/**
 * `<nav-item-ui>` — Single navigation link inside <nav-ui> (optionally nested under
<nav-group-ui>). Consolidates the prior `app-nav-item-ui` +
`section-nav-item-ui` per ADR-0015 § Nav consolidation.

Supports icon, label, optional badge, selected/disabled state, and
keyboard activation (Enter/Space). Selection is managed by the parent
<nav-ui>; clicking or activating an item calls nav.select(this) and
bubbles a `nav-select` event.

 *
 * @see https://ui-kit.exe.xyz/site/components/nav-item
 *
 * 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 NavItemNavSelectEventDetail {
  /** The nav-item element itself. */
  item: Record<string, unknown>;
  /** Item text content. */
  text: string;
  /** Item value attribute. */
  value: string;
}

export type NavItemNavSelectEvent = CustomEvent<NavItemNavSelectEventDetail>;

export class UINavItem extends UIElement {
  /** Optional trailing badge. */
  badge: string;
  /** Suppresses click/keyboard activation; greyed visually. */
  disabled: boolean;
  /** Optional leading icon name. */
  icon: string;
  /** Set by the parent <nav-ui>'s select() method. */
  selected: boolean;
  /** Visible item label. */
  text: string;
  /** Identifier — typically a route or anchor. */
  value: string;
  /** Visual treatment. Default ('') renders as a primary-rail item (reserved icon space, in-icon selected accent). 'section' renders flat — no icon space when absent, left-edge accent bar for selected. When the parent <nav-ui> carries variant="section", this item inherits it via CSS cascade unless an explicit variant is set. */
  variant: '' | 'section';

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