import type { ModuleRef } from '@nestjs/core';
import type { ResolvedCoreConfig } from '../config/options.js';
export type QueueState = 'waiting' | 'active' | 'delayed' | 'failed' | 'completed' | 'paused';
export declare const QUEUE_STATES: readonly QueueState[];
export declare function isQueueState(value: unknown): value is QueueState;
export interface QueueCounts {
    waiting: number;
    active: number;
    delayed: number;
    failed: number;
    completed: number;
    paused: number;
}
export interface QueueSummary {
    driver: string;
    queue: string;
    counts: QueueCounts;
    isPaused: boolean;
    /**
     * Optional per-queue capability hint: the mutating actions this specific
     * queue supports. Lets the UI show action buttons (e.g. Redrive) only for
     * queues that actually support them — for SQS, only queues with a configured
     * DLQ advertise `'redrive'`. Omitted by managers that don't vary per queue.
     */
    actions?: QueueActionName[];
}
export interface QueueJob {
    id: string;
    name: string;
    state: QueueState;
    attemptsMade: number;
    maxAttempts: number | null;
    timestamp: number | null;
    processedOn: number | null;
    finishedOn: number | null;
    failedReason: string | null;
    progress: number | null;
}
export interface QueueJobDetail extends QueueJob {
    data: unknown;
    opts: unknown;
    stacktrace: string[] | null;
    returnValue: unknown;
}
export interface JobPage {
    jobs: QueueJob[];
    nextCursor: string | null;
    total: number | null;
}
/** Handed to each QueueManager at boot (mirrors WatcherContext). */
export interface QueueManagerContext {
    readonly moduleRef: ModuleRef;
    readonly config: ResolvedCoreConfig;
    /** Redact a job payload before it leaves the server (core redaction). */
    readonly redact: (value: unknown) => unknown;
}
/**
 * SPI for a source of queue summaries/jobs (e.g. a BullMQ queue watcher). A
 * `watchers` entry that structurally implements this SPI (has `driver`,
 * `init`, `listQueues`, `counts`, `listJobs`, and `getJob`) is auto-registered
 * by `QueueManagerRegistry` — you do NOT also need to list it in
 * `TelescopeModuleOptions.queueManagers`. That option remains for a standalone
 * manager that isn't itself a `Watcher`. Listing the same instance in both
 * `watchers` and `queueManagers` is safe (it's inited exactly once, deduped by
 * identity).
 */
export interface QueueManager {
    readonly driver: string;
    init(ctx: QueueManagerContext): void | Promise<void>;
    listQueues(): Promise<QueueSummary[]>;
    counts(queue: string): Promise<QueueCounts>;
    listJobs(queue: string, state: QueueState, page: {
        cursor?: string;
        limit?: number;
    }): Promise<JobPage>;
    getJob(queue: string, id: string): Promise<QueueJobDetail | null>;
    retry?(queue: string, id: string): Promise<void>;
    remove?(queue: string, id: string): Promise<void>;
    promote?(queue: string, id: string): Promise<void>;
    retryAll?(queue: string, state: QueueState): Promise<number>;
    redrive?(queue: string): Promise<number>;
    /**
     * Enqueue (send) a new job/message onto the queue. Optional (like redrive);
     * presence advertises the `'enqueue'` capability. Returns the new job's id
     * when the driver assigns one (BullMQ does; some drivers may not), else null.
     */
    enqueue?(queue: string, payload: unknown, opts: {
        name?: string;
    }, ctx: QueueManagerContext): Promise<{
        id: string | null;
    }>;
}
export type QueueActionName = 'retry' | 'remove' | 'promote' | 'retry-all' | 'redrive' | 'enqueue';
export declare const QUEUE_ACTIONS: readonly QueueActionName[];
export declare function isQueueAction(value: unknown): value is QueueActionName;
/** What the action authorizer is told about a requested mutation. */
export interface QueueActionRequest {
    driver: string;
    queue: string;
    action: QueueActionName;
    jobId?: string;
    state?: QueueState;
}
//# sourceMappingURL=queue-manager.d.ts.map