import type { ReactNode } from 'react';

export type CommandMode = 'actions' | 'navigate' | 'ask-ai';

export interface Command {
  /** Stable id — used for React key + persistence (recents/favourites). */
  id: string;
  /** Display label. */
  label: string;
  /** Optional short description rendered under the label. */
  description?: string;
  /** Glyph rendered to the left of the label. */
  icon?: ReactNode;
  /** Mode bucket — controls which tab the command appears under. */
  mode?: CommandMode;
  /** Keyboard shortcut hint (e.g. ['Cmd', 'K']). Display only. */
  shortcut?: string[];
  /** Searchable synonyms / aliases that contribute to fuzzy match. */
  keywords?: string[];
  /** Section heading the command belongs to. */
  section?: string;
  /** For navigate-mode commands — the target href. */
  href?: string;
  /** For action-mode commands — what to run. */
  run?: () => void | Promise<void>;
  /** When false the command is greyed out and unselectable. */
  enabled?: boolean;
  /**
   * Auth/feature-flag gate. If returned falsy at filter time the command is
   * hidden entirely. Pure functions only — called on every query.
   */
  requires?: () => boolean;
  /**
   * Optional product/scope tag (e.g. 'chronomind'). Lets the host filter
   * the registry per-product without registering/unregistering on mount.
   */
  productScope?: string;
}
