import { ChartModel, ChartRef, Column, GridApi, GridOptions, IRowNode, Module, RowModelType, StatusPanelDef } from 'ag-grid-enterprise';
import { AdaptableApi, DestroyConfig } from '../Api/AdaptableApi';
import { AdaptableColumn } from '../AdaptableState/Common/AdaptableColumn';
import { ColumnSort } from '../AdaptableState/Common/ColumnSort';
import { DataRowConfig, DataUpdateConfig } from '../AdaptableState/Common/DataUpdateConfig';
import { Layout } from '../AdaptableState/LayoutState';
import { GridCell, GridCellWithChildren } from '../AdaptableState/Selection/GridCell';
import { SelectedCellInfo } from '../AdaptableState/Selection/SelectedCellInfo';
import { AdaptableTheme } from '../AdaptableState/ThemeState';
import { IAdaptableStore } from '../Redux/Store/Interface/IAdaptableStore';
import { IModuleCollection } from '../Strategy/Interface/IModule';
import { AdaptableMenuItem, AdaptableOptions, AdaptablePlugin, AdaptableState, ChartDefinition, InFilterValueResult, SelectedRowInfo } from '../types';
import { ICalculatedColumnExpressionService } from '../Utilities/Services/Interface/ICalculatedColumnExpressionService';
import { IDataService } from '../Utilities/Services/Interface/IDataService';
import { AnnotationsService } from '../Utilities/Services/AnnotationsService';
import { IValidationService } from '../Utilities/Services/Interface/IValidationService';
import { IModuleService } from '../Utilities/Services/Interface/IModuleService';
import { ContextMenuContext } from '../AdaptableState/Common/Menu';
import { IQueryLanguageService } from '../Utilities/Services/Interface/IQueryLanguageService';
import { IAlertService } from '../Utilities/Services/Interface/IAlertService';
import { ITeamSharingService } from '../Utilities/Services/Interface/ITeamSharingService';
import { AdaptableFrameworkComponent } from '../agGrid/AdaptableFrameworkComponent';
import { IMetamodelService } from '../Utilities/Services/Interface/IMetamodelService';
import { RenderReactRootFn } from '../renderReactRoot';
import { AdaptableLogger } from '../agGrid/AdaptableLogger';
import { Fdc3Service } from '../Utilities/Services/Fdc3Service';
import { AgGridAdapter } from '../agGrid/AgGridAdapter';
import { AgGridColumnAdapter } from '../agGrid/AgGridColumnAdapter';
import { AgGridMenuAdapter } from '../agGrid/AgGridMenuAdapter';
import { RowFormService } from '../Utilities/Services/RowFormService';
import { FlashingCellService } from '../Utilities/Services/FlashingCellService';
import { AgGridExportAdapter } from '../agGrid/AgGridExportAdapter';
import { AgGridThemeAdapter } from '../agGrid/AgGridThemeAdapter';
import { PivotLayoutModel, TableLayoutModel } from '../layout-manager/src/LayoutManagerModel';
import { AgGridModulesAdapter } from '../agGrid/AgGridModulesAdapter';
import { EditColumnValueInfo } from '../AdaptableOptions/EditOptions';
import { IThemeService } from '../Utilities/Services/Interface/IThemeService';
/**
 * Contains AG Grid Options and Modules - used when instantiating AdapTable vanilla
 */
export interface AgGridConfig {
    /**
     * AG Grid GridOptions object
     */
    gridOptions: GridOptions;
    /**
     * AG Grid Modules to use; provide empty array if using CJS
     */
    modules: Module[];
}
export type AdaptableVariant = 'vanilla' | 'react' | 'angular' | 'vue';
/**
 *  The only interface for Adaptable
 *
 *  Contains all properties and methods that each implemenation must include
 *
 * Should only be used internally as all external access is via the Api
 */
export interface IAdaptable {
    logger: AdaptableLogger;
    variant: AdaptableVariant;
    isReady: boolean;
    isDestroyed: boolean;
    isAgGridInitialising: boolean;
    api: AdaptableApi;
    adaptableOptions: AdaptableOptions;
    adaptableStore: IAdaptableStore;
    adaptableModules: IModuleCollection;
    agGridAdapter: AgGridAdapter;
    agGridMenuAdapter: AgGridMenuAdapter;
    agGridColumnAdapter: AgGridColumnAdapter;
    agGridExportAdapter: AgGridExportAdapter;
    agGridThemeAdapter: AgGridThemeAdapter;
    agGridModulesAdapter: AgGridModulesAdapter;
    hasAdaptableToolPanel: boolean;
    renderReactRoot: RenderReactRootFn;
    /**
     * Adaptable contains a number of 'Services' which are created at Startup
     *
     * Each takes an instance of Adaptable and is used when it is preferable to accessing a Module directly
     */
    DataService: IDataService;
    ValidationService: IValidationService;
    CalculatedColumnExpressionService: ICalculatedColumnExpressionService;
    ModuleService: IModuleService;
    QueryLanguageService: IQueryLanguageService;
    AlertService: IAlertService;
    TeamSharingService: ITeamSharingService;
    MetamodelService: IMetamodelService;
    RowFormService: RowFormService;
    Fdc3Service: Fdc3Service;
    AnnotationsService: AnnotationsService;
    FlashingCellService: FlashingCellService;
    ThemeService: IThemeService;
    _PRIVATE_adaptableJSXElement: React.JSX.Element;
    /**
     * INTERNAL ADAPTABLE EVENTS
     * These are not called externally - for that we use eventapi
     */
    _on(eventName: 'CellsSelected', callback: () => void): () => void;
    _on(eventName: 'GridRefreshed', callback: () => void): () => void;
    _on(eventName: 'AdapTableFiltersApplied', callback: () => void): () => void;
    _on(eventName: 'KeyDown', callback: (keyDownEvent: any) => void): () => void;
    _on(eventName: 'MouseEnter', callback: (event: MouseEvent) => void): () => void;
    _on(eventName: 'MouseLeave', callback: (event: MouseEvent) => void): () => void;
    _on(eventname: 'FirstDataRendered', callback: () => void): () => void;
    _on(eventName: 'CellEditorKeyDown', callback: (param: {
        keyDownEvent: KeyboardEvent;
        cellValue: any;
        columnId: string;
        updateValueCallback: (updatedValue: any) => void;
    }) => void): () => void;
    _onIncludeFired(eventName: 'FrameworkComponentChange', callback: (param: {
        command: 'create' | 'destroy';
        containerDomNode: HTMLElement;
        frameworkComponent: AdaptableFrameworkComponent;
        componentType: string;
    }) => void): () => void;
    _on(eventName: 'CreateAdaptableContextMenuItems', callback: (param: {
        items: AdaptableMenuItem[];
        menuContext: ContextMenuContext;
    }) => void): () => void;
    _emit(eventName: 'CellEditorKeyDown', data: {
        keyDownEvent: KeyboardEvent;
        cellValue: any;
        columnId: string;
        updateValueCallback: (updatedValue: any) => void;
    }): Promise<any>;
    _emitSync(eventName: 'FrameworkComponentChange', data: {
        command: 'create' | 'destroy';
        containerDomNode: HTMLElement;
        frameworkComponent: AdaptableFrameworkComponent;
        componentType: string;
    }): Promise<any>;
    _emitSync(eventName: 'CreateAdaptableContextMenuItems', data?: any): Promise<any>;
    /**
     *
     */
    getAgGridContainerElement(): HTMLElement | null;
    redrawBody(): void;
    refreshHeader(): void;
    redrawRow(rowNode: IRowNode): void;
    redrawRows(rowNodes?: IRowNode[]): void;
    refreshCell(rowNode: IRowNode, column: string | any, forceUpdate: boolean, suppressFlash?: boolean): void;
    refreshCells(rowNode: IRowNode, columns: (string | any)[], forceUpdate: boolean, suppressFlash?: boolean): void;
    refreshAllCells(forceUpdate?: boolean): void;
    refreshColumns(columns: (string | Column)[], forceUpdate: boolean, suppressFlash?: boolean): void;
    refreshGridHeader(): void;
    refreshSelectedCellsState(): SelectedCellInfo | undefined;
    refreshSelectedRowsState(): SelectedRowInfo | undefined;
    selectColumn(columnId: string, config?: {
        keepExistingSelection?: boolean;
    }): void;
    selectColumns(columnIds: string[], config?: {
        keepExistingSelection?: boolean;
    }): void;
    selectAll(): void;
    deselectAll(): void;
    selectNodes(rowNodes: IRowNode[], clearSelection: boolean): void;
    deSelectNodes(rowNodes: IRowNode[], clearSelection: boolean): void;
    selectNode(rowNode: IRowNode, clearSelection: boolean): void;
    deSelectNode(rowNode: IRowNode, clearSelection: boolean): void;
    selectCells(columnIds: string[], startNode: IRowNode, endNode: IRowNode, clearSelection?: boolean): void;
    jumpToRow(rowNode: IRowNode): void;
    jumpToColumn(columnId: string): void;
    jumpToCell(columnId: string, rowNode: IRowNode): void;
    setGridData(dataSource: any): void;
    getGridData(): any[];
    getFilteredData(): any[];
    updateRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<IRowNode[]>;
    addRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<IRowNode[]>;
    addOrUpdateRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<{
        added: IRowNode[];
        updated: IRowNode[];
    }>;
    deleteRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<IRowNode[]>;
    manageGridRows(dataRowConfig: DataRowConfig, dataUpdateConfig?: DataUpdateConfig): Promise<{
        addedRows: IRowNode[];
        updatedRows: IRowNode[];
        removedRows: IRowNode[];
    }>;
    getPrimaryKeyValueFromRowNode(rowNode: IRowNode, gridApi?: GridApi): any;
    getDistinctGridCellsForGroupedColumn(): GridCellWithChildren[];
    getDistinctGridCellsForColumn(column: AdaptableColumn): GridCell[];
    getDistinctValuesForColumn(column: AdaptableColumn): Promise<GridCell[]>;
    getDistinctEditValuesForColumn(options: {
        column: AdaptableColumn;
        gridCell?: GridCell;
        currentSearchValue: string;
    }): Promise<EditColumnValueInfo[]>;
    getDistinctFilterValuesForColumn(options: {
        column: AdaptableColumn;
        currentSearchValue: string;
        previousResult: InFilterValueResult | undefined;
    }): Promise<InFilterValueResult>;
    getGridCellFromRowNode(rowNode: IRowNode, columnId: string): GridCell | undefined;
    getRawValueFromRowNode(rowNode: IRowNode, columnId: string): any;
    getDisplayValueFromRowNode(rowNode: IRowNode, columnId: string): string | undefined;
    getDisplayValueFromRawValue(rowNode: IRowNode, columnId: string, rawValue: any): string | undefined;
    getNormalisedValueFromRawValue(rawValue: any, column: AdaptableColumn): string | number | boolean | Date | unknown;
    getGridCellsForColumn(columnId: string, onlyVisibleRows?: boolean): GridCell[] | undefined;
    getRowNodesForPrimaryKeys(primaryKeyValues: any[]): IRowNode[];
    getRowNodeForPrimaryKey(primaryKeyValue: any): IRowNode;
    getRowNodeByIndex(index: number): IRowNode;
    getAgGridStatusPanels(): StatusPanelDef[];
    forPlugins(callback: (plugin: AdaptablePlugin) => any): void;
    getPluginProperty(pluginId: string, propertyName: string, ...args: any): any;
    getPlugin(pluginId: string): AdaptablePlugin;
    setDataValue(value: any, column: AdaptableColumn, primaryKeyValue: any, rowNode?: IRowNode): void;
    getFirstRowNode(): IRowNode | undefined;
    getFirstDisplayedRowNode(): IRowNode | undefined;
    forAllRowNodesDo(func: (rowNode: IRowNode) => void, config?: {
        includeGroupRows?: boolean;
        filterFn?: (rowNode: IRowNode) => boolean;
    }): void;
    forAllVisibleRowNodesDo(func: (rowNode: IRowNode, rowIndex: number) => void, config?: {
        includeGroupRows?: boolean;
        filterFn?: (rowNode: IRowNode) => boolean;
    }): void;
    getAllRowNodes(config?: {
        includeGroupRows?: boolean;
        filterFn?: (rowNode: IRowNode) => boolean;
    }): IRowNode[];
    getGroupRowNodes(config?: {
        filterFn?: (rowNode: IRowNode) => boolean;
    }): IRowNode[];
    updateRowGroupsAndColumnGroupsExpandedState(layout?: Layout): void;
    getRowsInViewport(): IRowNode[];
    isGroupRowNode(rowNode: IRowNode): boolean;
    isRowNodeVisible(rowNode: IRowNode): boolean;
    isGrandTotalRowNode(rowNode: IRowNode): boolean;
    getAgGridColumnType(columnId: string): string | string[];
    hideColumn(columnId: string): void;
    showColumn(columnId: string): void;
    autoSizeColumn(columnId: string): void;
    autoSizeColumns(columnIds: string[]): void;
    autoSizeAllColumns(): void;
    setColumnSort(columnSorts: ColumnSort[]): void;
    clearColumnSort(): void;
    clearColumnFiltering(): void;
    clearColumnFilteringForColumns(columnIds: string[]): void;
    applyFiltering(config?: {
        updateColumnFilterModel?: boolean;
    }): void;
    showQuickFilter(): void;
    hideQuickFilter(): void;
    showAdaptableToolPanel(): void;
    hideAdaptableToolPanel(): void;
    showAdaptableStatusBar(): void;
    hideAdaptableStatusBar(): void;
    isQuickFilterAvailable(): boolean;
    setAgGridQuickSearch(query: string): void;
    clearAgGridQuickSearch(): void;
    setAgGridFindSearchValue(searchText: string): void;
    canGenerateCharts(): boolean;
    canDisplaySparklines(): boolean;
    showCharts(charts: ChartDefinition[]): ChartRef[];
    showChart(chart: ChartDefinition, container?: HTMLElement): ChartRef;
    getChartRef(chardId: string): ChartRef;
    updateChart(chart: ChartDefinition): void;
    getChartModels(): ChartModel[];
    getAgGridRowModelType(): RowModelType;
    getRowCount(): number;
    getVisibleRowCount(): number;
    getColumnCount(): number;
    getVisibleColumnCount(): number;
    isGridRangeSelectable(): boolean;
    isGridRowSelectable(): boolean;
    isGridGroupingActive(): boolean;
    isInPivotMode(): boolean;
    applyAdaptableTheme(theme: AdaptableTheme | string): void;
    setRowGroupColumns(columnIds: string[]): void;
    getAllGridColumns(): Column<any>[];
    clearRowGroupColumns(): void;
    expandAllRowGroups(): void;
    collapseAllRowGroups(): void;
    expandRowGroupsForValues(columnValues: any[]): void;
    getAdaptableContainerElement(): HTMLElement | null;
    getAgGridContainerElement(): HTMLElement | null;
    updateColumnModelAndRefreshGrid(): void;
    getAgGridColumnForColumnId(columnId: string): Column;
    getMinMaxCachedValueForColumn(column: AdaptableColumn, minMax: 'min' | 'max'): number | undefined;
    destroy(config?: DestroyConfig): void;
    updateLayoutInManagerAfterStoreHasChanged(layout?: Layout): void;
    canExportToExcel(): boolean;
    canExportToCsv(): boolean;
    silentUpdateCurrentLayoutModel(layoutModel?: TableLayoutModel | PivotLayoutModel): void;
    normalizeAdaptableState(state: AdaptableState, options: NormalizeAdaptableStateOptions): AdaptableState;
    refreshLayout(): void;
}
export type NormalizeAdaptableStateOptions = Pick<GridOptions, 'rowModelType' | 'treeData' | 'columnDefs' | 'autoGroupColumnDef'>;
