/// <reference types="../index.d.ts" />
import type { ArcgisChart } from "../components/arcgis-chart/customElement.js";
import type { ArcgisChartsActionBar } from "../components/arcgis-charts-action-bar/customElement.js";
import { HTMLAttributes } from "preact";
import type { EventHandler } from "@arcgis/lumina";

type ArcgisChartSetterTypes = ArcgisChart["@setterTypes"];
interface PreactArcgisChart extends Partial<Pick<ArcgisChart, "actionMode" | "allowUsingObjectIdStat" | "aria" | "autoDestroyDisabled" | "autoDisposeChart" | "autoInverseDataLabelTextColor" | "chartIndex" | "chartLimits" | "chartWillRender" | "cursorRange" | "dataLabelFormatter" | "disableTogglingLegendItems" | "enableAutoTheming" | "enableBetaFeatures" | "enableConfiguration" | "enableResponsiveFeatures" | "errorPolicy" | "featureIndex" | "filterByExtent" | "filterBySelection" | "gaugeInnerLabelFormatter" | "guideTooltipFormatter" | "hideEmptySeries" | "hideLicenseWatermark" | "hideLoaderAnimation" | "ignoreSmoothRenderingLimit" | "ignoreViewExtent" | "layer" | "layerFieldsChangePolicy" | "layerFilterChangePolicy" | "layerItemId" | "layerRendererChangePolicy" | "legendPosition" | "legendValueLabelFormatter" | "legendVisibility" | "loaderColors" | "messageOverrides" | "model" | "nullAsValid" | "placeholder" | "queueChartCreation" | "replaceNoValueCategoryWithZero" | "returnFeaturesExtent" | "returnSelectionIndexes" | "returnSelectionOIDs" | "rotation" | "runtimeDataFilters" | "secondaryYAxisLabelFormatter" | "selectionData" | "selectionTheme" | "setTimeBinningInfoWhenNotProvided" | "showUIMessages" | "syncSelection" | "syncSelectionsBetweenChartAndLayerViewPolicy" | "timeZone" | "tooltipFormatter" | "updateSplitBySeries" | "useAnimatedCharts" | "usePopupTemplateFieldsInfo" | "view" | "viewTimeExtentChangePolicy" | "xAxisLabelFormatter" | "yAxisLabelFormatter">>, ArcgisChartSetterTypes, HTMLAttributes<ArcgisChart> {
  onarcgisAxesMinMaxChange?: EventHandler<ArcgisChart["arcgisAxesMinMaxChange"]>;
  onarcgisBadDataWarningRaise?: EventHandler<ArcgisChart["arcgisBadDataWarningRaise"]>;
  onarcgisChartNotFoundWarning?: EventHandler<ArcgisChart["arcgisChartNotFoundWarning"]>;
  onarcgisConfigChange?: EventHandler<ArcgisChart["arcgisConfigChange"]>;
  onarcgisDataFetchComplete?: EventHandler<ArcgisChart["arcgisDataFetchComplete"]>;
  onarcgisDataProcessComplete?: EventHandler<ArcgisChart["arcgisDataProcessComplete"]>;
  onarcgisDataProcessError?: EventHandler<ArcgisChart["arcgisDataProcessError"]>;
  onarcgisInvalidConfigWarningRaise?: EventHandler<ArcgisChart["arcgisInvalidConfigWarningRaise"]>;
  onarcgisLegendItemVisibilityChange?: EventHandler<ArcgisChart["arcgisLegendItemVisibilityChange"]>;
  onarcgisNoRenderPropChange?: EventHandler<ArcgisChart["arcgisNoRenderPropChange"]>;
  onarcgisRenderingComplete?: EventHandler<ArcgisChart["arcgisRenderingComplete"]>;
  onarcgisRuntimeError?: EventHandler<ArcgisChart["arcgisRuntimeError"]>;
  onarcgisSelectionComplete?: EventHandler<ArcgisChart["arcgisSelectionComplete"]>;
  onarcgisSeriesColorChange?: EventHandler<ArcgisChart["arcgisSeriesColorChange"]>;
  onarcgisSeriesOrder?: EventHandler<ArcgisChart["arcgisSeriesOrder"]>;
  onarcgisUpdateComplete?: EventHandler<ArcgisChart["arcgisUpdateComplete"]>;
}

interface PreactArcgisChartsActionBar extends Partial<Pick<ArcgisChartsActionBar, "actionBarSelectionMode" | "chartElement" | "chartType" | "clearSelectionState" | "clearSelectionTitle" | "clearSelectionToggle" | "disableCSVExportForChartTypes" | "editChartState" | "editChartTitle" | "editChartToggle" | "expanded" | "exportActionState" | "exportAsCSVState" | "exportAsCSVTitle" | "exportAsImageState" | "exportAsImageTitle" | "filterByExtentState" | "filterByExtentTitle" | "filterByExtentToggle" | "filterBySelectionState" | "filterBySelectionTitle" | "filterBySelectionToggle" | "forceDisableActions" | "fullExtentState" | "fullExtentTitle" | "fullExtentToggle" | "hiddenActions" | "legendState" | "legendTitle" | "legendToggle" | "messageOverrides" | "rotateChartState" | "rotateChartTitle" | "rotateChartToggle" | "selectionState" | "selectionTitle" | "selectionToggle" | "switchSelectionState" | "switchSelectionTitle" | "switchSelectionToggle" | "zoomState" | "zoomTitle" | "zoomToggle">>, HTMLAttributes<ArcgisChartsActionBar> {
  onarcgisActionBarToggle?: EventHandler<ArcgisChartsActionBar["arcgisActionBarToggle"]>;
  onarcgisDefaultActionSelect?: EventHandler<ArcgisChartsActionBar["arcgisDefaultActionSelect"]>;
}

declare module 'preact' {
  namespace createElement.JSX {
    interface IntrinsicElements {
      "arcgis-chart": PreactArcgisChart;
      "arcgis-charts-action-bar": PreactArcgisChartsActionBar;
    }
  }
  namespace h.JSX {
    interface IntrinsicElements {
      "arcgis-chart": PreactArcgisChart;
      "arcgis-charts-action-bar": PreactArcgisChartsActionBar;
    }
  }
}