/**
 * `<agent-trace-ui>` — Collapsible metrics + training-feedback panel for an agent turn. Shows reasoning steps, tool calls, latency, and token counts with a thumbs-up/down feedback affordance. Use inside <chat-thread-ui> message bodies for expert/debug views; hide by default in user-facing chat.
 *
 * @see https://ui-kit.exe.xyz/site/components/agent-trace
 *
 * 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 AgentTraceTraceToggleEventDetail {
  /** Whether the trace is now collapsed. */
  collapsed: boolean;
}

export type AgentTraceTraceToggleEvent = CustomEvent<AgentTraceTraceToggleEventDetail>;

export class UIAgentTrace extends UIElement {
  /** Hide the trace body. Default-visible disclosure (matches the agent-* family — agent-reasoning, agent-artifact). Set to opt out. */
  collapsed: boolean;
  /** Fallback summary label. */
  label: string;

  addEventListener<K extends keyof HTMLElementEventMap>(
    type: K,
    listener: (this: UIAgentTrace, ev: HTMLElementEventMap[K]) => unknown,
    options?: boolean | AddEventListenerOptions,
  ): void;
  addEventListener(type: 'trace-toggle', listener: (ev: AgentTraceTraceToggleEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
}
