import type { Deferred } from "@metabase/embedding-sdk-react/dist/frontend/src/metabase/lib/promise";
import type { QueryModalType } from "@metabase/embedding-sdk-react/dist/frontend/src/metabase/query_builder/constants";
import type { Widget } from "@metabase/embedding-sdk-react/dist/frontend/src/metabase/visualizations/components/ChartSettings/types";
import type { Card, DashboardId, Dataset, Field, ParameterValueOrArray, TimelineEventId } from "@metabase/embedding-sdk-react/dist/frontend/src/metabase-types/api";
export type QueryBuilderMode = "view" | "notebook" | "dataset";
export type DatasetEditorTab = "query" | "metadata";
export type QueryBuilderQueryStatus = "idle" | "running" | "complete";
export type InitialChartSettingState = {
    section?: string | null;
    widget?: Widget | null;
};
export type ForeignKeyReference = {
    status: number;
    value: number;
};
export interface QueryBuilderUIControls {
    isModifiedFromNotebook: boolean;
    isShowingDataReference: boolean;
    isShowingTemplateTagsEditor: boolean;
    isShowingNewbModal: boolean;
    isRunning: boolean;
    isQueryComplete: boolean;
    isShowingSummarySidebar: boolean;
    isShowingChartTypeSidebar: boolean;
    isShowingChartSettingsSidebar: boolean;
    isShowingQuestionDetailsSidebar: boolean;
    isShowingQuestionInfoSidebar: boolean;
    isShowingSnippetSidebar: boolean;
    isShowingTimelineSidebar: boolean;
    isNativeEditorOpen: boolean;
    initialChartSetting: InitialChartSettingState;
    isShowingRawTable: boolean;
    queryBuilderMode: QueryBuilderMode | false;
    previousQueryBuilderMode: boolean;
    snippetCollectionId: number | null;
    datasetEditorTab: DatasetEditorTab;
    isShowingNotebookNativePreview: boolean;
    notebookNativePreviewSidebarWidth: number | null;
    showSidebarTitle: boolean;
    modal: QueryModalType | null;
    modalContext: TimelineEventId | null;
    dataReferenceStack: null;
}
export interface QueryBuilderLoadingControls {
    showLoadCompleteFavicon: boolean;
    documentTitle: string;
    timeoutId: string;
}
export interface QueryBuilderDashboardState {
    dashboardId: DashboardId | null;
    isEditing: boolean;
}
export interface QueryBuilderState {
    uiControls: QueryBuilderUIControls;
    loadingControls: QueryBuilderLoadingControls;
    parentDashboard: QueryBuilderDashboardState;
    queryStatus: QueryBuilderQueryStatus;
    queryResults: Dataset[] | null;
    queryStartTime: number | null;
    cancelQueryDeferred: Deferred<void> | null;
    card: Card | null;
    originalCard: Card | null;
    lastRunCard: Card | null;
    parameterValues: Record<string, ParameterValueOrArray>;
    zoomedRowObjectId: number | string | null;
    tableForeignKeyReferences: Record<number, ForeignKeyReference> | null;
    selectedTimelineEventIds: number[];
    metadataDiff: Record<string, Partial<Field>>;
    currentState: {
        card: Card;
        cardId?: number;
        serializedCard: string;
    } | null;
}
