/**
 * `<alert-ui>` — Inline alert banner — a persistent, in-flow notice with icon +
title + description + optional dismiss + slotted action. Variants
map to semantic severity (info / success / warning / danger).
Distinct from <toast-ui> (transient global notification with
auto-dismiss) and from <empty-state-ui> (zero-data placeholder).
Use alert-ui for inline contextual notices the user should see
before continuing — form-level errors, banner-style status,
inline upgrade prompts.

 *
 * @see https://ui-kit.exe.xyz/site/components/alert
 *
 * 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 type AlertCloseEvent = CustomEvent<unknown>;
export type AlertDunningActionEvent = CustomEvent<unknown>;

export class UIAlert extends UIElement {
  /** Bold headline rendered as the first line of the alert content. Pair with [description] for the canonical "banner" pattern (headline + body). When [title] or [description] is set, the [text] prop is ignored. */
  title: string;
  /** Body text rendered as the second line of the alert content, below [title]. May be used alone (without [title]) for a single muted-body message. */
  description: string;
  /** Dunning mode only — the unpaid amount as a decimal major-unit number (`24.50`, not minor units like `2450`). Formatted via `Intl.NumberFormat` using [currency] and [lang]. Ignored when [pattern] is not `dunning`. */
  amount: number;
  /** Dunning mode only — last 4 digits of the declined card. Rendered as "ending 4242". Ignored when [pattern] is not `dunning`. Attribute spelling: `card-last4`. */
  cardLast4: string;
  /** Whether a close button is displayed. Alias [dismissible] is also accepted (same semantics, different spelling — the corpus and many libraries use both; both map to the same state). */
  closable: boolean;
  /** Dunning mode only — ISO 4217 currency code driving the `Intl.NumberFormat` style="currency" rendering. Defaults to `USD`. */
  currency: string;
  /** Public alias for [closable] — same semantics. Both attributes render the close button. Use whichever spelling matches your authoring style. */
  dismissible: boolean;
  /** Dunning mode only — ISO 8601 due / failed-at timestamp. Formatted via `Intl.DateTimeFormat`. Ignored when [pattern] is not `dunning`. Attribute spelling: `due-at`. */
  dueAt: string;
  /** Icon identifier displayed before the message content */
  icon: string;
  /** Domain pattern mode. Default is empty (standard alert). Setting `pattern="dunning"` switches to billing dunning render mode — stamps a formatted amount + due-date + decline-reason from props and re-dispatches descendant `[data-dunning-action]` button clicks as a unified `dunning-action` event. Spec: SPEC-006. */
  pattern: '' | 'dunning';
  /** Dunning mode only — decline reason. Drives the leading icon (declined → `x-circle`, expired → `clock`, insufficient → `wallet`, network → `wifi-slash`). One of: `declined`, `expired`, `insufficient`, `network`, or empty. */
  reason: '' | 'declined' | 'expired' | 'insufficient' | 'network';
  /** Single-line alert message. For two-line "headline + body" alerts, use [title] + [description] instead. For rich content (links, formatting), use the [slot="content"] slot. */
  text: string;
  /** Semantic color variant. */
  variant: 'default' | 'info' | 'success' | 'warning' | 'danger' | 'muted' | 'neutral';

  addEventListener<K extends keyof HTMLElementEventMap>(
    type: K,
    listener: (this: UIAlert, ev: HTMLElementEventMap[K]) => unknown,
    options?: boolean | AddEventListenerOptions,
  ): void;
  addEventListener(type: 'close', listener: (ev: AlertCloseEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
  addEventListener(type: 'dunning-action', listener: (ev: AlertDunningActionEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
}
