import { entityKind } from "../entity.js";
import type { AnyMsSqlColumn, MsSqlColumn } from "./columns/index.js";
import type { MsSqlTable } from "./table.js";
export type UpdateDeleteAction = 'cascade' | 'no action' | 'set null' | 'set default';
export type Reference = () => {
    readonly name?: string;
    readonly columns: MsSqlColumn[];
    readonly foreignTable: MsSqlTable;
    readonly foreignColumns: MsSqlColumn[];
};
export declare class ForeignKeyBuilder {
    static readonly [entityKind]: string;
    constructor(config: () => {
        name?: string;
        columns: MsSqlColumn[];
        foreignColumns: MsSqlColumn[];
    }, actions?: {
        onUpdate?: UpdateDeleteAction;
        onDelete?: UpdateDeleteAction;
    } | undefined);
    onUpdate(action: UpdateDeleteAction): this;
    onDelete(action: UpdateDeleteAction): this;
}
export type AnyForeignKeyBuilder = ForeignKeyBuilder;
export declare class ForeignKey {
    readonly table: MsSqlTable;
    static readonly [entityKind]: string;
    readonly reference: Reference;
    readonly onUpdate: UpdateDeleteAction | undefined;
    readonly onDelete: UpdateDeleteAction | undefined;
    constructor(table: MsSqlTable, builder: ForeignKeyBuilder);
    getName(): string | undefined;
}
type ColumnsWithTable<TTableName extends string, TColumns extends MsSqlColumn[]> = {
    [Key in keyof TColumns]: AnyMsSqlColumn<{
        tableName: TTableName;
    }>;
};
export type GetColumnsTable<TColumns extends MsSqlColumn | MsSqlColumn[]> = (TColumns extends MsSqlColumn ? TColumns : TColumns extends MsSqlColumn[] ? TColumns[number] : never) extends AnyMsSqlColumn<{
    tableName: infer TTableName extends string;
}> ? TTableName : never;
export declare function foreignKey<TTableName extends string, TForeignTableName extends string, TColumns extends [AnyMsSqlColumn<{
    tableName: TTableName;
}>, ...AnyMsSqlColumn<{
    tableName: TTableName;
}>[]]>(config: {
    name?: string;
    columns: TColumns;
    foreignColumns: ColumnsWithTable<TForeignTableName, TColumns>;
}): ForeignKeyBuilder;
export {};
