import { Observable } from 'rxjs';
import { QdBreakpoint } from '../../core/model/breakpoint.interface';
import { QdSortDirection } from './sort-direction.enum';
import { QdTableConfigGroup, QdTableConfigSelection, QdTablePrimaryAction, QdTableSecondaryAction } from './table-config-actions.interface';
import { QdTableConfigColumnType } from './table-config-content.interface';
/**
 * Describes which column is filling the table's width.
 * In "harmonized" mode the whitespace will be distributed evenly, considering the width of each column.
 */
export type QdTableFillingColumn = 'main' | 'last' | 'harmonized' | 'none';
/**
 * Optional Events for triggering a table refresh.
 */
export type QdTableOptionalRefreshingEventTypes = 'RESOURCE_CREATED' | 'RESOURCE_DELETED';
/**
 * @description Configuration Model for Qd-Tables. The generic type defines the table columns keys.
 */
export interface QdTableConfig<T extends string> {
    /**
     * @description Defines the columns of the table.
     */
    columns: QdTableConfigColumn<T>[];
    /**
     * @description Configures the behavior of the groups in the tree view.
     * @deprecated use qd-tree instead
     */
    group?: QdTableConfigGroup;
    /**
     * @description Activates a pagination
     *
     * * @default: false
     * * @deprecated
     */
    hasPagination?: boolean;
    /**
     * @description Activates a pagination with configurable available page sizes
     */
    pagination?: true | QdTablePagination;
    /**
     * @description Sets an alternative view if no elements are available in QdTableData
     */
    emptyStateView?: QdTableEmptyStateView;
    /**
     * @description Defines a list of secondary actions that can be executed per Click/Tab of an item in the menu.
     *
     * * @example
     * This is how the two actions "edit" and "delete" are created.
     * ```ts
     * secondaryActions: [
     *    {
     *      type: 'edit',
     *      handler: rowData => doSomethingWith(rowData)
     *    },
     *    {
     *      type: 'delete',
     *      isDisabled: true,
     *      handler: rowData => doSomethingWith(rowData)
     *    }
     * ]
     * ```
     */
    secondaryActions?: QdTableSecondaryAction<T>[];
    /**
     * @description Defines the primary action that can be executed by clicking on a row.
     *
     * @example
     * You provide a primary action like this.
     * ``ts
     * primaryAction: {
     *   handler: row => openModal(row)
     * }
     */
    primaryAction?: QdTablePrimaryAction<T>;
    /**
     * @description Configures selection options for table rows.
     *
     * * @example
     * This creates a "multiSelect".
     * ```ts
     * selection: {
     *    type: 'multiSelect',
     *    handler: selectedRows => doSomethingWith(selectedRows)
     * }
     * ```
     */
    selection?: QdTableConfigSelection<T>;
    /**
     * @description Sets the translation keys (plural) for the table headings and more, as the 'context' for instance.
     *
     * * @example: "i18n.my.table.<column>".
     *
     * If none exits, the value is rendered without translation.
     */
    i18ns?: string;
    /**
     * @description Turns a specified column into a main column. Main Columns have different presentation properties.
     *
     * * @default: columns[0].column
     */
    mainColumn?: T;
    /**
     * @description By default the main column fills the remaining width so that the table has a width of 100%.
     * By setting this property the main column will have content width.
     *
     * * @default: false
     * * @deprecated
     */
    mainColumnNotFillingWidth?: boolean;
    /**
     * @description Usually the table fills 100% of the width.
     *
     * This value defines which column fills the space in the table to its full width.
     * In "harmonized" mode the whitespace will be distributed evenly, considering the width of each column.
     * If the value "none" is used, the table can be less than 100% in width.
     *
     * Find out more in the related type "QdTableConfig<T>['mainColumn']".
     *
     * * @default: 'main'
     */
    whichColumnFillsWidth?: QdTableFillingColumn;
    /**
     * @description Enables "viewonly" mode for the table.
     *
     * When set to `true`, the table displays its content as read-only.
     * Combined with `secondaryActions`, this can be used to selectively show or hide secondary actions
     * based on the operation mode (`'view'` or `'edit'`) used in the Quadrel framework.
     *
     * * If `viewonly` is explicitly set, it overrides the global operation mode
     * (which is normally controlled through external events).
     * This gives you full control: for example, setting `viewonly: false` will allow edit actions to be shown,
     * even if the global mode would normally hide them.
     *
     * * @default false
     */
    viewonly?: boolean;
    /**
     * @description Sets the maximum number of columns over the breakpoints.
     *
     * * @default: { xs: 1, sm: 2, md: 4, lg: 6, xl: 8, xxl: 10 }
     *
     * * @example
     * ```ts
     * { xs: 1, sm: 2, md: 4, lg: 6, xl: 8, xxl: 10 }
     * ```
     */
    columnMapping?: {
        [key in QdBreakpoint]?: QdMaxColumnsCount;
    };
    /**
     * @description Observable to trigger a table refresh from outside.
     *
     * - `number` sets the page index to refresh.
     * - `undefined` triggers a general refresh (current page stays the same).
     *
     * @example
     * ```ts
     * refresh$.next();      // refresh current page
     * refresh$.next(0);     // refresh and go to first page
     * ```
     */
    refresh?: Observable<number | undefined>;
    /**
     * @description Determines if the table should refresh when the language is changed.
     *
     * * @default: false
     */
    refreshOnLanguageChange?: boolean;
    /**
     * @description When this flag is set, the table will be refreshed for every RESOURCE_UPDATED event
     * with a path that matches the table uid.
     * Important: You have to create the connection to the SSE backend service on your own with the QdPushEventsService
     * (connect method).
     */
    refreshOnPushEvent?: boolean;
    /**
     * @description An optional list of event types that can trigger a refresh of the QdTable component.
     * By default, the table listens for the `RESOURCE_UPDATED` event. Additional events
     * specified in this property will be considered as extra triggers for updating the
     * table view. If defined, the table will respond to both the default and these
     * additional events to ensure that the displayed data remains up-to-date.
     */
    refreshingEvents?: QdTableOptionalRefreshingEventTypes[];
    /**
     * @description Sets a unique identifier for the table. Used as key to hold in NgRx store.
     *
     * * @default: random RFC 4122 Identifier
     */
    uid?: string;
}
interface QdTableConfigColumnBase<T> {
    /**
     * @description Defines the key of the column.
     */
    column: T;
    /**
     * @description Makes the column sortable. If this key has been defined, the sorting will be turned on.
     */
    sort?: QdTableConfigColumnSort;
    /**
     * @description Defines the breakpoint at which the column is hidden. Use for mobile devices.
     */
    hiddenAt?: QdBreakpoint;
}
/**
 * @description Configuration for sorting
 */
export interface QdTableConfigColumnSort {
    /**
     * @description Sorting can be deactivated here.
     *
     * * @default: false
     */
    isDisabled?: boolean;
    /**
     * @description The direction of sorting.
     *
     * * @default: QdSortDirection.NONE
     */
    direction?: QdSortDirection;
}
/**
 * @description Maximum number of columns depending on the current breakpoint.
 *
 * * @default: { xs: 1, sm: 2, md: 4, lg: 6, xl: 8, xxl: 10 }
 */
type QdMaxColumnsCount = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
export type QdTableConfigColumn<T> = QdTableConfigColumnType & QdTableConfigColumnBase<T>;
/**
 * @description Configuration model for pagination
 */
export interface QdTablePagination {
    /**
     * @description Initial pagination page size
     *
     * * @default 25
     */
    pageSizeDefault?: number;
    /**
     * @description List of available pagination page sizes
     *
     * * @example [25, 50, 100]
     */
    pageSizes?: number[];
    /**
     * @description Activates the first & last buttons for quick navigation
     *
     * * @default: false
     */
    hasFirstLastPageNavigation?: boolean;
}
/**
 * @description Configuration model for empty state view
 */
export interface QdTableEmptyStateView {
    /**
     * @description Toggles the empty view off, if set to "true".
     *
     * * @default: false
     */
    disabled?: boolean;
    /**
     * @description Renders a call-to-action button.
     *
     * * @default: false
     */
    action?: boolean;
    /**
     * @description Defines a handler that is triggered by a click/tap on the call-to-action button.
     * Will only be triggered if "action" is set to "true
     */
    handler?: () => void;
    /**
     * @description Optional internationalization configuration parameter.
     *
     * This object specifies a key-value pair used for dynamic translations
     * within the component. It allows developers to set a custom parameter
     * name and corresponding value that is injected into translation string.
     *
     */
    i18nParameter?: {
        /**
         * @description The placeholder name in the translation string.
         * This corresponds to the key used within translation resources.
         */
        name: string;
        /**
         * @description The value to replace the placeholder with in the translated output
         */
        value: string;
    };
}
export {};
//# sourceMappingURL=table-config.interface.d.ts.map