import type { LogContext, LogContextGetter } from '@nangohq/logs';
import type { Result } from '@nangohq/utils';
import { NangoError } from '../utils/error.js';
import type { NangoConnection } from '../models/Connection.js';
import type { Config as ProviderConfig } from '../models/Provider.js';
import type { ExecuteReturn, ExecuteActionProps, ExecuteWebhookProps, ExecutePostConnectionProps, ExecuteSyncProps, VoidReturn, OrchestratorTask, RecurringProps, SchedulesReturn, OrchestratorSchedule } from '@nangohq/nango-orchestrator';
import type { NangoIntegrationData, Sync, SyncConfig } from '../models/index.js';
import { SyncCommand } from '../models/index.js';
import type { DBEnvironment, DBTeam } from '@nangohq/types';
export interface RecordsServiceInterface {
    deleteRecordsBySyncId({ connectionId, model, syncId }: {
        connectionId: number;
        model: string;
        syncId: string;
    }): Promise<{
        totalDeletedRecords: number;
    }>;
}
export interface OrchestratorClientInterface {
    recurring(props: RecurringProps): Promise<Result<{
        scheduleId: string;
    }>>;
    executeAction(props: ExecuteActionProps): Promise<ExecuteReturn>;
    executeWebhook(props: ExecuteWebhookProps): Promise<ExecuteReturn>;
    executePostConnection(props: ExecutePostConnectionProps): Promise<ExecuteReturn>;
    executeSync(props: ExecuteSyncProps): Promise<VoidReturn>;
    pauseSync({ scheduleName }: {
        scheduleName: string;
    }): Promise<VoidReturn>;
    unpauseSync({ scheduleName }: {
        scheduleName: string;
    }): Promise<VoidReturn>;
    deleteSync({ scheduleName }: {
        scheduleName: string;
    }): Promise<VoidReturn>;
    updateSyncFrequency({ scheduleName, frequencyMs }: {
        scheduleName: string;
        frequencyMs: number;
    }): Promise<VoidReturn>;
    cancel({ taskId, reason }: {
        taskId: string;
        reason: string;
    }): Promise<Result<OrchestratorTask>>;
    searchSchedules({ scheduleNames, limit }: {
        scheduleNames: string[];
        limit: number;
    }): Promise<SchedulesReturn>;
}
export declare class Orchestrator {
    private client;
    constructor(client: OrchestratorClientInterface);
    searchSchedules(props: {
        syncId: string;
        environmentId: number;
    }[]): Promise<Result<Map<string, OrchestratorSchedule>>>;
    triggerAction<T = any>({ connection, actionName, input, logCtx }: {
        connection: NangoConnection;
        actionName: string;
        input: object;
        logCtx: LogContext;
    }): Promise<Result<T, NangoError>>;
    triggerWebhook<T = any>({ account, environment, integration, connection, webhookName, syncConfig, input, logContextGetter }: {
        account: DBTeam;
        environment: DBEnvironment;
        integration: ProviderConfig;
        connection: NangoConnection;
        webhookName: string;
        syncConfig: SyncConfig;
        input: object;
        logContextGetter: LogContextGetter;
    }): Promise<Result<T, NangoError>>;
    triggerPostConnectionScript<T = any>({ connection, version, name, fileLocation, logCtx }: {
        connection: NangoConnection;
        version: string;
        name: string;
        fileLocation: string;
        logCtx: LogContext;
    }): Promise<Result<T, NangoError>>;
    updateSyncFrequency({ syncId, interval, syncName, environmentId, logCtx }: {
        syncId: string;
        interval: string;
        syncName: string;
        environmentId: number;
        logCtx?: LogContext;
    }): Promise<Result<void>>;
    runSyncCommand({ connectionId, syncId, command, environmentId, logCtx, recordsService, initiator }: {
        connectionId: number;
        syncId: string;
        command: SyncCommand;
        environmentId: number;
        logCtx: LogContext;
        recordsService: RecordsServiceInterface;
        initiator: string;
    }): Promise<Result<void>>;
    deleteSync({ syncId, environmentId }: {
        syncId: string;
        environmentId: number;
    }): Promise<Result<void>>;
    scheduleSync({ nangoConnection, sync, providerConfig, syncName, syncData, logContextGetter, debug }: {
        nangoConnection: NangoConnection;
        sync: Sync;
        providerConfig: ProviderConfig;
        syncName: string;
        syncData: NangoIntegrationData;
        logContextGetter: LogContextGetter;
        debug?: boolean;
    }): Promise<Result<void>>;
    private getFrequencyMs;
}
