import type { IDialect, DialectType, ConnectionConfig, EntitySchema, FieldDef, FilterQuery as DALFilter, QueryOptions, AggregateStage } from '../core/types.js';
interface WhereClause {
    sql: string;
    params: unknown[];
}
export declare abstract class AbstractSqlDialect implements IDialect {
    abstract readonly dialectType: DialectType;
    /** Quote an identifier (column/table name) for this dialect */
    abstract quoteIdentifier(name: string): string;
    /** Get the parameter placeholder for index (1-based). E.g. $1, ?, :1, @p1 */
    abstract getPlaceholder(index: number): string;
    /** Map a DAL FieldDef to the native SQL column type */
    abstract fieldToSqlType(field: FieldDef): string;
    /** Get the SQL column type for the primary key (id) column */
    abstract getIdColumnType(): string;
    /** Execute a SELECT query via the dialect's native driver (npm) */
    abstract doExecuteQuery<T>(sql: string, params: unknown[]): Promise<T[]>;
    /** Execute a non-SELECT statement via the dialect's native driver (npm) */
    abstract doExecuteRun(sql: string, params: unknown[]): Promise<{
        changes: number;
    }>;
    /** Execute a SELECT query — routes to JDBC bridge or native driver */
    executeQuery<T>(sql: string, params: unknown[]): Promise<T[]>;
    /** Execute a non-SELECT statement — routes to JDBC bridge or native driver */
    executeRun(sql: string, params: unknown[]): Promise<{
        changes: number;
    }>;
    /** Establish the actual database connection */
    abstract doConnect(config: ConnectionConfig): Promise<void>;
    /** Close the actual database connection */
    abstract doDisconnect(): Promise<void>;
    /** Test the connection is alive */
    abstract doTestConnection(): Promise<boolean>;
    /** Return a SQL query that lists table names. Result rows must have a 'name' column. */
    abstract getTableListQuery(): string;
    protected config: ConnectionConfig | null;
    protected schemas: EntitySchema[];
    protected showSql: boolean;
    protected formatSql: boolean;
    protected highlightEnabled: boolean;
    private paramCounter;
    private bridgeInstance;
    private jdbcBridgeActive;
    /** Whether this dialect supports CREATE TABLE IF NOT EXISTS */
    protected supportsIfNotExists(): boolean;
    /** Whether this dialect supports RETURNING clause on INSERT */
    protected supportsReturning(): boolean;
    /** Serialize a JS boolean to a DB value (default: 1/0) */
    protected serializeBoolean(v: boolean): unknown;
    /** Deserialize a DB value to a JS boolean */
    protected deserializeBoolean(v: unknown): boolean;
    /** Build the LIMIT/OFFSET clause (dialect-specific override) */
    protected buildLimitOffset(options?: QueryOptions): string;
    /** Get the CREATE TABLE prefix, including IF NOT EXISTS when supported */
    protected getCreateTablePrefix(tableName: string): string;
    /** Get the CREATE INDEX prefix, including IF NOT EXISTS when supported */
    protected getCreateIndexPrefix(indexName: string, unique: boolean): string;
    /** Execute a CREATE INDEX statement — overridable for dialects needing try/catch */
    protected executeIndexStatement(stmt: string): Promise<void>;
    /** Serialize date values to a format suitable for this dialect */
    protected serializeDate(value: unknown): unknown;
    /** Serialize JSON/array values */
    protected serializeJson(value: unknown): unknown;
    /**
     * Build a regex/LIKE condition. Override for case-sensitive dialects.
     * Default: LIKE (case-insensitive in MySQL, SQLite, MSSQL; case-sensitive in Postgres, Oracle, DB2, HANA).
     * Postgres overrides to use ILIKE when flags contain 'i'.
     */
    protected buildRegexCondition(col: string, flags?: string): string;
    /** Dialect label for logging */
    protected getDialectLabel(): string;
    protected log(operation: string, table: string, details?: unknown): void;
    /** Reset the parameter counter (call before building a new statement) */
    protected resetParams(): void;
    /** Get the next placeholder and increment the counter */
    protected nextPlaceholder(): string;
    protected serializeValue(value: unknown, field?: FieldDef): unknown;
    protected deserializeRow(row: Record<string, unknown>, schema: EntitySchema): Record<string, unknown>;
    protected deserializeField(val: unknown, field: FieldDef): unknown;
    /**
     * Inject discriminator filter into any query.
     * If the schema has discriminator + discriminatorValue, adds: AND _type = 'article'
     */
    protected applyDiscriminator(filter: DALFilter, schema: EntitySchema): DALFilter;
    /**
     * Inject discriminator field into INSERT data.
     * If the schema has discriminator + discriminatorValue, adds _type: 'article' to the row.
     */
    protected applyDiscriminatorToData(data: Record<string, unknown>, schema: EntitySchema): Record<string, unknown>;
    /**
     * Add discriminator column to CREATE TABLE DDL if schema uses single-table inheritance.
     */
    protected getDiscriminatorColumnDDL(schema: EntitySchema): string | null;
    /**
     * Inject soft-delete filter: WHERE deletedAt IS NULL
     * Automatically applied to find/count/distinct/search queries.
     */
    protected applySoftDeleteFilter(filter: DALFilter, schema: EntitySchema): DALFilter;
    protected translateFilter(filter: DALFilter, schema: EntitySchema): WhereClause;
    protected serializeForFilter(value: unknown, fieldName: string, schema: EntitySchema): unknown;
    protected buildSelectColumns(schema: EntitySchema, options?: QueryOptions): string;
    protected getAllColumns(schema: EntitySchema): string[];
    protected buildOrderBy(options?: QueryOptions): string;
    protected prepareInsertData(schema: EntitySchema, data: Record<string, unknown>): {
        columns: string[];
        placeholders: string[];
        values: unknown[];
    };
    protected prepareUpdateData(schema: EntitySchema, data: Record<string, unknown>): {
        setClauses: string[];
        values: unknown[];
    };
    protected generateCreateTable(schema: EntitySchema): string;
    protected generateIndexes(schema: EntitySchema): string[];
    connect(config: ConnectionConfig): Promise<void>;
    disconnect(): Promise<void>;
    testConnection(): Promise<boolean>;
    /**
     * Execute a SELECT query via the JDBC bridge.
     * Called transparently when jdbcBridgeActive is true.
     */
    protected bridgeExecuteQuery<T>(sql: string, params: unknown[]): Promise<T[]>;
    /**
     * Execute a non-SELECT statement via the JDBC bridge.
     * Called transparently when jdbcBridgeActive is true.
     */
    protected bridgeExecuteRun(sql: string, params: unknown[]): Promise<{
        changes: number;
    }>;
    /** Whether the JDBC bridge is active for this dialect instance */
    protected get isJdbcBridgeActive(): boolean;
    initSchema(schemas: EntitySchema[]): Promise<void>;
    find<T>(schema: EntitySchema, filter: DALFilter, options?: QueryOptions): Promise<T[]>;
    findOne<T>(schema: EntitySchema, filter: DALFilter, options?: QueryOptions): Promise<T | null>;
    findById<T>(schema: EntitySchema, id: string, options?: QueryOptions): Promise<T | null>;
    create<T>(schema: EntitySchema, data: Record<string, unknown>): Promise<T>;
    update<T>(schema: EntitySchema, id: string, data: Record<string, unknown>): Promise<T | null>;
    updateMany(schema: EntitySchema, filter: DALFilter, data: Record<string, unknown>): Promise<number>;
    delete(schema: EntitySchema, id: string): Promise<boolean>;
    deleteMany(schema: EntitySchema, filter: DALFilter): Promise<number>;
    count(schema: EntitySchema, filter: DALFilter): Promise<number>;
    distinct(schema: EntitySchema, field: string, filter: DALFilter): Promise<unknown[]>;
    aggregate<T>(schema: EntitySchema, stages: AggregateStage[]): Promise<T[]>;
    findWithRelations<T>(schema: EntitySchema, filter: DALFilter, relations: string[], options?: QueryOptions): Promise<T[]>;
    findByIdWithRelations<T>(schema: EntitySchema, id: string, relations: string[], options?: QueryOptions): Promise<T | null>;
    private populateRelations;
    upsert<T>(schema: EntitySchema, filter: DALFilter, data: Record<string, unknown>): Promise<T>;
    increment(schema: EntitySchema, id: string, field: string, amount: number): Promise<Record<string, unknown>>;
    addToSet(schema: EntitySchema, id: string, field: string, value: unknown): Promise<Record<string, unknown> | null>;
    pull(schema: EntitySchema, id: string, field: string, value: unknown): Promise<Record<string, unknown> | null>;
    search<T>(schema: EntitySchema, query: string, fields: string[], options?: QueryOptions): Promise<T[]>;
    /** Check if a table exists */
    protected tableExists(tableName: string): Promise<boolean>;
    /** Drop all tables (used by 'create' and 'create-drop' strategies) */
    protected dropAllTables(): Promise<void>;
}
export {};
