/// <reference types="../index.d.ts" />
import type { ArcgisArcadeEditor } from "../components/arcgis-arcade-editor";
import type { ArcgisCodeEditor } from "../components/arcgis-code-editor";
import type { ArcgisSqlExpressionEditor } from "../components/arcgis-sql-expression-editor";
import { JSX as PreactJsx } 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'>>, PreactJsx.HTMLAttributes<HTMLArcgisArcadeEditorElement> {
  onarcgisDiagnosticsChange?: EventHandler<HTMLArcgisArcadeEditorElement["arcgisDiagnosticsChange"]>;
  onarcgisScriptChange?: EventHandler<HTMLArcgisArcadeEditorElement["arcgisScriptChange"]>;
}

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

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

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