/**
* DevExtreme (ui/speech_to_text.d.ts)
* Version: 25.2.7
* Build date: Tue May 05 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import {
  EventInfo,
  NativeEventInfo,
  InitializedEventInfo,
  ChangedOptionInfo,
  InteractionEvent,
} from '../events';

import Widget, { WidgetOptions } from './widget/ui.widget';
import type { ButtonStyle, ButtonType } from './button';

/**
 * Configures the Web Speech API (SpeechRecognition properties).
 */
export type SpeechRecognitionConfig = {
  /**
   * Configures the SpeechRecognition.continuous property.
   */
  continuous?: boolean;

  /**
   * Configures the SpeechRecognition.grammars property.
   */
  grammars?: string[];

  /**
   * Configures the SpeechRecognition.interimResults property.
   */
  interimResults?: boolean;

  /**
   * Configures the SpeechRecognition.lang property.
   */
  lang?: string;

  /**
   * Configures the SpeechRecognition.maxAlternatives property.
   */
  maxAlternatives?: number;
};

/**
 * Allows you to implement custom speech recognition engines.
 */
export type CustomSpeechRecognizer = {
  /**
   * Specifies whether a custom speech recognition engine is implemented.
   */
  enabled?: boolean;

  /**
   * Indicates whether the custom speech recognition engine is listening.
   */
  isListening?: boolean;
};

/**
 * The argument type in the startClick event.
 */
export type StartClickEvent = NativeEventInfo<dxSpeechToText, InteractionEvent>;

/**
 * The argument type in the stopClick event.
 */
export type StopClickEvent = NativeEventInfo<dxSpeechToText, InteractionEvent>;

/**
 * The argument type in the result event.
 */
export type ResultEvent = EventInfo<dxSpeechToText> & { event: Event };

/**
 * The argument type in the error event.
 */
export type ErrorEvent = EventInfo<dxSpeechToText> & { event: Event };

/**
 * The argument type in the end event.
 */
export type EndEvent = EventInfo<dxSpeechToText> & { event: Event };

/**
 * The argument type in the contentReady event.
 */
export type ContentReadyEvent = EventInfo<dxSpeechToText>;

/**
 * The argument type in the disposing event.
 */
export type DisposingEvent = EventInfo<dxSpeechToText>;

/**
 * The argument type in the initialized event.
 */
export type InitializedEvent = InitializedEventInfo<dxSpeechToText>;

/**
 * The argument type in the optionChanged event.
 */
export type OptionChangedEvent = EventInfo<dxSpeechToText> & ChangedOptionInfo;

/**
 * 
 */
export interface Properties extends WidgetOptions<dxSpeechToText> {
  /**
   * Allows you to implement custom speech recognition engines.
   */
  customSpeechRecognizer?: CustomSpeechRecognizer;

  /**
   * The SpeechToText button text in the initial component state.
   */
  startText?: string;

  /**
   * The SpeechToText button text in the &apos;listening&apos; component state.
   */
  stopText?: string;

  /**
   * Specifies SpeechToText button styling.
   */
  stylingMode?: ButtonStyle;

  /**
   * The SpeechToText button icon in the initial component state.
   */
  startIcon?: string;

  /**
   * The SpeechToText button icon in the &apos;listening&apos; component state.
   */
  stopIcon?: string;

  /**
   * Specifies the SpeechToText button type.
   */
  type?: ButtonType | string;

  /**
   * Configures the Web Speech API (SpeechRecognition properties).
   */
  speechRecognitionConfig?: SpeechRecognitionConfig | { [key: string]: any };

  /**
   * A function that is executed when the SpeechToText button is clicked or tapped in the initial component state.
   */
  onStartClick?: ((e: StartClickEvent) => void) | undefined;

  /**
   * A function that is executed when the SpeechToText button is clicked or tapped in the &apos;listening&apos; component state.
   */
  onStopClick?: ((e: StopClickEvent) => void) | undefined;

  /**
   * A function that is executed when the Web Speech API returns a result.
   */
  onResult?: ((e: ResultEvent) => void) | undefined;

  /**
   * A function that is executed when the Web Speech API encounters an error.
   */
  onError?: ((e: ErrorEvent) => void) | undefined;

  /**
   * A function that is executed when the Web Speech API finishes transcription and SpeechToText switches to the initial component state.
   */
  onEnd?: ((e: EndEvent) => void) | undefined;
}

/**
 * The SpeechToText UI component is TBA.
 */
export default class dxSpeechToText extends Widget<Properties> { }

export type ExplicitTypes = {
  Properties: Properties;
  ContentReadyEvent: ContentReadyEvent;
  DisposingEvent: DisposingEvent;
  InitializedEvent: InitializedEvent;
  OptionChangedEvent: OptionChangedEvent;
  StartClickEvent: StartClickEvent;
  StopClickEvent: StopClickEvent;
  ResultEvent: ResultEvent;
  ErrorEvent: ErrorEvent;
};


