import { type AnyType } from './any';
import { type ApiSuccess } from './api/success';
import { type KnexPaginatedData } from './knex-paginate';
import { type SchedulerAndTargets, type SchedulerFormat, type SchedulerJobStatus } from './scheduler';
import { type SchedulerTaskName } from './schedulerTaskList';
export type SchedulerTargetType = 'email' | 'slack' | 'gsheets' | 'msteams' | 'googlechat';
export declare enum SchedulerResourceType {
    CHART = "chart",
    DASHBOARD = "dashboard",
    SQL_CHART = "sqlChart"
}
export declare enum PartialFailureType {
    MISSING_TARGETS = "missing_targets",
    DASHBOARD_CHART = "dashboard_chart",
    DASHBOARD_SQL_CHART = "dashboard_sql_chart"
}
export type DashboardChartPartialFailure = {
    type: PartialFailureType.DASHBOARD_CHART;
    chartUuid: string;
    chartName: string;
    tileUuid: string;
    error: string;
};
export type DashboardSqlChartPartialFailure = {
    type: PartialFailureType.DASHBOARD_SQL_CHART;
    savedSqlUuid: string;
    chartName: string;
    tileUuid: string;
    error: string;
};
export type MissingTargetsPartialFailure = {
    type: PartialFailureType.MISSING_TARGETS;
};
export type PartialFailure = DashboardChartPartialFailure | DashboardSqlChartPartialFailure | MissingTargetsPartialFailure;
/**
 * Outcome of evaluating a threshold-alert scheduler against the latest query results.
 * Emitted on `SchedulerDetails.thresholdStatus` and on the `scheduler_job.completed`
 * analytics event so downstream consumers (UI toasts, dashboards) can branch reliably.
 */
export declare enum ThresholdStatus {
    MET = "met",
    NOT_MET = "not_met"
}
export type SchedulerDetails = {
    projectUuid?: string;
    organizationUuid?: string;
    createdByUserUuid?: string;
    /** Partial failures that occurred during the scheduled delivery (e.g., some charts failed in a dashboard export) */
    partialFailures?: PartialFailure[];
    /** Set when a threshold-alert scheduler completed without sending a notification because the threshold was not met. */
    thresholdStatus?: ThresholdStatus;
    [key: string]: AnyType;
};
type BaseSchedulerLog = {
    jobId: string;
    task: SchedulerTaskName;
    status: SchedulerJobStatus;
    scheduledTime: Date;
    createdAt: Date;
};
export type SchedulerLog = BaseSchedulerLog & {
    schedulerUuid?: string;
    jobGroup?: string;
    target?: string;
    targetType?: SchedulerTargetType;
    details: SchedulerDetails;
};
export type CreateSchedulerLog = Omit<SchedulerLog, 'createdAt'>;
export type SchedulerWithLogs = {
    schedulers: SchedulerAndTargets[];
    users: {
        firstName: string;
        lastName: string;
        userUuid: string;
    }[];
    charts: {
        name: string;
        savedChartUuid: string;
    }[];
    dashboards: {
        name: string;
        dashboardUuid: string;
    }[];
    logs: SchedulerLog[];
};
export type ApiSchedulerLogsResponse = ApiSuccess<KnexPaginatedData<SchedulerWithLogs>>;
export declare enum SchedulerRunStatus {
    COMPLETED = "completed",
    PARTIAL_FAILURE = "partial_failure",
    FAILED = "failed",
    RUNNING = "running",
    SCHEDULED = "scheduled"
}
export type LogCounts = {
    total: number;
    scheduled: number;
    started: number;
    completed: number;
    error: number;
};
export type SchedulerRun = {
    runId: string;
    schedulerUuid: string;
    schedulerName: string;
    scheduledTime: Date;
    status: SchedulerJobStatus;
    runStatus: SchedulerRunStatus;
    createdAt: Date;
    details: Record<string, AnyType> | null;
    logCounts: LogCounts;
    resourceType: SchedulerResourceType;
    resourceUuid: string;
    resourceName: string;
    createdByUserUuid: string;
    createdByUserName: string;
    format: SchedulerFormat;
};
export type ApiSchedulerRunsResponse = ApiSuccess<KnexPaginatedData<SchedulerRun[]>>;
export type SchedulerRunLog = BaseSchedulerLog & {
    jobGroup: string;
    target: string | null;
    targetType: SchedulerTargetType | null;
    details: SchedulerDetails | null;
    isParent: boolean;
};
export type SchedulerRunLogsResponse = {
    runId: string;
    schedulerUuid: string;
    schedulerName: string;
    scheduledTime: Date;
    logs: SchedulerRunLog[];
    resourceType: SchedulerResourceType;
    resourceUuid: string;
    resourceName: string;
    createdByUserUuid: string;
    createdByUserName: string;
};
export type ApiSchedulerRunLogsResponse = ApiSuccess<SchedulerRunLogsResponse>;
export {};
//# sourceMappingURL=schedulerLog.d.ts.map