import type * as React from 'react';
import type { RefObject } from '@mui/x-internals/types';
import type { GridEventListener, GridCallbackDetails, GridRowParams, GridRowId, GridValidRowModel, GridGroupNode, GridFeatureMode, GridListViewColDef, GridGetRowsError, GridUpdateRowError } from '@mui/x-data-grid';
import type { GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing, GridPinnedColumnFields, DataGridProSharedPropsWithDefaultValue, DataGridProSharedPropsWithoutDefaultValue } from '@mui/x-data-grid/internals';
import type { GridPinnedRowsProp } from "../hooks/features/rowPinning/index.js";
import type { GridApiPro } from "./gridApiPro.js";
import type { GridGroupingColDefOverride, GridGroupingColDefOverrideParams } from "./gridGroupingColDefOverride.js";
import type { GridInitialStatePro } from "./gridStatePro.js";
import type { GridProSlotsComponent } from "./gridProSlotsComponent.js";
import type { GridProSlotProps } from "./gridProSlotProps.js";
import type { GridDataSourcePro as GridDataSource, GridGetRowsParamsPro as GridGetRowsParams } from "../hooks/features/dataSource/models.js";
import type { ReorderValidationContext } from "../hooks/features/rowReorder/models.js";
import type { IsRowReorderableParams } from "../hooks/features/rowReorder/index.js";
export interface GridExperimentalProFeatures extends GridExperimentalFeatures {}
interface DataGridProPropsWithComplexDefaultValueBeforeProcessing extends Omit<DataGridPropsWithComplexDefaultValueBeforeProcessing, 'components'> {
  /**
   * Overridable components.
   */
  slots?: Partial<GridProSlotsComponent>;
}
/**
 * The props users can give to the `DataGridProProps` component.
 */
export interface DataGridProProps<R extends GridValidRowModel = any> extends Omit<Partial<DataGridProPropsWithDefaultValue<R>> & DataGridProPropsWithComplexDefaultValueBeforeProcessing & DataGridProPropsWithoutDefaultValue<R>, DataGridProForcedPropsKey> {}
interface DataGridProPropsWithComplexDefaultValueAfterProcessing extends Omit<DataGridPropsWithComplexDefaultValueAfterProcessing, 'slots'> {
  slots: GridProSlotsComponent;
}
/**
 * The props of the Data Grid Pro component after the pre-processing phase.
 */
export interface DataGridProProcessedProps<R extends GridValidRowModel = any> extends DataGridProPropsWithDefaultValue<R>, DataGridProPropsWithComplexDefaultValueAfterProcessing, Omit<DataGridProPropsWithoutDefaultValue<R>, 'componentsProps'> {}
export type DataGridProForcedPropsKey = 'signature';
/**
 * The Data Grid Pro options with a default value overridable through props
 * None of the entry of this interface should be optional, they all have default values and `DataGridProps` already applies a `Partial<DataGridSimpleOptions>` for the public interface
 * The controlled model do not have a default value at the prop processing level, so they must be defined in `DataGridOtherProps`
 */
export interface DataGridProPropsWithDefaultValue<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues<R>, DataGridProSharedPropsWithDefaultValue {
  /**
   * Set the area in `px` at the bottom of the grid viewport where onRowsScrollEnd is called.
   * If combined with `lazyLoading`, it defines the area where the next data request is triggered.
   * @default 80
   */
  scrollEndThreshold: number;
  /**
   * If `true`, the rows will be gathered in a tree structure according to the `getTreeDataPath` prop.
   * @default false
   */
  treeData: boolean;
  /**
   * If above 0, the row children will be expanded up to this depth.
   * If equal to -1, all the row children will be expanded.
   * @default 0
   */
  defaultGroupingExpansionDepth: number;
  /**
   * Determines if a group should be expanded after its creation.
   * This prop takes priority over the `defaultGroupingExpansionDepth` prop.
   * @param {GridGroupNode} node The node of the group to test.
   * @returns {boolean} A boolean indicating if the group is expanded.
   */
  isGroupExpandedByDefault?: (node: GridGroupNode) => boolean;
  /**
   * If `true`, the column pinning is disabled.
   * @default false
   */
  disableColumnPinning: boolean;
  /**
   * If `true`, the filtering will only be applied to the top level rows when grouping rows with the `treeData` prop.
   * @default false
   */
  disableChildrenFiltering: boolean;
  /**
   * If `true`, the sorting will only be applied to the top level rows when grouping rows with the `treeData` prop.
   * @default false
   */
  disableChildrenSorting: boolean;
  /**
   * Function that returns the height of the row detail panel.
   * @param {GridRowParams} params With all properties from [[GridRowParams]].
   * @returns {number | string} The height in pixels or "auto" to use the content height.
   * @default "() => 500"
   */
  getDetailPanelHeight: (params: GridRowParams) => number | 'auto';
  /**
   * If `true`, the reordering of rows is enabled.
   * @default false
   */
  rowReordering: boolean;
  /**
   * Loading rows can be processed on the server or client-side.
   * Set it to 'client' if you would like enable infnite loading.
   * Set it to 'server' if you would like to enable lazy loading.
   * @default "client"
   * @deprecated Use the {@link https://mui.com/x/react-data-grid/server-side-data/lazy-loading/#viewport-loading Server-side data-Viewport loading} instead.
   */
  rowsLoadingMode: GridFeatureMode;
  /**
   * If `true`, moving the mouse pointer outside the grid before releasing the mouse button
   * in a column re-order action will not cause the column to jump back to its original position.
   * @default false
   */
  keepColumnPositionIfDraggedOutside: boolean;
  /**
   * Used together with `dataSource` to enable lazy loading.
   * If enabled, the grid stops adding `paginationModel` to the data requests (`getRows`)
   * and starts sending `start` and `end` values depending on the loading mode and the scroll position.
   * @default false
   */
  lazyLoading: boolean;
  /**
   * If positive, the Data Grid will throttle data source requests on rendered rows interval change.
   * @default 500
   */
  lazyLoadingRequestThrottleMs: number;
  /**
   * If `true`, displays the data in a list view.
   * Use in combination with `listViewColumn`.
   */
  listView: boolean;
}
interface DataGridProRegularProps<R extends GridValidRowModel> {
  /**
   * Determines the path of a row in the tree data.
   * For instance, a row with the path ["A", "B"] is the child of the row with the path ["A"].
   * Note that all paths must contain at least one element.
   * @template R
   * @param {R} row The row from which we want the path.
   * @returns {string[]} The path to the row.
   */
  getTreeDataPath?: (row: R) => readonly string[];
  /**
   * Updates the tree path in a row model.
   * Used when reordering rows across different parents in tree data.
   * @template R
   * @param {string[]} path The new path for the row.
   * @param {R} row The row model to update.
   * @returns {R} The updated row model with the new path.
   */
  setTreeDataPath?: (path: string[], row: R) => R;
}
export interface DataGridProPropsWithoutDefaultValue<R extends GridValidRowModel = any> extends Omit<DataGridPropsWithoutDefaultValue<R>, 'initialState' | 'componentsProps' | 'slotProps' | 'dataSource' | 'onDataSourceError'>, DataGridProRegularProps<R>, DataGridProSharedPropsWithoutDefaultValue {
  /**
   * The ref object that allows grid manipulation. Can be instantiated with `useGridApiRef()`.
   */
  apiRef?: RefObject<GridApiPro | null>;
  /**
   * The initial state of the DataGridPro.
   * The data in it will be set in the state on initialization but will not be controlled.
   * If one of the data in `initialState` is also being controlled, then the control state wins.
   */
  initialState?: GridInitialStatePro;
  /**
   * Unstable features, breaking changes might be introduced.
   * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
   */
  experimentalFeatures?: Partial<GridExperimentalProFeatures>;
  /**
   * Callback fired when scrolling to the bottom of the grid viewport.
   * @param {GridRowScrollEndParams} params With all properties from [[GridRowScrollEndParams]].
   * @param {MuiEvent<{}>} event The event object.
   * @param {GridCallbackDetails} details Additional details for this callback.
   * @deprecated Use the {@link https://mui.com/x/react-data-grid/server-side-data/lazy-loading/#infinite-loading Server-side data-Infinite loading} instead.
   */
  onRowsScrollEnd?: GridEventListener<'rowsScrollEnd'>;
  /**
   * The column fields to display pinned to left or right.
   */
  pinnedColumns?: GridPinnedColumnFields;
  /**
   * Callback fired when the pinned columns have changed.
   * @param {GridPinnedColumnFields} pinnedColumns The changed pinned columns.
   * @param {GridCallbackDetails} details Additional details for this callback.
   */
  onPinnedColumnsChange?: (pinnedColumns: GridPinnedColumnFields, details: GridCallbackDetails) => void;
  /**
   * The grouping column used by the tree data.
   */
  groupingColDef?: GridGroupingColDefOverride<R> | ((params: GridGroupingColDefOverrideParams) => GridGroupingColDefOverride<R> | undefined | null);
  /**
   * The row ids to show the detail panel.
   */
  detailPanelExpandedRowIds?: Set<GridRowId>;
  /**
   * Callback fired when the detail panel of a row is opened or closed.
   * @param {GridRowId[]} ids The ids of the rows which have the detail panel open.
   * @param {GridCallbackDetails} details Additional details for this callback.
   */
  onDetailPanelExpandedRowIdsChange?: (ids: Set<GridRowId>, details: GridCallbackDetails) => void;
  /**
   * Function that returns the element to render in row detail.
   * @param {GridRowParams} params With all properties from [[GridRowParams]].
   * @returns {React.JSX.Element} The row detail element.
   */
  getDetailPanelContent?: (params: GridRowParams<R>) => React.ReactNode;
  /**
   * Callback fired when a row is being reordered.
   * @param {GridRowOrderChangeParams} params With all properties from [[GridRowOrderChangeParams]].
   * @param {MuiEvent<{}>} event The event object.
   * @param {GridCallbackDetails} details Additional details for this callback.
   */
  onRowOrderChange?: GridEventListener<'rowOrderChange'>;
  /**
   * Callback fired when rowCount is set and the next batch of virtualized rows is rendered.
   * @param {GridFetchRowsParams} params With all properties from [[GridFetchRowsParams]].
   * @param {MuiEvent<{}>} event The event object.
   * @param {GridCallbackDetails} details Additional details for this callback.
   * @deprecated Use the {@link https://mui.com/x/react-data-grid/server-side-data/lazy-loading/#viewport-loading Server-side data-Viewport loading} instead.
   */
  onFetchRows?: GridEventListener<'fetchRows'>;
  /**
   * Rows data to pin on top or bottom.
   */
  pinnedRows?: GridPinnedRowsProp<R>;
  /**
   * Overridable components props dynamically passed to the component at rendering.
   */
  slotProps?: GridProSlotProps;
  /**
   * Definition of the column rendered when the `listView` prop is enabled.
   */
  listViewColumn?: GridListViewColDef<R>;
  /**
   * The data source of the Data Grid Pro.
   */
  dataSource?: GridDataSource;
  /**
   * Callback fired when a data source request fails.
   * @param {GridGetRowsError | GridUpdateRowError} error The data source error object.
   */
  onDataSourceError?: (error: GridGetRowsError<GridGetRowsParams> | GridUpdateRowError) => void;
  /**
   * Indicates whether a row is reorderable.
   * @param {object} params With all properties from the row.
   * @param {R} params.row The row model of the row that the current cell belongs to.
   * @param {GridTreeNode} params.rowNode The node of the row that the current cell belongs to.
   * @returns {boolean} A boolean indicating if the row is reorderable.
   */
  isRowReorderable?: (params: IsRowReorderableParams) => boolean;
  /**
   * Indicates if a row reorder attempt is valid.
   * Can be used to disable certain row reorder operations based on the context.
   * The internal validation is still applied, preventing unsupported use-cases.
   * Use `isValidRowReorder()` to add additional validation rules to the default ones.
   * @param {ReorderValidationContext} context The context object containing all information about the reorder operation.
   * @returns {boolean} A boolean indicating if the reorder operation should go through.
   */
  isValidRowReorder?: (context: ReorderValidationContext) => boolean;
}
export {};