import { googleDatastore } from '@arcane-utils/datastore';
import { Logger } from '@arcane-utils/logger';
import { Ingestion, IngestionType, MonitoringStatus } from '@arcane-utils/types';

/**
 * Custom error to indicate that an execution should be skipped due to outdated
 * schedule information or concurrent execution.
 */
declare class SkipExecutionError extends Error {
    constructor(message: string);
}
interface IngestionStartBody {
    entity_id: string;
    monitoring_id: string;
    schedule_version: string;
    manual_execution?: boolean;
}
/**
 * Set the ingestion execution info to 'running' status
 */
declare const setIngestionExecutionInfoAsStart: (datastore: googleDatastore.Datastore, ingestion: Ingestion, saveEntity: (entityId: string, updatedProperties: object, _datastore: googleDatastore.Datastore) => Promise<any>) => Promise<void>;
/**
 * Handle the start of an execution for an entity.
 * This function validates the schedule version, checks if the entity is already running,
 * updates the execution status, and publishes a monitoring event for every services except datalab.
 * This function's implementation must match our python implementation https://github.com/arcane-run/python-utility/blob/abc088fb3fe95fb38ca613c25baa011626fcb867/src/arcane-ingestion/arcane/ingestion/execution_handler.py#L29-L30
 * @throws {SkipExecutionError} If the schedule version is outdated or if a previous execution
 *         is still running (less than the allowed delta time for the ingestion type).
 */
declare const handleStartExecution: (body: IngestionStartBody, entity: Ingestion, datastore: googleDatastore.Datastore, ingestionType: IngestionType, logger: Logger, publishMonitoringStatusCurried: (entityId: number, monitoringId: string, status: MonitoringStatus, childLogger: Logger) => Promise<void>, saveEntity: (entityId: string, updatedProperties: object, _datastore: googleDatastore.Datastore) => Promise<any>, taskRetryCount?: number) => Promise<void>;

export { SkipExecutionError, handleStartExecution, setIngestionExecutionInfoAsStart };
