/**
 * Basic Queue Implementation
 *
 * A generic FIFO queue with async processing support.
 * Provides enqueue, dequeue, peek, and batch operations.
 */
import { EventEmitter } from 'events';
export interface QueueItem<T> {
    id: string;
    data: T;
    enqueuedAt: Date;
    attempts: number;
    lastAttemptAt?: Date;
    metadata?: Record<string, unknown>;
}
export interface QueueOptions {
    /** Maximum items in queue */
    maxSize?: number;
    /** Maximum retry attempts per item */
    maxRetries?: number;
    /** Delay between retries in ms */
    retryDelay?: number;
    /** Whether to process items automatically */
    autoProcess?: boolean;
    /** Concurrency for auto processing */
    concurrency?: number;
}
export interface QueueStats {
    size: number;
    maxSize: number;
    processed: number;
    failed: number;
    avgProcessingTime: number;
    isProcessing: boolean;
}
export interface QueueEventMap<T> {
    'enqueue': (item: QueueItem<T>) => void;
    'dequeue': (item: QueueItem<T>) => void;
    'process': (item: QueueItem<T>) => void;
    'processed': (item: QueueItem<T>, result: unknown) => void;
    'error': (item: QueueItem<T>, error: Error) => void;
    'retry': (item: QueueItem<T>, attempt: number) => void;
    'full': () => void;
    'empty': () => void;
    'drain': () => void;
}
/**
 * Basic FIFO Queue
 */
export declare class Queue<T = unknown> extends EventEmitter {
    protected items: QueueItem<T>[];
    protected options: Required<QueueOptions>;
    protected processing: boolean;
    protected processedCount: number;
    protected failedCount: number;
    protected processingTimes: number[];
    protected idCounter: number;
    protected processor?: (item: T) => Promise<unknown>;
    protected activeProcessing: number;
    constructor(options?: QueueOptions);
    /**
     * Generate unique item ID
     */
    protected generateId(): string;
    /**
     * Add an item to the queue
     */
    enqueue(data: T, metadata?: Record<string, unknown>): QueueItem<T> | null;
    /**
     * Add multiple items to the queue
     */
    enqueueMany(dataItems: T[]): QueueItem<T>[];
    /**
     * Remove and return the first item from the queue
     */
    dequeue(): QueueItem<T> | undefined;
    /**
     * Remove multiple items from the queue
     */
    dequeueMany(count: number): QueueItem<T>[];
    /**
     * View the first item without removing it
     */
    peek(): QueueItem<T> | undefined;
    /**
     * View multiple items without removing them
     */
    peekMany(count: number): QueueItem<T>[];
    /**
     * Get item by ID
     */
    getById(id: string): QueueItem<T> | undefined;
    /**
     * Remove item by ID
     */
    removeById(id: string): boolean;
    /**
     * Check if queue contains an item
     */
    has(id: string): boolean;
    /**
     * Get queue size
     */
    size(): number;
    /**
     * Check if queue is empty
     */
    isEmpty(): boolean;
    /**
     * Check if queue is full
     */
    isFull(): boolean;
    /**
     * Clear all items from the queue
     */
    clear(): number;
    /**
     * Get all items (copy)
     */
    getAll(): QueueItem<T>[];
    /**
     * Filter items based on predicate
     */
    filter(predicate: (item: QueueItem<T>) => boolean): QueueItem<T>[];
    /**
     * Find an item based on predicate
     */
    find(predicate: (item: QueueItem<T>) => boolean): QueueItem<T> | undefined;
    /**
     * Set the processor function for auto-processing
     */
    setProcessor(processor: (item: T) => Promise<unknown>): void;
    /**
     * Process all items in the queue
     */
    processQueue(): Promise<void>;
    /**
     * Process a single item with retry logic
     */
    protected processItem(item: QueueItem<T>): Promise<void>;
    /**
     * Get queue statistics
     */
    getStats(): QueueStats;
    /**
     * Update queue options
     */
    updateOptions(options: Partial<QueueOptions>): void;
    /**
     * Get current options
     */
    getOptions(): Required<QueueOptions>;
    /**
     * Helper sleep function
     */
    protected sleep(ms: number): Promise<void>;
    /**
     * Dispose and cleanup
     */
    dispose(): void;
    /**
     * Format queue status for display
     */
    formatStatus(): string;
}
export default Queue;
