/**
 * Sort Utilities
 *
 * Provides functions for sorting items within collections.
 * Can be used by routes and extensions.
 */
export interface SortOptions {
    /**
     * Collection name
     */
    collection: string;
    /**
     * ID of the item to move
     */
    item: string | number;
    /**
     * ID of the target item to move before/after
     */
    to: string | number;
    /**
     * Position mode: 'before' places item before target, 'after' places item after target
     * @default 'before'
     */
    mode?: 'before' | 'after';
    /**
     * Accountability object from request (for permission checks)
     * If not provided, bypassPermissions must be true
     */
    accountability?: {
        user?: any;
        role?: any;
        roles?: string[];
        permissions?: any[];
        tenant?: string | number | null;
    };
    /**
     * Whether to skip permission checks (for internal use)
     * @default false
     */
    bypassPermissions?: boolean;
    /**
     * Database transaction to use
     */
    transaction?: any;
}
export interface SortResult {
    item: string | number;
    collection: string;
    newSort: number;
}
/**
 * Sort an item within a collection by moving it before another item.
 * This updates the sort field of the target item and all items after it.
 *
 * @example
 * ```typescript
 * import { sortItems } from '@baasix/utils';
 *
 * // Move item 'abc' before item 'xyz' in the 'tasks' collection
 * const result = await sortItems({
 *   collection: 'tasks',
 *   item: 'abc',
 *   to: 'xyz',
 *   accountability: req.accountability, // Pass accountability for permission checks
 * });
 *
 * // Or bypass permissions for internal operations
 * const result = await sortItems({
 *   collection: 'tasks',
 *   item: 'abc',
 *   to: 'xyz',
 *   bypassPermissions: true,
 * });
 * ```
 */
export declare function sortItems(options: SortOptions): Promise<SortResult>;
/**
 * Reorder items in a collection by setting their sort values in order.
 * Useful for bulk reordering operations.
 *
 * @example
 * ```typescript
 * import { reorderItems } from '@baasix/utils';
 *
 * // Reorder items in the specified order
 * await reorderItems({
 *   collection: 'tasks',
 *   items: ['id1', 'id2', 'id3'], // Items will be sorted in this order
 * });
 * ```
 */
export declare function reorderItems(options: {
    collection: string;
    items: (string | number)[];
    startSort?: number;
    transaction?: any;
}): Promise<void>;
/**
 * Get the next available sort value for a collection.
 * Useful when adding new items to the end of a sorted list.
 *
 * @example
 * ```typescript
 * import { getNextSortValue } from '@baasix/utils';
 *
 * const nextSort = await getNextSortValue('tasks');
 * // Use nextSort when creating a new item
 * ```
 */
export declare function getNextSortValue(collection: string, transaction?: any): Promise<number>;
declare const _default: {
    sortItems: typeof sortItems;
    reorderItems: typeof reorderItems;
    getNextSortValue: typeof getNextSortValue;
};
export default _default;
//# sourceMappingURL=sortUtils.d.ts.map