/// <reference types="../index.d.ts" />
import type { ArcgisArcadeEditor } from "../components/arcgis-arcade-editor/index.js";
import type { ArcgisCodeEditor } from "../components/arcgis-code-editor/index.js";
import type { ArcgisCodeViewer } from "../components/arcgis-code-viewer/index.js";
import type { ArcgisSqlExpressionEditor } from "../components/arcgis-sql-expression-editor/index.js";
import { HTMLAttributes } from "preact";
import type { EventHandler } from "@arcgis/lumina";

interface PreactArcgisArcadeEditor extends Partial<Pick<ArcgisArcadeEditor, 'arcadeAssistant' | 'customPanels' | 'editorOptions' | 'hideDocumentationActions' | 'hideSideBar' | 'openedSidePanel' | 'profile' | 'script' | 'sideActionBarExpanded' | 'snippets' | 'suggestions' | 'testData'>>, HTMLAttributes<HTMLArcgisArcadeEditorElement> {
  onarcgisDiagnosticsChange?: EventHandler<HTMLArcgisArcadeEditorElement["arcgisDiagnosticsChange"]>;
  onarcgisScriptChange?: EventHandler<HTMLArcgisArcadeEditorElement["arcgisScriptChange"]>;
}

interface PreactArcgisCodeEditor extends Partial<Pick<ArcgisCodeEditor, 'editorOptions' | 'language' | 'modelId' | 'value'>>, HTMLAttributes<HTMLArcgisCodeEditorElement> {
  onarcgisSelectionChange?: EventHandler<HTMLArcgisCodeEditorElement["arcgisSelectionChange"]>;
  onarcgisValueChange?: EventHandler<HTMLArcgisCodeEditorElement["arcgisValueChange"]>;
}

interface PreactArcgisCodeViewer extends Partial<Pick<ArcgisCodeViewer, 'language' | 'round'>>, HTMLAttributes<HTMLArcgisCodeViewerElement> {
}

interface PreactArcgisSqlExpressionEditor extends Partial<Pick<ArcgisSqlExpressionEditor, 'hideSideBar' | 'profile' | 'script'>>, HTMLAttributes<HTMLArcgisSqlExpressionEditorElement> {
  onarcgisDiagnosticsChange?: EventHandler<HTMLArcgisSqlExpressionEditorElement["arcgisDiagnosticsChange"]>;
  onarcgisScriptChange?: EventHandler<HTMLArcgisSqlExpressionEditorElement["arcgisScriptChange"]>;
}

declare module 'preact' {
  namespace createElement.JSX {
    interface IntrinsicElements {
      "arcgis-arcade-editor": PreactArcgisArcadeEditor;
      "arcgis-code-editor": PreactArcgisCodeEditor;
      "arcgis-code-viewer": PreactArcgisCodeViewer;
      "arcgis-sql-expression-editor": PreactArcgisSqlExpressionEditor;
    }
  }
  namespace h.JSX {
    interface IntrinsicElements {
      "arcgis-arcade-editor": PreactArcgisArcadeEditor;
      "arcgis-code-editor": PreactArcgisCodeEditor;
      "arcgis-code-viewer": PreactArcgisCodeViewer;
      "arcgis-sql-expression-editor": PreactArcgisSqlExpressionEditor;
    }
  }
}