import { ConfigService } from '@nestjs/config';
import { AtlasProxyService } from '../atlas-proxy/atlas-proxy.service';
import type { AutomationChannel, AutomationLogStatus, AutomationRunStatus, AutomationStepStatus, PublishedAutomationDefinition, PublishedAutomationSummary } from './engine/types';
import type { ProviderResult } from './providers/message-provider';
export interface RuntimeSubject {
    subjectType?: string;
    subjectId?: string;
    contactId?: string;
    userId?: string;
    to?: string;
}
export interface CreateRunInput {
    automationId: string;
    versionId?: string | null;
    sourceEventId: string;
    subject: RuntimeSubject;
    payload: Record<string, unknown>;
    dryRun: boolean;
}
export interface RuntimeStepInput {
    runId: string;
    automationId: string;
    nodeKey: string;
    status: AutomationStepStatus;
    attempts: number;
    input?: Record<string, unknown>;
    output?: Record<string, unknown>;
    error?: string | null;
    metadata?: Record<string, unknown>;
    startedAt?: string | null;
    finishedAt?: string | null;
}
export interface RuntimeLogInput {
    automationId: string;
    versionId?: string | null;
    runId?: string | null;
    stepId?: string | null;
    contactId?: string | null;
    userId?: string | null;
    nodeKey?: string | null;
    blockLabel?: string | null;
    channel?: AutomationChannel | null;
    event: string;
    status: AutomationLogStatus;
    errorCode?: string | null;
    errorMessage?: string | null;
    providerResponse?: unknown;
    payloadSummary?: Record<string, unknown> | null;
    attempts?: number;
    nextRetryAt?: string | null;
    requestId?: string | null;
    dryRun: boolean;
}
export interface RuntimeEventInput {
    runId: string;
    runStatus?: AutomationRunStatus;
    finishedAt?: string | null;
    step?: RuntimeStepInput;
    log?: RuntimeLogInput;
}
export type IngestionEventStatus = 'RECEIVED' | 'MATCHED' | 'ENQUEUED' | 'DUPLICATE' | 'FAILED' | 'DEGRADED';
export interface IngestionEventInput {
    eventName: string;
    source: string;
    subjectType?: string | null;
    subjectId?: string | null;
    contactId?: string | null;
    userId?: string | null;
    payload?: Record<string, unknown>;
    idempotencyKey: string;
    status: IngestionEventStatus;
    matched?: number;
    enqueued?: number;
    degraded?: boolean;
    duplicate?: boolean;
    errorCode?: string | null;
    errorMessage?: string | null;
    retryable?: boolean;
}
export interface RuntimeRunStatus {
    id: string;
    automationId: string;
    status: AutomationRunStatus;
    startedAt?: string | null;
    finishedAt?: string | null;
    dryRun: boolean;
}
export declare class AtlasRuntimeClient {
    private readonly atlasProxy;
    private readonly basePath;
    constructor(atlasProxy: AtlasProxyService, configService: ConfigService);
    getDefinition(id: string): Promise<PublishedAutomationDefinition>;
    findPublishedByTrigger(trigger: string): Promise<PublishedAutomationSummary[]>;
    createRun(input: CreateRunInput): Promise<Record<string, unknown>>;
    reportRuntimeEvent(input: RuntimeEventInput): Promise<{
        run?: Record<string, unknown>;
        step?: Record<string, unknown>;
        log?: Record<string, unknown>;
    }>;
    resumeRun(runId: string): Promise<{
        result?: Record<string, unknown>;
    }>;
    reportIngestionEvent(input: IngestionEventInput): Promise<{
        event?: Record<string, unknown>;
    }>;
    getRunStatus(runId: string): Promise<RuntimeRunStatus>;
    checkOptOut(input: {
        contactId?: string | null;
        userId?: string | null;
        channel: AutomationChannel;
    }): Promise<boolean>;
    sendMessage(input: {
        channel: AutomationChannel;
        to: string;
        subject?: string;
        body: string;
        meta?: Record<string, unknown>;
        dryRun?: boolean;
    }): Promise<ProviderResult>;
}
