import { CellDataChangedInfo } from '../AdaptableState/Common/CellDataChangedInfo';
import { ActionColumnContext, AdaptableApi, AdaptableButton } from '../types';
/**
 * Options to manage the 'Data Change History Module', which provides an overview of all previous changes, giving the possibility to undo specific changes
 */
export interface DataChangeHistoryOptions<TData = any> {
    /**
     * Make Data Change History active by default
     *
     * @defaultValue false
     * @gridInfoItem
     * @noCodeItem
     */
    activeByDefault?: boolean;
    /**
     * Function specifying which data changes to include in Data Change History
     *
     * @defaultValue undefined (all data changes are logged)
     * @gridInfoItem
     */
    showDataChange?: (cellDataChangedInfo: CellDataChangedInfo<TData>) => boolean;
    /**
     * Action button definition; can be used to implement undo functionality
     *
     * @defaultValue undefined
     */
    changeHistoryButton?: DataChangeHistoryButton<TData> | DataChangeHistoryButton<TData>[];
    /**
     * Show all changes for a Cell or just the last one
     * @defaultValue true
     */
    showLastDataChangeOnly?: boolean;
}
/**
 * Built in `undo` or `clear` data change action
 */
export type AdaptableDataChangeHistoryAction = 'undo' | 'clear';
/**
 * The context for the DataChangeHistoryButton
 */
export interface DataChangeHistoryContext<TData = any> extends ActionColumnContext {
    /**
     * Helper function to undo the change.
     */
    undoDataChange: () => void;
    /**
     * Helper function to row from Grid
     */
    clearRow: () => void;
    /**
     * If the change references a group node.
     */
    isGroupNode: boolean;
    /**
     * The initial data change
     */
    dataChangedInfo: CellDataChangedInfo<TData>;
    /**
     * AdapTable API of underlying Grid (not from Data History Monitor)
     */
    parentAdapTableApi: AdaptableApi;
}
/**
 * A custom AdaptableButton which provides a build in `undo` action
 */
export interface DataChangeHistoryButton<TData = any> extends AdaptableButton<DataChangeHistoryContext<TData>> {
    action?: AdaptableDataChangeHistoryAction;
}
