/// <reference types="../index.d.ts" />
import type { ArcgisArcadeEditor } from "../components/arcgis-arcade-editor/customElement.js";
import type { ArcgisCodeEditor } from "../components/arcgis-code-editor/customElement.js";
import type { CodeEditorShell } from "../components/arcgis-code-editor-shell/customElement.js";
import type { ArcgisCodeViewer } from "../components/arcgis-code-viewer/customElement.js";
import type { ArcgisSqlExpressionEditor } from "../components/arcgis-sql-expression-editor/customElement.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<ArcgisArcadeEditor> {
  onarcgisDiagnosticsChange?: EventHandler<ArcgisArcadeEditor["arcgisDiagnosticsChange"]>;
  onarcgisScriptChange?: EventHandler<ArcgisArcadeEditor["arcgisScriptChange"]>;
}

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

interface PreactArcgisCodeEditorShell extends HTMLAttributes<CodeEditorShell> {
}

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

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

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