import type { Observable } from 'rxjs';
import { PartialDeep } from 'type-fest';
import type { task_id } from '../types/typeAliases';
import type { string_SCREAMING_CASE } from '../utils/normalization/normalizeTo_SCREAMING_CASE';
import type { AbstractTaskResult } from './AbstractTaskResult';
import type { PipelineExecutorResult } from './PipelineExecutorResult';
/**
 * Options for creating a new task
 */
type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
    /**
     * The type of task to create
     */
    readonly taskType: AbstractTask<TTaskResult>['taskType'];
    /**
     * Callback that processes the task and updates the ongoing result
     * @param ongoingResult The partial result of the task processing
     * @returns The final task result
     */
    taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult>) => void): Promise<TTaskResult>;
};
/**
 * Helper to create a new task
 *
 * @private internal helper function
 */
export declare function createTask<TTaskResult extends AbstractTaskResult>(options: CreateTaskOptions<TTaskResult>): AbstractTask<TTaskResult>;
/**
 * Represents a task that executes a pipeline
 */
export type ExecutionTask = AbstractTask<PipelineExecutorResult> & {
    readonly taskType: 'EXECUTION';
    readonly taskId: `exec-${task_id}`;
};
/**
 * Represents a task that prepares a pipeline
 * @deprecated TODO: [🐚] Currently unused - use
 */
export type PreparationTask = AbstractTask<PipelineExecutorResult> & {
    readonly taskType: 'PREPARATION';
    readonly taskId: `prep-${task_id}`;
};
/**
 * Status of a task
 */
export type task_status = 'RUNNING' | 'FINISHED' | 'ERROR';
/**
 * Base interface for all task types
 */
export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
    /**
     * Type of the task
     */
    readonly taskType: string_SCREAMING_CASE;
    /**
     * Unique identifier for the task
     */
    readonly taskId: task_id;
    /**
     * Status of the task
     */
    readonly status: task_status;
    /**
     * Date when the task was created
     */
    readonly createdAt: Date;
    /**
     * Date when the task was last updated
     */
    readonly updatedAt: Date;
    /**
     * Gets a promise that resolves with the task result
     */
    asPromise(options?: {
        readonly isCrashedOnError?: boolean;
    }): Promise<TTaskResult>;
    /**
     * Gets an observable stream of partial task results
     */
    asObservable(): Observable<PartialDeep<TTaskResult>>;
    /**
     * Gets just the current value which is mutated during the task processing
     */
    currentValue: PartialDeep<TTaskResult>;
    /**
     * List of errors that occurred during the task processing
     */
    readonly errors: Array<Error>;
    /**
     * List of warnings that occurred during the task processing
     */
    readonly warnings: Array<Error>;
};
export type Task = ExecutionTask | PreparationTask;
export {};
/**
 * TODO: Maybe allow to terminate the task and add getter `isFinished` or `status`
 * TODO: [🐚] Split into more files and make `PrepareTask` & `RemoteTask` + split the function
 */
