/**
 * `<agent-reasoning-ui>` — Agent inner monologue + pipeline viewer with steps, thoughts, plans, and iterations.
 *
 * @see https://ui-kit.exe.xyz/site/components/agent-reasoning
 *
 * 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 AgentReasoningReasoningFinishEventDetail {
  /** Whether reasoning was resolved. */
  status: boolean;
  /** Summary label text rendered after finish. */
  summary: string;
}

export type AgentReasoningReasoningFinishEvent = CustomEvent<AgentReasoningReasoningFinishEventDetail>;
export interface AgentReasoningReasoningStepToggleEventDetail {
  /** ID of the toggled reasoning step (matches data-step-id). */
  stepId: string;
}

export type AgentReasoningReasoningStepToggleEvent = CustomEvent<AgentReasoningReasoningStepToggleEventDetail>;
export interface AgentReasoningReasoningToggleEventDetail {
  /** Whether the reasoning section is now collapsed. */
  collapsed: boolean;
}

export type AgentReasoningReasoningToggleEvent = CustomEvent<AgentReasoningReasoningToggleEventDetail>;

export class UIAgentReasoning extends UIElement {
  /** Start collapsed. */
  collapsed: boolean;
  /** Fallback summary label. */
  heading: string;
  /** Disable auto-collapse after finish(). */
  noAutocollapse: boolean;
  /** Drives the status icon — idle, active (spinner), done (check), error (warning). */
  status: 'idle' | 'active' | 'done' | 'error';

  addEventListener<K extends keyof HTMLElementEventMap>(
    type: K,
    listener: (this: UIAgentReasoning, ev: HTMLElementEventMap[K]) => unknown,
    options?: boolean | AddEventListenerOptions,
  ): void;
  addEventListener(type: 'reasoning-finish', listener: (ev: AgentReasoningReasoningFinishEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
  addEventListener(type: 'reasoning-step-toggle', listener: (ev: AgentReasoningReasoningStepToggleEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
  addEventListener(type: 'reasoning-toggle', listener: (ev: AgentReasoningReasoningToggleEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
}
