import type { JitterConfig, JobOptions } from '@stacksjs/types';
import type { JobModel } from '../../../orm/src/models/Job';

declare interface QueuePayload {
  path: string
  name: string
  maxTries: number
  timeOut: number | null
  timeOutAt: Date | null
  params: any
  classPayload: string
}
export declare function processJobs(queue: string | undefined): Promise<Ok<string, never>>;
export declare function executeFailedJobs(): Promise<void>;
export declare function retryFailedJob(id: number): Promise<void>;
declare function executeJobs(queue: string | undefined): Promise<void>;
declare function enforceMaxDelay(maxDelay: number | undefined, delay: number): number;
declare function addDelay(timestamp: number | undefined, currentAttempts: number, classPayload: JobOptions): number;
declare function meilisecondsToSeconds(meiliseconds: number): number;
declare function applyJitter(delay: number, jitterConfig: JitterConfig): number;
declare function storeFailedJob(job: JobModel, exception: string): void;
declare function now(): string;
declare function updateJobAttempts(job: JobModel, currentAttempts: number, delay: number | null): Promise<void>;
declare function timestampNow(): number;