import { AlertDefinition } from '../PredefinedConfig/AlertState';
import { CustomSort } from '../PredefinedConfig/CustomSortState';
import { FlashingCellDefinition } from '../PredefinedConfig/FlashingCellState';
import { FormatColumn } from '../PredefinedConfig/FormatColumnState';
import { PlusMinusNudge } from '../PredefinedConfig/PlusMinusState';
import { Shortcut } from '../PredefinedConfig/ShortcutState';
import { StyledColumn } from '../PredefinedConfig/StyledColumnState';
import { BaseSchedule } from '../PredefinedConfig/Common/Schedule';
import { Layout } from '../PredefinedConfig/LayoutState';
import { AdaptableModule } from '../PredefinedConfig/Common/Types';
import { AdaptableObjectTag } from '../PredefinedConfig/Common/AdaptableObject';
import { BaseContext } from '../../types';
/**
 * Options for configuring Layouts; these manage Column visibility, order, sorting, grouping and width
 *
 */
export interface LayoutOptions {
    /**
     * Whether Row Groups display all as expanded, all as closed or dynamically (i.e. saved in Layout)
     * @defaultValue 'closed'
     * @gridInfoItem
     */
    displayRowGroups?: DisplayRowGroups;
    /**
     * Layouts save whenever Grid's column / sort info changes; if false, a Save button will display
     *
     * @defaultValue true
     * @gridInfoItem
     * @noCodeItem
     */
    autoSaveLayouts?: boolean;
    /**
     * Columns auto-size when Layout loads for first time
     *
     * @defaultValue false
     * @gridInfoItem
     * @noCodeItem
     */
    autoSizeColumnsInLayout?: boolean;
    /**
     * Columns auto-size when Pivot Layout loads first time (overriding Layout width properties)
     *
     * @defaultValue false
     * @gridInfoItem
     * @noCodeItem
     */
    autoSizeColumnsInPivotLayout?: boolean;
    /**
     * Whether a "Default Layout" will be created in addition to Layouts provided in Config
     *
     * @defaultValue false
     * @gridInfoItem
     */
    createDefaultLayout?: boolean;
    /**
     * Customize how Layouts are displayed in Settings Panel
     */
    layoutViewOptions?: LayoutViewOptions;
    /**
     * Options for leveraging Object Tags to extend Layouts
     */
    layoutTagOptions?: LayoutTagOptions;
    /**
     * Columns displayed in Table that opens when viewing contents of Pivot Cells
     */
    pivotPreviewColumns?: string[] | ((context: PivotPreviewColumnsContext) => string[]);
}
/**
 * Options for managing Tags in Layouts (used to enhance Layouts)
 */
export interface LayoutTagOptions {
    /**
     * Automatically generate an AdaptableObjectTag for each Layout
     *
     * @defaultValue false
     */
    autoGenerateTagsForLayouts?: boolean | ((context: AutoGenerateTagsForLayoutsContext) => AdaptableObjectTag[]);
    /**
     * Automatically assumes that any `LayoutAssociatedObject` is available in the current Layout if it has a tag with the Layouts name (or no tags at all)
     *
     * @defaultValue false
     */
    autoCheckTagsForLayouts?: boolean;
    /**
     * Checks if the provided Adaptable Object is available in the given Layout
     *
     * @defaultValue undefined
     */
    isObjectAvailableInLayout?: (layoutAvailableContext: LayoutAvailableContext) => boolean;
}
/**
 * Customize how Layouts are displayed in Settings Panel
 */
export interface LayoutViewOptions {
    /**
     * How many Column Names to display in inline Layout preview
     *
     * @defaultValue 10
     */
    maxColumnsToDisplay?: number;
}
/**
 * Context for `LayoutOptions.isObjectAvailableInLayout` functions
 */
export interface LayoutAvailableContext extends BaseContext {
    /**
     * Object being checked
     */
    adaptableObject: LayoutAssociatedObject;
    /**
     * Current Adaptable Module
     */
    module: AdaptableModule;
    /**
     * Current Layout
     */
    layout: Layout;
}
/**
 * Types of Adaptable Objects that can be associated with a Layout
 */
export type LayoutAssociatedObject = AlertDefinition | CustomSort | FlashingCellDefinition | FormatColumn | PlusMinusNudge | StyledColumn | Shortcut | BaseSchedule;
/**
 * Context for `LayoutOptions.autoGenerateTagsForLayouts` method
 */
export interface AutoGenerateTagsForLayoutsContext extends BaseContext {
    /**
     * Layouts currently in Adaptable State
     */
    layouts: Layout[];
    /**
     * Object Tags provided in User Interface Options
     */
    objectTags: AdaptableObjectTag[];
}
/**
 * Context uses for pivotPreviewColumns function in Layout Options
 */
export interface PivotPreviewColumnsContext extends BaseContext {
    /**
     * Current Layout
     */
    layout: Layout;
    /**
     * Column being opened
     */
    columnId: string;
}
/**
* How Row Groups are displayed
*/
export type DisplayRowGroups = 'dynamic' | 'expanded' | 'closed';
