import { SelectQuery } from "./SelectQuery";
import type { InsertQuery } from "./InsertQuery";
import type { UpdateQuery } from "./UpdateQuery";
import type { DeleteQuery } from "./DeleteQuery";
import type { MergeQuery } from "./MergeQuery";
import { SqlComponent } from "./SqlComponent";
import { IdentifierString, RawString, ValueComponent, WindowFrameExpression, QualifiedName } from "./ValueComponent";
import { HintClause } from "./HintClause";
export declare class SelectItem extends SqlComponent {
    static kind: symbol;
    value: ValueComponent;
    identifier: IdentifierString | null;
    constructor(value: ValueComponent, name?: string | null);
}
export declare class SelectClause extends SqlComponent {
    static kind: symbol;
    items: SelectItem[];
    distinct: DistinctComponent | null;
    hints: HintClause[];
    constructor(items: SelectItem[], distinct?: DistinctComponent | null, hints?: HintClause[]);
}
export type DistinctComponent = Distinct | DistinctOn;
export declare class Distinct extends SqlComponent {
    static kind: symbol;
    constructor();
}
export declare class DistinctOn extends SqlComponent {
    static kind: symbol;
    value: ValueComponent;
    constructor(value: ValueComponent);
}
export declare class WhereClause extends SqlComponent {
    static kind: symbol;
    condition: ValueComponent;
    constructor(condition: ValueComponent);
}
export declare class PartitionByClause extends SqlComponent {
    static kind: symbol;
    value: ValueComponent;
    constructor(value: ValueComponent);
}
export declare class WindowFrameClause extends SqlComponent {
    static kind: symbol;
    name: IdentifierString;
    expression: WindowFrameExpression;
    constructor(name: string, expression: WindowFrameExpression);
}
/**
 * Represents a collection of window definitions (WINDOW clause in SQL).
 * @param windows Array of WindowFrameClause
 */
export declare class WindowsClause extends SqlComponent {
    static kind: symbol;
    windows: WindowFrameClause[];
    constructor(windows: WindowFrameClause[]);
}
export declare enum SortDirection {
    Ascending = "asc",
    Descending = "desc"
}
export declare enum NullsSortDirection {
    First = "first",
    Last = "last"
}
export type OrderByComponent = OrderByItem | ValueComponent;
export declare class OrderByClause extends SqlComponent {
    static kind: symbol;
    order: OrderByComponent[];
    constructor(items: OrderByComponent[]);
}
export declare class OrderByItem extends SqlComponent {
    static kind: symbol;
    value: ValueComponent;
    sortDirection: SortDirection;
    nullsPosition: NullsSortDirection | null;
    constructor(expression: ValueComponent, sortDirection: SortDirection | null, nullsPosition: NullsSortDirection | null);
}
export declare class GroupByClause extends SqlComponent {
    static kind: symbol;
    mode: "all" | "distinct" | null;
    grouping: ValueComponent[];
    constructor(expression: ValueComponent[], mode?: "all" | "distinct" | null);
}
export declare class HavingClause extends SqlComponent {
    static kind: symbol;
    condition: ValueComponent;
    constructor(condition: ValueComponent);
}
export type SourceComponent = TableSource | FunctionSource | SubQuerySource | ParenSource;
export declare class TableSource extends SqlComponent {
    static kind: symbol;
    qualifiedName: QualifiedName;
    /**
     * For backward compatibility: returns the namespaces as IdentifierString[] | null (readonly)
     */
    get namespaces(): IdentifierString[] | null;
    /**
     * For backward compatibility: returns the table name as IdentifierString (readonly)
     */
    get table(): IdentifierString;
    /**
     * For backward compatibility: returns the table name as IdentifierString (readonly)
     */
    get identifier(): IdentifierString;
    constructor(namespaces: string[] | IdentifierString[] | null, table: string | IdentifierString);
    getSourceName(): string;
}
export declare class FunctionSource extends SqlComponent {
    static kind: symbol;
    qualifiedName: QualifiedName;
    argument: ValueComponent | null;
    /**
     * Indicates whether the function source was declared with WITH ORDINALITY,
     * as found in table-function expressions such as `unnest(...) WITH ORDINALITY`.
     */
    withOrdinality: boolean;
    constructor(name: string | IdentifierString | {
        namespaces: string[] | IdentifierString[] | null;
        name: string | RawString | IdentifierString;
    }, argument: ValueComponent | null, withOrdinality?: boolean);
    /**
     * For backward compatibility: returns the namespaces as IdentifierString[] | null (readonly)
     */
    get namespaces(): IdentifierString[] | null;
    /**
     * For backward compatibility: returns the function name as RawString | IdentifierString (readonly)
     */
    get name(): RawString | IdentifierString;
}
export declare class ParenSource extends SqlComponent {
    static kind: symbol;
    source: SourceComponent;
    constructor(source: SourceComponent);
}
export declare class SubQuerySource extends SqlComponent {
    static kind: symbol;
    query: SelectQuery;
    constructor(query: SelectQuery);
}
export declare class SourceExpression extends SqlComponent {
    static kind: symbol;
    datasource: SourceComponent;
    aliasExpression: SourceAliasExpression | null;
    constructor(datasource: SourceComponent, aliasExpression: SourceAliasExpression | null);
    getAliasName(): string | null;
}
export type JoinConditionComponent = JoinOnClause | JoinUsingClause;
export declare class JoinOnClause extends SqlComponent {
    static kind: symbol;
    condition: ValueComponent;
    constructor(condition: ValueComponent);
}
export declare class JoinUsingClause extends SqlComponent {
    static kind: symbol;
    condition: ValueComponent;
    constructor(condition: ValueComponent);
}
export declare class JoinClause extends SqlComponent {
    static kind: symbol;
    joinType: RawString;
    source: SourceExpression;
    condition: JoinConditionComponent | null;
    lateral: boolean;
    constructor(joinType: string, source: SourceExpression, condition: JoinConditionComponent | null, lateral: boolean);
    getSourceAliasName(): string | null;
}
export declare class FromClause extends SqlComponent {
    static kind: symbol;
    source: SourceExpression;
    joins: JoinClause[] | null;
    constructor(source: SourceExpression, join: JoinClause[] | null);
    getSourceAliasName(): string | null;
    /**
     * Returns all SourceExpression objects in this FROM clause, including main source and all JOIN sources.
     */
    getSources(): SourceExpression[];
}
export declare class UsingClause extends SqlComponent {
    static kind: symbol;
    sources: SourceExpression[];
    constructor(sources: SourceExpression[]);
    getSources(): SourceExpression[];
}
/**
 * Query types permitted inside a CTE body.
 */
export type CTEQuery = SelectQuery | InsertQuery | UpdateQuery | DeleteQuery | MergeQuery;
export declare class CommonTable extends SqlComponent {
    static kind: symbol;
    query: CTEQuery;
    materialized: boolean | null;
    aliasExpression: SourceAliasExpression;
    constructor(query: CTEQuery, aliasExpression: SourceAliasExpression | string, materialized: boolean | null);
    getSourceAliasName(): string;
}
export declare class WithClause extends SqlComponent {
    static kind: symbol;
    recursive: boolean;
    tables: CommonTable[];
    trailingComments: string[] | null;
    globalComments: string[] | null;
    constructor(recursive: boolean, tables: CommonTable[]);
}
export declare class LimitClause extends SqlComponent {
    static kind: symbol;
    value: ValueComponent;
    constructor(limit: ValueComponent);
}
export declare enum FetchType {
    Next = "next",
    First = "first"
}
export declare enum FetchUnit {
    RowsOnly = "rows only",
    Percent = "percent",
    PercentWithTies = "percent with ties"
}
export declare class OffsetClause extends SqlComponent {
    static kind: symbol;
    value: ValueComponent;
    constructor(value: ValueComponent);
}
export declare class FetchClause extends SqlComponent {
    static kind: symbol;
    expression: FetchExpression;
    constructor(expression: FetchExpression);
}
export declare class FetchExpression extends SqlComponent {
    static kind: symbol;
    type: FetchType;
    count: ValueComponent;
    unit: FetchUnit | null;
    constructor(type: FetchType, count: ValueComponent, unit: FetchUnit | null);
}
export declare enum LockMode {
    Update = "update",
    Share = "share",
    KeyShare = "key share",
    NokeyUpdate = "no key update"
}
export declare class ForClause extends SqlComponent {
    static kind: symbol;
    lockMode: LockMode;
    constructor(lockMode: LockMode);
}
export declare class SourceAliasExpression extends SqlComponent {
    static kind: symbol;
    table: IdentifierString;
    columns: IdentifierString[] | null;
    constructor(alias: string, columnAlias: string[] | null);
}
export type ReturningAliasKind = "old" | "new";
export declare class ReturningAlias extends SqlComponent {
    static kind: symbol;
    kind: ReturningAliasKind;
    alias: IdentifierString;
    constructor(kind: ReturningAliasKind, alias: string | IdentifierString);
}
export declare class ReturningClause extends SqlComponent {
    static kind: symbol;
    items: SelectItem[];
    aliases: ReturningAlias[];
    /**
     * Constructs a ReturningClause.
     * @param items Array of SelectItem.
     */
    constructor(items: SelectItem[], aliases?: ReturningAlias[]);
    /**
     * @deprecated Use items instead. This getter is for backward compatibility and may not return accurate results for expressions.
     */
    get columns(): IdentifierString[];
}
export type OnConflictAction = "nothing" | "select" | "update";
export type OnConflictTargetKind = "columns" | "constraint";
export declare class OnConflictClause extends SqlComponent {
    static kind: symbol;
    target: RawString | null;
    targetKind: OnConflictTargetKind | null;
    action: OnConflictAction;
    setClause: SetClause | null;
    forClause: ForClause | null;
    whereClause: WhereClause | null;
    constructor(params: {
        target?: RawString | string | null;
        targetKind?: OnConflictTargetKind | null;
        action: OnConflictAction;
        setClause?: SetClause | null;
        forClause?: ForClause | null;
        whereClause?: WhereClause | null;
    });
}
export declare class SetClause extends SqlComponent {
    static kind: symbol;
    items: SetClauseItem[];
    constructor(items: (SetClauseItem | {
        column: string | IdentifierString;
        value: ValueComponent;
    })[]);
}
/**
 * Represents a single SET clause item in an UPDATE statement.
 */
/**
 * Represents a single SET clause item in an UPDATE statement.
 * Now supports namespaces for fully qualified column names (e.g. schema.table.column).
 */
/**
 * Represents a single SET clause item in an UPDATE statement.
 * Now supports namespaces for fully qualified column names (e.g. schema.table.column).
 * Refactored to use QualifiedName for unified name/namespace handling.
 */
export declare class SetClauseItem extends SqlComponent {
    static kind: symbol;
    qualifiedName: QualifiedName;
    value: ValueComponent;
    constructor(column: string | IdentifierString | {
        namespaces: string[] | IdentifierString[] | null;
        column: string | IdentifierString;
    }, value: ValueComponent);
    /**
     * For backward compatibility: returns the namespaces as IdentifierString[] | null (readonly)
     */
    get namespaces(): IdentifierString[] | null;
    /**
     * For backward compatibility: returns the column name as IdentifierString (readonly)
     */
    get column(): IdentifierString;
    /**
     * Returns the fully qualified column name as a string.
     */
    getFullName(): string;
}
export declare class UpdateClause extends SqlComponent {
    static kind: symbol;
    source: SourceExpression;
    constructor(source: SourceExpression);
    getSourceAliasName(): string | null;
}
export declare class DeleteClause extends SqlComponent {
    static kind: symbol;
    source: SourceExpression;
    constructor(source: SourceExpression);
    getSourceAliasName(): string | null;
}
/**
 * Represents the target table (with optional alias/schema) and columns for an INSERT statement.
 * @param source The target table as a SourceExpression (can include schema, alias, etc.)
 * @param columns Array of column names (as strings)
 */
export declare class InsertClause extends SqlComponent {
    source: SourceExpression;
    columns: IdentifierString[] | null;
    constructor(source: SourceExpression, columns?: (IdentifierString | string)[] | null);
}
