import { Task, TasksModule, RunTaskParams, AddTaskParams, DeleteTaskParams } from "./type";
import App from "../app";
export declare class TasksManager {
    private static instance;
    private taskFunctions;
    private tasks;
    private app;
    private db;
    useTasks: () => {
        tasks: TasksModule;
    };
    watchTaskCallback: (taskModule: TasksModule) => void;
    constructor(app: App);
    static getInstance(app?: App): TasksManager;
    addTaskFunction<T>(name: string, fun: T): void;
    addTaskFunctions<T>(tasks: {
        name: string;
        fun: T;
    }[]): void;
    getTasks(): TasksModule;
    getTaskFunction(name: string): any;
    init(): Promise<void>;
    private saveTaskQueueToLocal;
    private loadTaskQueueFromLocal;
    /**
     * @title: 执行任务
     * @description:
     * @param {Task} task
     * @return {*}
     * @Author: zhiwei.Wang
     * @Date: 2024-09-26 13:53
     */
    private runTask;
    /**
     * @title: 启动轮询
     * @description: 根据轮询间隔定期执行任务
     * @param {Task} task
     * @return {*}
     */
    private startPolling;
    /**
     * @title: 创建任务数据
     * @description:
     * @param {Partial} payload
     * @return {*}
     * @Author: zhiwei.Wang
     * @Date: 2024-09-26 13:54
     */
    private createTaskData;
    private getTaskQueue;
    private timeout;
    /**
     * @title: 执行任务队列
     * @description:
     * @return {*}
     * @Author: zhiwei.Wang
     * @Date: 2024-09-26 13:52
     */
    run(payload: RunTaskParams): Promise<void>;
    deleteTask(payload: DeleteTaskParams): void;
    /**
     * @title: 重试任务
     * @description:
     * @return {*}
     * @Author: zhiwei.Wang
     * @Date: 2024-09-26 13:53
     */
    retryTask(payload: RunTaskParams): void;
    addTask(payload: AddTaskParams): void;
    private updateTask;
    private updateQueueStatus;
    private setTasks;
    clearAllTaskTimer(tasks: Task[]): void;
    clearTasks(payload: RunTaskParams): void;
    clearAllTasks(): void;
    watchTask(callback: (taskModule: TasksModule) => void): void;
}
