import type { WorkerOptions } from 'bullmq';
import type { Logger } from 'pino';
import type { ToroTask } from './client.js';
import type { TaskJob } from './job.js';
import type { TaskDefinitionRegistry, TaskFlowRun, TaskFlowRunNode, TaskRegistry, WorkerFilterTasks } from './types/index.js';
import { Task } from './task.js';
/**
 * Represents a logical group of related Tasks.
 */
export declare class TaskGroup<TDefs extends TaskDefinitionRegistry = TaskDefinitionRegistry, TTasks extends TaskRegistry<TDefs> = TaskRegistry<TDefs>> {
    readonly id: string;
    readonly client: ToroTask;
    readonly logger: Logger;
    /**
     * Collection of tasks indexed by their definition IDs.
     * The ID IS the task ID - no separation between key and ID.
     * This provides strict typing based on the definition IDs.
     */
    tasks: TTasks;
    constructor(client: ToroTask, id: string, parentLogger: Logger, definitions?: TDefs);
    /**
     * Creates a new Task within this group using a configuration object.
     * Task Id ensures that config matches a specific definition in TDefs.
     * The created Task type matches TTasks[TaskId].
     */
    createTask<TaskId extends Extract<keyof TDefs, string>>(id: string, config: TDefs[TaskId]): TTasks[TaskId];
    /**
     * Retrieves a defined Task by its definition name.
     *
     * @param id The definition name (id from TDefs, e.g., 'myTask'). Must be an id of TTasks.
     * @returns The specifically typed Task instance (TTasks[Id]) if found, otherwise undefined.
     */
    getTask<Id extends Extract<keyof TTasks, string>>(id: Id): TTasks[Id] | undefined;
    /**
     * Gets all defined tasks in this group.
     *
     * @returns A map of task names to Task instances.
     */
    getTasks(): TTasks;
    /**
     * Runs a task within this group with the provided payload.
     *
     * @param taskName The name of the task to run (must be a key of TTasks).
     * @param payload The payload to pass to the task, inferred from the task's definition.
     * @returns A promise that resolves to the TaskJob instance.
     */
    runTask<TaskName extends Extract<keyof TTasks, string>, ActualTask extends TTasks[TaskName] = TTasks[TaskName], Payload = ActualTask extends Task<infer P, any, any> ? P : unknown, Result = ActualTask extends Task<any, infer R, any> ? R : unknown, ActualPayload extends Payload = Payload>(taskName: TaskName, payload: ActualPayload): Promise<TaskJob<ActualPayload, Result>>;
    /**
     * Runs multiple task in the specified groups with the provided data.
     *
     */
    runBulkTasks(runs: TaskFlowRun[]): Promise<TaskFlowRunNode[]>;
    /**
     * Starts background workers for specified tasks or all tasks in the group.
     * @param filter Optional filter to specify which tasks to start workers for.
     * Uses the exact keys defined for the tasks in this group.
     * @param workerOptions Optional configuration for the workers being started.
     */
    startWorkers(filter?: WorkerFilterTasks<TTasks>, workerOptions?: WorkerOptions): Promise<void>;
    /**
     * Stops workers for tasks within this group, optionally filtered by task names.
     *
     * @param filter Optional filter object. If `filter.tasks` is provided, only stops workers for task names in the array.
     * @returns A promise that resolves when all targeted workers have been requested to stop.
     */
    stopWorkers(filter?: WorkerFilterTasks<TTasks>): Promise<void>;
    /**
     * Closes specified tasks or all tasks within this group, releasing resources.
     *
     * @param filter Optional filter to specify which tasks to close.
     * Uses the exact keys defined for the tasks in this group.
     * @returns A promise that resolves when all targeted tasks have attempted to close.
     */
    close(filter?: WorkerFilterTasks<TTasks>): Promise<void>;
}
//# sourceMappingURL=task-group.d.ts.map