import { AbstractParseTreeVisitor } from 'antlr4ts/tree';
import { Range } from 'vscode-languageserver-textdocument';
import { ColumnReferenceContext, DereferenceContext, InsertContext, QueryContext, QueryPrimaryContext, SelectContext, TableReferenceContext } from '../lib/FlinkSQLParser';
import { FlinkSQLParserVisitor } from '../lib/FlinkSQLParserVisitor';
import { EdgeType, TablePrimary } from '../lineage';
export interface ColumnRef {
    tableId: string;
    columnId: string;
    isAssumed: boolean;
}
export declare class Column {
    readonly id: string;
    label: string;
    readonly range?: Range | undefined;
    readonly data?: unknown;
    readonly isAssumed?: boolean | undefined;
    readonly columnReferences: ColumnRef[];
    constructor(id: string, label: string, range?: Range | undefined, data?: unknown, isAssumed?: boolean | undefined);
}
export declare abstract class Relation {
    readonly id: string;
    readonly columns: Column[];
    readonly parent?: QueryRelation | InsertRelation | undefined;
    readonly range?: Range | undefined;
    protected constructor(id: string, columns: Column[], parent?: QueryRelation | InsertRelation | undefined, range?: Range | undefined);
    findColumn(columnName: string): Column | undefined;
    resolveColumn(columnName: string): ColumnRef | undefined;
}
export declare class TableRelation extends Relation {
    readonly tablePrimary: TablePrimary;
    readonly data?: unknown;
    constructor(id: string, tablePrimary: TablePrimary, columns: Column[], parent?: QueryRelation, range?: Range, data?: unknown);
    addAssumedColumn(columnName: string, range: Range): ColumnRef;
}
export declare class QueryRelation extends Relation {
    ctes: Map<string, QueryRelation>;
    relations: Map<string, Relation>;
    columnIdSeq: number;
    currentClause?: EdgeType;
    currentColumnId?: string;
    columnReferences: ColumnRef[];
    constructor(id: string, parent?: QueryRelation | InsertRelation, range?: Range);
    getNextColumnId(): string;
    findLocalRelation(tableName: string): Relation | undefined;
    findRelation(tableName: string): Relation | undefined;
    findCTE(tableName: string): Relation | undefined;
    resolveOrAssumeRelationColumn(columnName: string, range: Range, tableName?: string): ColumnRef | undefined;
}
export declare class InsertRelation extends Relation {
    constructor(id: string, range?: Range);
    columnIdSeq: number;
    sinkTableRelation?: TableRelation;
    getNextColumnId(): string;
}
export declare abstract class InsertQueryVisitor<Result> extends AbstractParseTreeVisitor<Result> implements FlinkSQLParserVisitor<Result> {
    private relationInsertSeq;
    private relationSeq;
    lastQueryRelation: QueryRelation | undefined;
    protected currentInsertRelation?: InsertRelation;
    protected currentQueryRelation?: QueryRelation;
    abstract onRelation(_relation: TableRelation | QueryRelation | InsertRelation, _alias?: string): void;
    abstract onColumnReference(_tableId: string, _columnId?: string): void;
    protected constructor();
    getNextInsertRelationId(): string;
    getNextRelationId(): string;
    private rangeFromContext;
    private reportTableReferences;
    visitInsert(ctx: InsertContext): Result;
    visitQuery(ctx: QueryContext): Result;
    visitQueryPrimary(ctx: QueryPrimaryContext): Result;
    visitSelect(ctx: SelectContext): Result;
    visitTableReference(ctx: TableReferenceContext): Result;
    visitColumnReference(ctx: ColumnReferenceContext): Result;
    visitDereference(ctx: DereferenceContext): Result;
}
