import { QdTreeDataRow } from '../model/tree-data.interface';
import { Observable } from 'rxjs';
import { QdTableRecentSecondaryAction } from '../../table/model/table-data.interface';
/**
 * @description Defines an secondary action that is shown in the menu. Can be disabled.
 */
export interface QdTreeSecondaryAction<T extends string> {
    /**
     * @description Defines the secondary action type for the tree.
     */
    type: QdTreeConfigSecondaryActionType;
    /**
     * @description Hides the secondary action
     */
    isHidden?: boolean | ((row: QdTreeDataRow<T>) => boolean);
    /**
     * @description Function executed when the action is triggered.
     *
     * - Accepts row data and its index.
     * - Returns `void` for synchronous actions or `Observable<boolean>` for asynchronous ones.
     *
     * Example:
     * ```typescript
     * handler: ({ rowData, index }) => of(true); // Action succeeded
     * ```
     */
    handler?: (selectedRow: QdTableRecentSecondaryAction<T>) => QdTreeActionResult;
    /**
     * @description Controls in which operation mode this action is shown. May be set by the Quadrel Framework ('edit' or 'view').
     *
     * - Use `'edit'` to show the action only in editable mode.
     * - Use `'view'` to show the action only in viewonly mode.
     * - If not set, the action is shown in **both modes**.
     *
     * **Note:** The `viewonly` flag in the table configuration overrides any external operation mode.
     *
     * * @example
     * ```ts
     * {
     *   type: 'edit',
     *   operationMode: 'edit',
     *   handler: ...
     * }
     * ```
     */
    operationMode?: 'edit' | 'view';
}
export type QdTreeConfigSecondaryActionType = 'edit' | 'delete' | 'view' | string;
/**
 * @description Defines the result of a table action handler.
 *
 * - **`void`**: For synchronous actions.
 * - **`Observable<boolean>`**: For asynchronous actions:
 *   - Emits **`true`** if the action succeeds.
 *   - Emits **`false`** if the action fails or is canceled.
 */
export type QdTreeActionResult = void | Observable<boolean>;
//# sourceMappingURL=tree-config-actions.interface.d.ts.map