import type { CardId, CardType, DatabaseId, DatasetQuery, TableId } from "@metabase/embedding-sdk-react/dist/frontend/src/metabase-types/api";
import type { CardMetadata, Clause, ClauseType, ColumnMetadata, Join, MetadataProvider, MetricMetadata, Query, SegmentMetadata, TableMetadata } from "./types";
export declare function fromLegacyQuery(databaseId: DatabaseId | null, metadataProvider: MetadataProvider, datasetQuery: DatasetQuery): Query;
/**
 * Use this in combination with Lib.metadataProvider(databaseId, legacyMetadata) and
 Lib.tableOrCardMetadata(metadataProvider, tableOrCardId);
 */
export declare function queryFromTableOrCardMetadata(metadataProvider: MetadataProvider, tableOrCardMetadata: TableMetadata | CardMetadata): Query;
export declare function toLegacyQuery(query: Query): DatasetQuery;
export declare function withDifferentTable(query: Query, tableId: TableId): Query;
export declare function suggestedName(query: Query): string;
export declare function stageCount(query: Query): number;
export declare function stageIndexes(query: Query): number[];
export declare const hasClauses: (query: Query, stageIndex: number) => boolean;
export declare function appendStage(query: Query): Query;
export declare function dropStage(query: Query): Query;
export declare function dropEmptyStages(query: Query): Query;
export declare function ensureFilterStage(query: Query): Query;
export declare function removeClause(query: Query, stageIndex: number, targetClause: Clause | Join): Query;
export declare function replaceClause(query: Query, stageIndex: number, targetClause: Clause | Join, newClause: Clause | ColumnMetadata | MetricMetadata | SegmentMetadata | Join): Query;
export declare function swapClauses(query: Query, stageIndex: number, sourceClause: Clause, targetClause: Clause): Query;
export declare function sourceTableOrCardId(query: Query): TableId | null;
export declare function canRun(query: Query, cardType: CardType): boolean;
export declare function canSave(query: Query, cardType: CardType): boolean;
export declare function asReturned(query: Query, stageIndex: number, cardId: CardId | undefined): {
    query: Query;
    stageIndex: number;
};
export declare function previewQuery(query: Query, stageIndex: number, clauseType: ClauseType, clauseIndex: number | null): Query | null;
