import type { Context } from '@temporalio/activity';
import type { NangoConnection } from '../../models/Connection.js';
import type { Account } from '../../models/Admin.js';
import type { Metadata, ErrorPayload } from '@nangohq/types';
import type { SyncType, IntegrationServiceInterface, SyncConfig } from '../../models/Sync.js';
import type { ServiceResponse } from '../../models/Generic.js';
import type { SlackService } from '../notification/slack.service.js';
import type { Environment } from '../../models/Environment.js';
import type { LogContext } from '@nangohq/logs';
import type { NangoProps } from '../../sdk/sync.js';
import type { UpsertSummary } from '@nangohq/records';
import type { SendSyncParams } from '@nangohq/webhooks';
interface BigQueryClientInterface {
    insert(row: RunScriptRow): Promise<void>;
}
interface RunScriptRow {
    executionType: string;
    internalConnectionId: number | undefined;
    connectionId: string;
    accountId: number | undefined;
    accountName: string;
    scriptName: string;
    scriptType: string;
    environmentId: number;
    environmentName: string;
    providerConfigKey: string;
    status: string;
    syncId: string;
    content: string;
    runTimeInSeconds: number;
    createdAt: number;
}
type SyncConfigForScript = Pick<SyncConfig, 'id' | 'sync_name' | 'type' | 'models' | 'track_deletes' | 'is_public' | 'version' | 'attributes' | 'file_location'>;
export type SyncRunConfig = {
    bigQueryClient?: BigQueryClientInterface;
    integrationService: IntegrationServiceInterface;
    recordsService: RecordsServiceInterface;
    dryRunService?: NangoProps['dryRunService'];
    isAction?: boolean;
    isWebhook?: boolean;
    isPostConnectionScript?: boolean;
    nangoConnection: NangoConnection;
    syncConfig: SyncConfigForScript;
    syncType: SyncType;
    syncId?: string;
    syncJobId?: number;
    provider?: string;
    loadLocation?: string;
    debug?: boolean;
    input?: object;
    logMessages?: {
        counts: {
            updated: number;
            added: number;
            deleted: number;
        };
        messages: unknown[];
    } | undefined;
    stubbedMetadata?: Metadata | undefined;
    account?: Account;
    environment?: Environment;
    temporalContext?: Context;
} & ({
    writeToDb: true;
    activityLogId: string | number;
    logCtx: LogContext;
    slackService: SlackService;
    sendSyncWebhook: (params: SendSyncParams) => Promise<void>;
} | {
    writeToDb: false;
});
export interface RecordsServiceInterface {
    markNonCurrentGenerationRecordsAsDeleted({ connectionId, model, syncId, generation }: {
        connectionId: number;
        model: string;
        syncId: string;
        generation: number;
    }): Promise<string[]>;
}
export declare class SyncRunService {
    bigQueryClient?: BigQueryClientInterface;
    integrationService: IntegrationServiceInterface;
    recordsService: RecordsServiceInterface;
    dryRunService?: NangoProps['dryRunService'];
    slackNotificationService?: SlackService;
    sendSyncWebhook?: (params: SendSyncParams) => Promise<void>;
    writeToDb: boolean;
    isAction: boolean;
    isPostConnectionScript: boolean;
    isInvokedImmediately: boolean;
    nangoConnection: NangoConnection;
    syncConfig: SyncConfigForScript;
    syncType: SyncType;
    syncId?: string;
    syncJobId?: number;
    activityLogId?: string | number;
    provider?: string;
    loadLocation?: string;
    debug?: boolean;
    input?: object;
    logMessages?: {
        counts: {
            updated: number;
            added: number;
            deleted: number;
        };
        messages: unknown[];
    } | undefined;
    stubbedMetadata?: Metadata | undefined;
    account?: Account;
    environment?: Environment;
    temporalContext?: Context;
    isWebhook: boolean;
    logCtx?: LogContext;
    constructor(config: SyncRunConfig);
    run(optionalLastSyncDate?: Date | null, bypassEnvironment?: boolean, optionalSecretKey?: string, optionalHost?: string): Promise<ServiceResponse<boolean | object>>;
    finishFlow(syncStartDate: Date, totalRunTime: number): Promise<void>;
    reportResults(model: string, responseResults: UpsertSummary, index: number, numberOfModels: number, syncStartDate: Date, totalRunTime: number): Promise<void>;
    reportFailureForResults({ content, runTime, isCancel, models, syncStartDate, error }: {
        content: string;
        runTime: number;
        isCancel?: true;
        models: string[];
        syncStartDate: Date;
        error: ErrorPayload;
    }): Promise<void>;
    private determineExecutionType;
    private determineErrorType;
}
export {};
