import { type AnyType } from './any';
import { type ApiSuccess } from './api/success';
import type { DownloadFileType } from './downloadFile';
import { type Explore, type ExploreError } from './explore';
import { type DashboardFilterRule, type DashboardFilters, type Filters } from './filter';
import { type KnexPaginatedData } from './knex-paginate';
import { type ParametersValuesMap } from './parameters';
import { type PivotConfig } from './pivot';
import type { CompilationSource } from './projectCompileLogs';
import { SchedulerResourceType } from './schedulerLog';
import type { PartialFailure, SchedulerRun } from './schedulerLog';
import { type DateGranularity } from './timeFrames';
import { type ValidationTarget } from './validation';
export type SchedulerCsvOptions = {
    formatted: boolean;
    limit: 'table' | 'all' | number;
    asAttachment?: boolean;
    exportPivotedData?: boolean;
    xlsxFileLayout?: 'zip' | 'workbook';
};
export type SchedulerImageOptions = {
    withPdf?: boolean;
};
export type SchedulerGsheetsOptions = {
    gdriveId: string;
    gdriveName: string;
    gdriveOrganizationName: string;
    url: string;
    tabName?: string;
};
export type SchedulerPdfOptions = Record<string, never>;
export type SchedulerOptions = SchedulerCsvOptions | SchedulerImageOptions | SchedulerGsheetsOptions | SchedulerPdfOptions;
export declare enum SchedulerJobStatus {
    SCHEDULED = "scheduled",
    STARTED = "started",
    COMPLETED = "completed",
    ERROR = "error"
}
export declare enum SchedulerFormat {
    CSV = "csv",
    XLSX = "xlsx",
    IMAGE = "image",
    GSHEETS = "gsheets",
    PDF = "pdf"
}
export declare enum JobPriority {
    HIGH = 0,// UI-waiting jobs (queries, download csv, compile)
    MEDIUM = 1,// Related jobs (validate/catalogindex)
    LOW = 2
}
export declare enum ThresholdOperator {
    GREATER_THAN = "greaterThan",
    LESS_THAN = "lessThan",
    INCREASED_BY = "increasedBy",
    DECREASED_BY = "decreasedBy"
}
export declare enum NotificationFrequency {
    ALWAYS = "always",
    ONCE = "once"
}
export declare const operatorActionValue: (operator: ThresholdOperator, value: number | string, highlight?: string) => string;
export type ThresholdOptions = {
    operator: ThresholdOperator;
    fieldId: string;
    value: number;
};
export type SchedulerBase = {
    schedulerUuid: string;
    name: string;
    message?: string;
    createdAt: Date;
    updatedAt: Date;
    createdBy: string;
    createdByName: string | null;
    format: SchedulerFormat;
    cron: string;
    timezone?: string;
    projectSchedulerTimezone?: string;
    savedChartUuid: string | null;
    savedChartName: string | null;
    dashboardUuid: string | null;
    dashboardName: string | null;
    savedSqlUuid: string | null;
    savedSqlName: string | null;
    appUuid: string | null;
    appName: string | null;
    options: SchedulerOptions;
    thresholds?: ThresholdOptions[];
    enabled: boolean;
    notificationFrequency?: NotificationFrequency;
    includeLinks: boolean;
    projectUuid?: string | null;
    projectName?: string | null;
};
export type ChartScheduler = SchedulerBase & {
    savedChartUuid: string;
    dashboardUuid: null;
    savedSqlUuid: null;
    appUuid: null;
    filters?: Filters;
    parameters?: ParametersValuesMap;
};
export declare const isDashboardScheduler: (scheduler: Scheduler | CreateSchedulerAndTargets) => scheduler is DashboardScheduler;
export type DashboardScheduler = SchedulerBase & {
    savedChartUuid: null;
    dashboardUuid: string;
    savedSqlUuid: null;
    appUuid: null;
    filters?: DashboardFilterRule[];
    parameters?: ParametersValuesMap;
    customViewportWidth?: number;
    selectedTabs: string[] | null;
};
export type SchedulerFilters = Filters | DashboardFilterRule[];
export type SqlChartScheduler = SchedulerBase & {
    savedChartUuid: null;
    dashboardUuid: null;
    savedSqlUuid: string;
    appUuid: null;
};
export type AppScheduler = SchedulerBase & {
    savedChartUuid: null;
    dashboardUuid: null;
    savedSqlUuid: null;
    appUuid: string;
};
export declare const isAppScheduler: (data: Scheduler | CreateSchedulerAndTargets) => data is AppScheduler;
export declare const isSqlChartScheduler: (scheduler: Scheduler | CreateSchedulerAndTargets) => scheduler is SqlChartScheduler;
export type Scheduler = ChartScheduler | DashboardScheduler | SqlChartScheduler | AppScheduler;
export type SchedulerAndTargets = Scheduler & {
    targets: (SchedulerSlackTarget | SchedulerEmailTarget | SchedulerMsTeamsTarget | SchedulerGoogleChatTarget)[];
    latestRun?: SchedulerRun | null;
};
export type SchedulerSlackTarget = {
    schedulerSlackTargetUuid: string;
    createdAt: Date;
    updatedAt: Date;
    schedulerUuid: string;
    channel: string;
};
export type SchedulerMsTeamsTarget = {
    schedulerMsTeamsTargetUuid: string;
    createdAt: Date;
    updatedAt: Date;
    schedulerUuid: string;
    webhook: string;
};
export type SchedulerGoogleChatTarget = {
    schedulerGoogleChatTargetUuid: string;
    createdAt: Date;
    updatedAt: Date;
    schedulerUuid: string;
    googleChatWebhook: string;
};
export type SchedulerEmailTarget = {
    schedulerEmailTargetUuid: string;
    createdAt: Date;
    updatedAt: Date;
    schedulerUuid: string;
    recipient: string;
};
export type CreateSchedulerTarget = Pick<SchedulerSlackTarget, 'channel'> | Pick<SchedulerMsTeamsTarget, 'webhook'> | Pick<SchedulerGoogleChatTarget, 'googleChatWebhook'> | Pick<SchedulerEmailTarget, 'recipient'>;
export declare const getSchedulerTargetUuid: (target: SchedulerSlackTarget | SchedulerMsTeamsTarget | SchedulerGoogleChatTarget | SchedulerEmailTarget | CreateSchedulerTarget) => string | undefined;
export type UpdateSchedulerSlackTarget = Pick<SchedulerSlackTarget, 'schedulerSlackTargetUuid' | 'channel'>;
export type UpdateSchedulerMsTeamsTarget = Pick<SchedulerMsTeamsTarget, 'schedulerMsTeamsTargetUuid' | 'webhook'>;
export type UpdateSchedulerGoogleChatTarget = Pick<SchedulerGoogleChatTarget, 'schedulerGoogleChatTargetUuid' | 'googleChatWebhook'>;
export type UpdateSchedulerEmailTarget = Pick<SchedulerEmailTarget, 'schedulerEmailTargetUuid' | 'recipient'>;
export type CreateSchedulerAndTargets = Omit<Scheduler, 'schedulerUuid' | 'createdAt' | 'updatedAt' | 'createdByName' | 'savedChartName' | 'dashboardName' | 'savedSqlName'> & {
    targets: CreateSchedulerTarget[];
};
export type CreateSchedulerAndTargetsWithoutIds = Omit<CreateSchedulerAndTargets, 'savedChartUuid' | 'dashboardUuid' | 'savedSqlUuid' | 'createdBy'>;
export type UpdateSchedulerAndTargets = Pick<Scheduler, 'schedulerUuid' | 'name' | 'message' | 'cron' | 'timezone' | 'format' | 'options' | 'thresholds' | 'notificationFrequency' | 'includeLinks'> & {
    filters?: SchedulerFilters;
    parameters?: ParametersValuesMap;
    customViewportWidth?: number;
    targets: Array<CreateSchedulerTarget | UpdateSchedulerSlackTarget | UpdateSchedulerEmailTarget | UpdateSchedulerMsTeamsTarget | UpdateSchedulerGoogleChatTarget>;
};
export type UpdateSchedulerAndTargetsWithoutId = Omit<UpdateSchedulerAndTargets, 'schedulerUuid'>;
export declare const isUpdateSchedulerSlackTarget: (data: CreateSchedulerTarget | UpdateSchedulerSlackTarget) => data is UpdateSchedulerSlackTarget;
export declare const isUpdateSchedulerMsTeamsTarget: (data: CreateSchedulerTarget | UpdateSchedulerSlackTarget) => data is UpdateSchedulerMsTeamsTarget;
export declare const isUpdateSchedulerGoogleChatTarget: (data: CreateSchedulerTarget | UpdateSchedulerSlackTarget | UpdateSchedulerGoogleChatTarget) => data is UpdateSchedulerGoogleChatTarget;
export declare const isUpdateSchedulerEmailTarget: (data: CreateSchedulerTarget | UpdateSchedulerEmailTarget) => data is UpdateSchedulerEmailTarget;
export declare const isChartScheduler: (data: Scheduler | CreateSchedulerAndTargets) => data is ChartScheduler;
export declare const getSchedulerResourceTypeAndId: (scheduler: Scheduler | CreateSchedulerAndTargets) => {
    resourceType: SchedulerResourceType;
    resourceId: string;
};
export declare const isChartCreateScheduler: (data: CreateSchedulerAndTargets) => data is ChartScheduler & {
    targets: CreateSchedulerTarget[];
};
export declare const isDashboardCreateScheduler: (data: CreateSchedulerAndTargets) => data is DashboardScheduler & {
    targets: CreateSchedulerTarget[];
};
export declare const isAppCreateScheduler: (data: CreateSchedulerAndTargets) => data is AppScheduler & {
    targets: CreateSchedulerTarget[];
};
export declare const isSlackTarget: (target: SchedulerSlackTarget | SchedulerEmailTarget | SchedulerMsTeamsTarget | SchedulerGoogleChatTarget) => target is SchedulerSlackTarget;
export declare const isMsTeamsTarget: (target: SchedulerSlackTarget | SchedulerEmailTarget | SchedulerMsTeamsTarget | SchedulerGoogleChatTarget) => target is SchedulerMsTeamsTarget;
export declare const isGoogleChatTarget: (target: SchedulerSlackTarget | SchedulerEmailTarget | SchedulerMsTeamsTarget | SchedulerGoogleChatTarget) => target is SchedulerGoogleChatTarget;
export declare const isEmailTarget: (target: SchedulerSlackTarget | SchedulerEmailTarget | SchedulerMsTeamsTarget | SchedulerGoogleChatTarget) => target is SchedulerEmailTarget;
export declare const isCreateSchedulerSlackTarget: (target: Pick<SchedulerSlackTarget, "channel"> | Pick<SchedulerEmailTarget, "recipient"> | Pick<SchedulerMsTeamsTarget, "webhook"> | Pick<SchedulerGoogleChatTarget, "googleChatWebhook">) => target is Pick<SchedulerSlackTarget, "channel">;
export declare const isCreateSchedulerMsTeamsTarget: (target: Pick<SchedulerSlackTarget, "channel"> | Pick<SchedulerEmailTarget, "recipient"> | Pick<SchedulerMsTeamsTarget, "webhook"> | Pick<SchedulerGoogleChatTarget, "googleChatWebhook">) => target is Pick<SchedulerMsTeamsTarget, "webhook">;
export declare const isCreateSchedulerGoogleChatTarget: (target: Pick<SchedulerSlackTarget, "channel"> | Pick<SchedulerEmailTarget, "recipient"> | Pick<SchedulerMsTeamsTarget, "webhook"> | Pick<SchedulerGoogleChatTarget, "googleChatWebhook">) => target is Pick<SchedulerGoogleChatTarget, "googleChatWebhook">;
export declare const isSchedulerCsvOptions: (options: SchedulerCsvOptions | SchedulerImageOptions | SchedulerGsheetsOptions) => options is SchedulerCsvOptions;
export declare const isSchedulerImageOptions: (options: SchedulerCsvOptions | SchedulerImageOptions | SchedulerGsheetsOptions) => options is SchedulerImageOptions;
export declare const isSchedulerGsheetsOptions: (options: SchedulerCsvOptions | SchedulerImageOptions | SchedulerGsheetsOptions) => options is SchedulerGsheetsOptions;
export type ApiSchedulerAndTargetsResponse = {
    status: 'ok';
    results: SchedulerAndTargets;
};
export type ApiAppSchedulersResponse = {
    status: 'ok';
    results: SchedulerAndTargets[];
};
export type ApiCreateAppSchedulerResponse = ApiSchedulerAndTargetsResponse;
export type ApiSchedulersResponse = ApiSuccess<KnexPaginatedData<SchedulerAndTargets[]>>;
export type ScheduledJobs = {
    date: Date;
    id: string;
};
export type ApiScheduledJobsResponse = {
    status: 'ok';
    results: ScheduledJobs[];
};
export type ApiTestSchedulerResponse = {
    status: 'ok';
    results: {
        jobId: string;
    };
};
export type ReassignSchedulerOwnerRequest = {
    schedulerUuids: string[];
    newOwnerUserUuid: string;
};
export type ApiReassignSchedulerOwnerResponse = ApiSuccess<SchedulerAndTargets[]>;
export type UserSchedulersSummary = {
    totalCount: number;
    hasGsheetsSchedulers: boolean;
    byProject: Array<{
        projectUuid: string;
        projectName: string;
        count: number;
    }>;
};
export type ReassignUserSchedulersRequest = {
    newOwnerUserUuid: string;
};
export type ApiUserSchedulersSummaryResponse = ApiSuccess<UserSchedulersSummary>;
export type ApiReassignUserSchedulersResponse = ApiSuccess<{
    reassignedCount: number;
}>;
export type TraceTaskBase = {
    organizationUuid: string;
    projectUuid: string;
    userUuid: string;
    schedulerUuid?: string;
};
export type ManagedAgentHeartbeatTriggeredBy = 'cron' | 'manual' | 'on_enable';
export type ManagedAgentHeartbeatPayload = TraceTaskBase & {
    triggeredBy?: ManagedAgentHeartbeatTriggeredBy;
};
export type QueueTraceProperties = {
    traceHeader?: string;
    baggageHeader?: string;
    sentryMessageId?: string;
};
export type ScheduledDeliveryPayload = TraceTaskBase & (CreateSchedulerAndTargets | Pick<Scheduler, 'schedulerUuid'>);
export declare const isCreateScheduler: (data: ScheduledDeliveryPayload) => data is CreateSchedulerAndTargets & TraceTaskBase;
export declare const hasSchedulerUuid: (data: SchedulerAndTargets | CreateSchedulerAndTargets) => data is SchedulerAndTargets;
export declare const getSchedulerUuid: (data: CreateSchedulerAndTargets | Pick<Scheduler, "schedulerUuid">) => string | undefined;
export declare enum LightdashPage {
    DASHBOARD = "dashboard",
    CHART = "chart",
    EXPLORE = "explore",
    SQL_CHART = "sql_chart",
    APP = "app"
}
export type NotificationPayloadBase = {
    schedulerUuid?: string;
    scheduledTime: Date;
    jobGroup: string;
    page: {
        url: string;
        details: {
            name: string;
            description: string | undefined;
        };
        pageType: LightdashPage;
        organizationUuid: string;
        imageUrl?: string;
        imageS3Key?: string;
        csvUrl?: {
            path: string;
            filename: string;
            localPath: string;
            truncated: boolean;
        };
        csvUrls?: {
            path: string;
            filename: string;
            chartName?: string;
            localPath: string;
            truncated: boolean;
        }[];
        pdfFile?: {
            source: string;
            fileName: string;
        };
        failures?: PartialFailure[];
    };
    scheduler: CreateSchedulerAndTargets;
};
export type SlackNotificationPayload = TraceTaskBase & NotificationPayloadBase & {
    schedulerSlackTargetUuid?: string;
    channel: string;
};
export type MsTeamsNotificationPayload = TraceTaskBase & NotificationPayloadBase & {
    schedulerMsTeamsTargetUuid?: string;
    webhook: string;
};
export type EmailNotificationPayload = TraceTaskBase & NotificationPayloadBase & {
    schedulerEmailTargetUuid?: string;
    recipient: string;
};
export type GsheetsNotificationPayload = TraceTaskBase & {
    schedulerUuid: string;
    scheduledTime: Date;
    jobGroup: string;
};
export type SlackBatchNotificationPayload = TraceTaskBase & Omit<NotificationPayloadBase, 'scheduler'> & {
    targets: SchedulerSlackTarget[];
    scheduler: SchedulerAndTargets;
};
export type EmailBatchNotificationPayload = TraceTaskBase & Omit<NotificationPayloadBase, 'scheduler'> & {
    targets: SchedulerEmailTarget[];
    scheduler: SchedulerAndTargets;
};
export type MsTeamsBatchNotificationPayload = TraceTaskBase & Omit<NotificationPayloadBase, 'scheduler'> & {
    targets: SchedulerMsTeamsTarget[];
    scheduler: SchedulerAndTargets;
};
export type GoogleChatNotificationPayload = TraceTaskBase & NotificationPayloadBase & {
    schedulerGoogleChatTargetUuid?: string;
    googleChatWebhook: string;
};
export type GoogleChatBatchNotificationPayload = TraceTaskBase & Omit<NotificationPayloadBase, 'scheduler'> & {
    targets: SchedulerGoogleChatTarget[];
    scheduler: SchedulerAndTargets;
};
export type DeliveryResult = {
    target: string;
    targetUuid?: string;
    success: boolean;
    error?: string;
};
export type BatchDeliveryResult = {
    type: 'slack' | 'email' | 'msteams' | 'googlechat';
    total: number;
    succeeded: number;
    failed: number;
    results: DeliveryResult[];
};
export type GsheetExportProgress = {
    phase: 'query' | 'upload';
    attempt: number;
};
export type ApiCsvUrlResponse = {
    status: 'ok';
    results: {
        url: string;
        status: string;
        truncated: boolean;
        progress: GsheetExportProgress | null;
    };
};
export type SchedulerCreateProjectWithCompilePayload = Omit<TraceTaskBase, 'projectUuid'> & {
    createdByUserUuid: string;
    requestMethod: string;
    isPreview: boolean;
    data: string;
    jobUuid: string;
    projectUuid: undefined;
};
export type CompileProjectPayload = TraceTaskBase & {
    createdByUserUuid: string;
    requestMethod: string;
    jobUuid: string;
    isPreview: boolean;
    validateAfterCompile?: boolean;
    compilationSource?: CompilationSource;
};
export type PreAggregateMaterializationTrigger = 'compile' | 'cron' | 'manual' | 'webhook';
export type MaterializePreAggregatePayload = TraceTaskBase & {
    preAggregateDefinitionUuid: string;
    trigger: PreAggregateMaterializationTrigger;
};
export type ReplaceCustomFieldsPayload = TraceTaskBase;
export type ValidateProjectPayload = TraceTaskBase & {
    context: 'lightdash_app' | 'dbt_refresh' | 'test_and_compile' | 'cli';
    explores?: (Explore | ExploreError)[];
    validationTargets?: ValidationTarget[];
    onlyValidateExploresInArgs?: boolean;
};
export type ApiJobScheduledResponse = {
    status: 'ok';
    results: {
        jobId: string;
    };
};
export type ApiJobStatusResponse = {
    status: 'ok';
    results: {
        status: SchedulerJobStatus;
        details: Record<string, AnyType> | null;
    };
};
export type SchedulerCronUpdate = {
    schedulerUuid: string;
    cron: string;
};
export type ExportCsvDashboardPayload = TraceTaskBase & {
    dashboardUuid: string;
    dashboardFilters: DashboardFilters;
    selectedTabs: string[] | null;
    dateZoomGranularity?: DateGranularity | string;
};
export type ExportContentFormat = SchedulerFormat.IMAGE | SchedulerFormat.CSV | SchedulerFormat.XLSX;
export type ExportContentPayload = TraceTaskBase & {
    resourceType: SchedulerResourceType.DASHBOARD | SchedulerResourceType.CHART;
    resourceUuid: string;
    format: ExportContentFormat;
    options: SchedulerCsvOptions | SchedulerImageOptions;
    dashboardFilters?: DashboardFilters;
    dateZoomGranularity?: DateGranularity | string;
    customViewportWidth?: number;
    selectedTabs?: string[] | null;
};
export type ExportContentRequest = {
    format: ExportContentFormat;
    options?: SchedulerCsvOptions | SchedulerImageOptions;
    dashboardFilters?: DashboardFilters;
    dateZoomGranularity?: DateGranularity | string;
    customViewportWidth?: number;
    selectedTabs?: string[] | null;
};
export type DownloadAsyncQueryResultsPayload = TraceTaskBase & {
    queryUuid: string;
    type?: DownloadFileType;
    onlyRaw?: boolean;
    showTableNames?: boolean;
    customLabels?: Record<string, string>;
    columnOrder?: string[];
    hiddenFields?: string[];
    pivotConfig?: PivotConfig;
    exportPivotedData?: boolean;
    attachmentDownloadName?: string;
    encodedJwt?: string;
};
export type SyncSlackChannelsPayload = Pick<TraceTaskBase, 'organizationUuid' | 'schedulerUuid'> & {
    projectUuid: undefined;
    userUuid: undefined;
};
//# sourceMappingURL=scheduler.d.ts.map