/**
 * Filter Operators Module for Drizzle ORM
 *
 * This module provides a comprehensive set of filter operators that map
 * Sequelize-style filter syntax to Drizzle ORM where conditions.
 *
 * Supports:
 * - Basic comparison operators (eq, ne, gt, lt, gte, lte)
 * - String pattern matching (like, ilike, startsWith, endsWith)
 * - Collection operators (in, notIn)
 * - Range operators (between, notBetween)
 * - Null checks (isNull, isNotNull)
 * - Array operators (arraycontains, arraycontained)
 * - JSONB operators (jsonbContains, jsonbHasKey, jsonbPathExists, etc.)
 * - Geo/spatial operators (within, contains, intersects, dwithin)
 * - Column-to-column comparisons with $COL() syntax
 * - Type casting with PostgreSQL :: syntax
 */
import { SQL } from 'drizzle-orm';
import type { ColumnReference, FilterValue, OperatorContext } from '../types/index.js';
export type { ColumnReference, FilterValue, OperatorContext };
/**
 * Check if a value is a column reference
 * Format: $COL(columnName) or $COL(tableName.columnName)
 */
export declare function isColumnReference(value: any): value is ColumnReference;
/**
 * Extract column name/path from column reference
 */
export declare function extractColumnFromReference(value: ColumnReference): string;
/**
 * Parse PostgreSQL casting syntax from column reference
 * Example: "columnName::text" -> { columnPath: "columnName", castType: "text" }
 */
export declare function parseColumnCastSyntax(columnPath: string): {
    columnPath: string;
    castType: string | null;
};
/**
 * Build SQL identifier for column with optional casting
 */
export declare function buildColumnSQL(columnPath: string, castType?: string | null): SQL;
/**
 * Operator: Equality (eq)
 * Example: { age: { eq: 25 } } -> age = 25
 */
export declare function eqOperator(ctx: OperatorContext, value: FilterValue, castType?: string): SQL;
/**
 * Operator: Not Equal (ne)
 * Example: { status: { ne: 'inactive' } } -> status != 'inactive'
 * Example: { contract_number: { ne: null } } -> contract_number IS NOT NULL
 */
export declare function neOperator(ctx: OperatorContext, value: FilterValue, castType?: string): SQL;
/**
 * Operator: Greater Than (gt)
 * Example: { age: { gt: 18 } } -> age > 18
 */
export declare function gtOperator(ctx: OperatorContext, value: FilterValue, castType?: string): SQL;
/**
 * Operator: Greater Than or Equal (gte)
 * Example: { age: { gte: 18 } } -> age >= 18
 */
export declare function gteOperator(ctx: OperatorContext, value: FilterValue, castType?: string): SQL;
/**
 * Operator: Less Than (lt)
 * Example: { age: { lt: 65 } } -> age < 65
 */
export declare function ltOperator(ctx: OperatorContext, value: FilterValue, castType?: string): SQL;
/**
 * Operator: Less Than or Equal (lte)
 * Example: { age: { lte: 65 } } -> age <= 65
 */
export declare function lteOperator(ctx: OperatorContext, value: FilterValue, castType?: string): SQL;
/**
 * Operator: LIKE (case-sensitive pattern matching)
 * Example: { name: { like: 'John' } } -> name LIKE '%John%'
 */
export declare function likeOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: NOT LIKE (case-sensitive pattern non-matching)
 */
export declare function notLikeOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: ILIKE (case-insensitive pattern matching)
 * Example: { name: { iLike: 'john' } } -> name ILIKE '%john%'
 */
export declare function iLikeOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: NOT ILIKE (case-insensitive pattern non-matching)
 */
export declare function notILikeOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: Starts With (case-insensitive)
 * Example: { name: { startsWith: 'John' } } -> name ILIKE 'John%'
 */
export declare function startsWithOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: Starts With Case-Sensitive (startsWiths)
 */
export declare function startsWithsOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: Ends With (case-insensitive)
 * Example: { name: { endsWith: 'son' } } -> name ILIKE '%son'
 */
export declare function endsWithOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: Ends With Case-Sensitive (endsWiths)
 */
export declare function endsWithsOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: Not Starts With (case-insensitive)
 */
export declare function nstartsWithOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: Not Starts With Case-Sensitive
 */
export declare function nstartsWithsOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: Not Ends With (case-insensitive)
 */
export declare function nendsWithOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: Not Ends With Case-Sensitive
 */
export declare function nendsWithsOperator(ctx: OperatorContext, value: string, castType?: string): SQL;
/**
 * Operator: IN (value in array)
 * Example: { status: { in: ['active', 'pending'] } }
 */
export declare function inOperator(ctx: OperatorContext, value: any[], castType?: string): SQL;
/**
 * Operator: NOT IN (value not in array)
 * Example: { status: { notIn: ['deleted', 'archived'] } }
 */
export declare function notInOperator(ctx: OperatorContext, value: any[], castType?: string): SQL;
/**
 * Operator: BETWEEN (value in range)
 * Example: { age: { between: [18, 65] } } -> age BETWEEN 18 AND 65
 */
export declare function betweenOperator(ctx: OperatorContext, value: [any, any], castType?: string): SQL;
/**
 * Operator: NOT BETWEEN (value not in range)
 */
export declare function notBetweenOperator(ctx: OperatorContext, value: [any, any], castType?: string): SQL;
/**
 * Operator: IS NULL
 * Example: { deletedAt: { isNull: true } } -> deletedAt IS NULL
 */
export declare function isNullOperator(ctx: OperatorContext, value: boolean | string, castType?: string): SQL;
/**
 * Operator: IS NOT NULL
 * Example: { deletedAt: { isNotNull: true } } -> deletedAt IS NOT NULL
 */
export declare function isNotNullOperator(ctx: OperatorContext, value: boolean | string, castType?: string): SQL;
/**
 * Operator: Array Contains (@>)
 * Example: { tags: { arraycontains: ['javascript', 'nodejs'] } }
 * PostgreSQL: tags @> ARRAY['javascript', 'nodejs']
 */
export declare function arrayContainsOperator(ctx: OperatorContext, value: any | any[], elementType?: string): SQL;
/**
 * Operator: Array Contained By (<@)
 * Example: { tags: { arraycontained: ['javascript', 'nodejs', 'typescript'] } }
 * PostgreSQL: tags <@ ARRAY['javascript', 'nodejs', 'typescript']
 */
export declare function arrayContainedOperator(ctx: OperatorContext, value: any | any[], elementType?: string): SQL;
/**
 * Operator: JSONB Contains (@>)
 * Checks if the JSONB column contains the specified JSON value
 * Example: { metadata: { jsonbContains: { status: "active" } } }
 * PostgreSQL: metadata @> '{"status": "active"}'::jsonb
 *
 * This operator tests whether the left JSONB value contains the right JSONB value.
 * A JSONB value contains another if it has all the keys and matching values.
 */
export declare function jsonbContainsOperator(ctx: OperatorContext, value: any): SQL;
/**
 * Operator: JSONB Contained By (<@)
 * Checks if the JSONB column is contained by the specified JSON value
 * Example: { metadata: { jsonbContainedBy: { status: "active", type: "user", role: "admin" } } }
 * PostgreSQL: metadata <@ '{"status": "active", "type": "user", "role": "admin"}'::jsonb
 *
 * This operator tests whether the left JSONB value is contained by the right JSONB value.
 */
export declare function jsonbContainedByOperator(ctx: OperatorContext, value: any): SQL;
/**
 * Operator: JSONB Has Key (?)
 * Checks if the JSONB column has a specific top-level key
 * Example: { metadata: { jsonbHasKey: "status" } }
 * PostgreSQL: metadata ? 'status'
 */
export declare function jsonbHasKeyOperator(ctx: OperatorContext, value: string): SQL;
/**
 * Operator: JSONB Has Any Keys (?|)
 * Checks if the JSONB column has any of the specified keys
 * Example: { metadata: { jsonbHasAnyKeys: ["status", "type", "role"] } }
 * PostgreSQL: metadata ?| array['status', 'type', 'role']
 */
export declare function jsonbHasAnyKeysOperator(ctx: OperatorContext, value: string[]): SQL;
/**
 * Operator: JSONB Has All Keys (?&)
 * Checks if the JSONB column has all of the specified keys
 * Example: { metadata: { jsonbHasAllKeys: ["status", "type"] } }
 * PostgreSQL: metadata ?& array['status', 'type']
 */
export declare function jsonbHasAllKeysOperator(ctx: OperatorContext, value: string[]): SQL;
/**
 * Operator: JSONB Path Exists (using @?)
 * Checks if a JSON path exists and returns any items
 * Example: { metadata: { jsonbPathExists: "$.user.preferences" } }
 * PostgreSQL: metadata @? '$.user.preferences'
 *
 * This uses the JSON path language to query JSONB data.
 * The path can include filters like: $.items[*] ? (@.price > 10)
 */
export declare function jsonbPathExistsOperator(ctx: OperatorContext, value: string): SQL;
/**
 * Operator: JSONB Path Match (using @@)
 * Checks if a JSON path predicate returns true
 * Example: { metadata: { jsonbPathMatch: "$.price > 10" } }
 * PostgreSQL: metadata @@ '$.price > 10'
 *
 * The path predicate must return a boolean value.
 */
export declare function jsonbPathMatchOperator(ctx: OperatorContext, value: string): SQL;
/**
 * Operator: JSONB Not Contains (NOT @>)
 * Checks if the JSONB column does NOT contain the specified JSON value
 * Example: { metadata: { jsonbNotContains: { status: "deleted" } } }
 * PostgreSQL: NOT (metadata @> '{"status": "deleted"}'::jsonb)
 */
export declare function jsonbNotContainsOperator(ctx: OperatorContext, value: any): SQL;
/**
 * Operator: JSONB Key Equals (->>, then compare)
 * Access a top-level key and compare its text value
 * Example: { metadata: { jsonbKeyEquals: { key: "status", value: "active" } } }
 * PostgreSQL: metadata->>'status' = 'active'
 *
 * This is useful when you want to compare a specific key's value directly.
 */
export declare function jsonbKeyEqualsOperator(ctx: OperatorContext, value: {
    key: string;
    value: any;
}): SQL;
/**
 * Operator: JSONB Key Not Equals (->>, then compare)
 * Access a top-level key and compare its text value is NOT equal
 * Example: { metadata: { jsonbKeyNotEquals: { key: "status", value: "deleted" } } }
 * PostgreSQL: metadata->>'status' != 'deleted' OR metadata->>'status' IS NULL
 */
export declare function jsonbKeyNotEqualsOperator(ctx: OperatorContext, value: {
    key: string;
    value: any;
}): SQL;
/**
 * Operator: JSONB Key Greater Than
 * Access a top-level key and compare if value is greater than
 * Example: { metadata: { jsonbKeyGt: { key: "price", value: 100 } } }
 * PostgreSQL: (metadata->>'price')::numeric > 100
 */
export declare function jsonbKeyGtOperator(ctx: OperatorContext, value: {
    key: string;
    value: number;
}): SQL;
/**
 * Operator: JSONB Key Greater Than or Equal
 * Example: { metadata: { jsonbKeyGte: { key: "price", value: 100 } } }
 */
export declare function jsonbKeyGteOperator(ctx: OperatorContext, value: {
    key: string;
    value: number;
}): SQL;
/**
 * Operator: JSONB Key Less Than
 * Example: { metadata: { jsonbKeyLt: { key: "price", value: 100 } } }
 */
export declare function jsonbKeyLtOperator(ctx: OperatorContext, value: {
    key: string;
    value: number;
}): SQL;
/**
 * Operator: JSONB Key Less Than or Equal
 * Example: { metadata: { jsonbKeyLte: { key: "price", value: 100 } } }
 */
export declare function jsonbKeyLteOperator(ctx: OperatorContext, value: {
    key: string;
    value: number;
}): SQL;
/**
 * Operator: JSONB Key In (->>, then IN)
 * Access a top-level key and check if value is in a list
 * Example: { metadata: { jsonbKeyIn: { key: "status", values: ["active", "pending"] } } }
 * PostgreSQL: metadata->>'status' IN ('active', 'pending')
 */
export declare function jsonbKeyInOperator(ctx: OperatorContext, value: {
    key: string;
    values: any[];
}): SQL;
/**
 * Operator: JSONB Key Not In
 * Example: { metadata: { jsonbKeyNotIn: { key: "status", values: ["deleted", "archived"] } } }
 */
export declare function jsonbKeyNotInOperator(ctx: OperatorContext, value: {
    key: string;
    values: any[];
}): SQL;
/**
 * Operator: JSONB Key Like (->>, then ILIKE)
 * Access a top-level key and perform pattern matching
 * Example: { metadata: { jsonbKeyLike: { key: "name", pattern: "%john%" } } }
 * PostgreSQL: metadata->>'name' ILIKE '%john%'
 */
export declare function jsonbKeyLikeOperator(ctx: OperatorContext, value: {
    key: string;
    pattern: string;
}): SQL;
/**
 * Operator: JSONB Key Is Null
 * Check if a specific key's value is null (not if the key is missing)
 * Example: { metadata: { jsonbKeyIsNull: "deletedAt" } }
 * PostgreSQL: metadata->>'deletedAt' IS NULL
 */
export declare function jsonbKeyIsNullOperator(ctx: OperatorContext, value: string): SQL;
/**
 * Operator: JSONB Key Is Not Null
 * Check if a specific key's value is not null
 * Example: { metadata: { jsonbKeyIsNotNull: "createdAt" } }
 * PostgreSQL: metadata->>'createdAt' IS NOT NULL
 */
export declare function jsonbKeyIsNotNullOperator(ctx: OperatorContext, value: string): SQL;
/**
 * Operator: JSONB Array Length
 * Check the length of a JSONB array at a specific path
 * Example: { metadata: { jsonbArrayLength: { path: "items", op: "gte", value: 5 } } }
 * PostgreSQL: jsonb_array_length(metadata->'items') >= 5
 */
export declare function jsonbArrayLengthOperator(ctx: OperatorContext, value: {
    path?: string;
    op: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
    value: number;
}): SQL;
/**
 * Operator: JSONB Type Of
 * Check the type of a JSONB value or a key's value
 * Example: { metadata: { jsonbTypeOf: { path: "price", type: "number" } } }
 * PostgreSQL: jsonb_typeof(metadata->'price') = 'number'
 *
 * Valid types: 'object', 'array', 'string', 'number', 'boolean', 'null'
 */
export declare function jsonbTypeOfOperator(ctx: OperatorContext, value: {
    path?: string;
    type: string;
}): SQL;
/**
 * Operator: JSONB Deep Value (using #>> for nested path)
 * Access a deeply nested value and compare
 * Example: { metadata: { jsonbDeepValue: { path: ["user", "preferences", "theme"], value: "dark" } } }
 * PostgreSQL: metadata #>> '{user,preferences,theme}' = 'dark'
 *
 * The path array represents the keys to traverse.
 */
export declare function jsonbDeepValueOperator(ctx: OperatorContext, value: {
    path: string[];
    value: any;
    op?: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike';
}): SQL;
/**
 * Operator: ST_Within (geometry within)
 * Example: { location: { within: geoJSON } }
 */
export declare function withinOperator(ctx: OperatorContext, value: any): SQL;
/**
 * Operator: ST_Contains (geometry contains)
 * Example: { boundary: { containsGEO: geoJSON } }
 */
export declare function containsGEOOperator(ctx: OperatorContext, value: any): SQL;
/**
 * Operator: ST_Intersects (geometries intersect)
 * Example: { area: { intersects: geoJSON } }
 */
export declare function intersectsOperator(ctx: OperatorContext, value: any): SQL;
/**
 * Operator: NOT ST_Intersects
 */
export declare function nIntersectsOperator(ctx: OperatorContext, value: any): SQL;
/**
 * Operator: ST_DWithin (within distance)
 * Example: { location: { dwithin: { geometry: geoJSON, distance: 1000, not: false } } }
 * Uses ST_DistanceSpheroid for accurate earth-surface distance calculations in meters
 */
export declare function dwithinOperator(ctx: OperatorContext, value: {
    geometry: any;
    distance: number;
    not?: boolean;
}): SQL;
/**
 * Operator: Vector L2 distance filter (Euclidean)
 * Example: { embedding: { vectorL2: { vector: [0.1,...], threshold: 0.5 } } }
 *   -> embedding <-> '[0.1,...]' < 0.5
 * Uses Drizzle's native l2Distance for parameterized, injection-safe SQL.
 */
export declare function vectorL2Operator(ctx: OperatorContext, value: {
    vector: number[];
    threshold: number;
}): SQL;
/**
 * Operator: Vector cosine distance filter
 * Example: { embedding: { vectorCosine: { vector: [0.1,...], threshold: 0.2 } } }
 *   -> embedding <=> '[0.1,...]' < 0.2
 * Uses Drizzle's native cosineDistance for parameterized, injection-safe SQL.
 */
export declare function vectorCosineOperator(ctx: OperatorContext, value: {
    vector: number[];
    threshold: number;
}): SQL;
/**
 * Operator: Vector inner product filter (maximum inner product search)
 * Example: { embedding: { vectorInnerProduct: { vector: [0.1,...], threshold: 0.9 } } }
 *   -> (embedding <#> '[0.1,...]') * -1 > 0.9
 * Uses Drizzle's native innerProduct for parameterized, injection-safe SQL.
 */
export declare function vectorInnerProductOperator(ctx: OperatorContext, value: {
    vector: number[];
    threshold: number;
}): SQL;
/**
 * Operator: Vector L1 distance filter (Manhattan distance, requires pgvector >= 0.7)
 * Example: { embedding: { vectorL1: { vector: [0.1,...], threshold: 1.0 } } }
 *   -> embedding <+> '[0.1,...]' < 1.0
 * Uses Drizzle's native l1Distance for parameterized, injection-safe SQL.
 */
export declare function vectorL1Operator(ctx: OperatorContext, value: {
    vector: number[];
    threshold: number;
}): SQL;
/**
 * Operator: NOT
 * Example: { status: { not: 'active' } } -> status != 'active'
 * Example: { id: { not: null } } -> id IS NOT NULL
 */
export declare function notOperator(ctx: OperatorContext, value: FilterValue, castType?: string): SQL;
/**
 * Operator: IS
 * Example: { deletedAt: { is: null } } -> deletedAt IS NULL
 */
export declare function isOperator(ctx: OperatorContext, value: any, castType?: string): SQL;
/**
 * Map of operator names to their handler functions
 */
export declare const OPERATOR_MAP: {
    readonly eq: typeof eqOperator;
    readonly ne: typeof neOperator;
    readonly gt: typeof gtOperator;
    readonly gte: typeof gteOperator;
    readonly lt: typeof ltOperator;
    readonly lte: typeof lteOperator;
    readonly like: typeof likeOperator;
    readonly notLike: typeof notLikeOperator;
    readonly iLike: typeof iLikeOperator;
    readonly notILike: typeof notILikeOperator;
    readonly startsWith: typeof startsWithOperator;
    readonly startsWiths: typeof startsWithsOperator;
    readonly endsWith: typeof endsWithOperator;
    readonly endsWiths: typeof endsWithsOperator;
    readonly nstartsWith: typeof nstartsWithOperator;
    readonly nstartsWiths: typeof nstartsWithsOperator;
    readonly nendsWith: typeof nendsWithOperator;
    readonly nendsWiths: typeof nendsWithsOperator;
    readonly in: typeof inOperator;
    readonly notIn: typeof notInOperator;
    readonly not: typeof notOperator;
    readonly is: typeof isOperator;
    readonly between: typeof betweenOperator;
    readonly notBetween: typeof notBetweenOperator;
    readonly isNull: typeof isNullOperator;
    readonly isNotNull: typeof isNotNullOperator;
    readonly arraycontains: typeof arrayContainsOperator;
    readonly arraycontained: typeof arrayContainedOperator;
    readonly jsonbContains: typeof jsonbContainsOperator;
    readonly jsonbContainedBy: typeof jsonbContainedByOperator;
    readonly jsonbHasKey: typeof jsonbHasKeyOperator;
    readonly jsonbHasAnyKeys: typeof jsonbHasAnyKeysOperator;
    readonly jsonbHasAllKeys: typeof jsonbHasAllKeysOperator;
    readonly jsonbPathExists: typeof jsonbPathExistsOperator;
    readonly jsonbPathMatch: typeof jsonbPathMatchOperator;
    readonly jsonbNotContains: typeof jsonbNotContainsOperator;
    readonly jsonbKeyEquals: typeof jsonbKeyEqualsOperator;
    readonly jsonbKeyNotEquals: typeof jsonbKeyNotEqualsOperator;
    readonly jsonbKeyGt: typeof jsonbKeyGtOperator;
    readonly jsonbKeyGte: typeof jsonbKeyGteOperator;
    readonly jsonbKeyLt: typeof jsonbKeyLtOperator;
    readonly jsonbKeyLte: typeof jsonbKeyLteOperator;
    readonly jsonbKeyIn: typeof jsonbKeyInOperator;
    readonly jsonbKeyNotIn: typeof jsonbKeyNotInOperator;
    readonly jsonbKeyLike: typeof jsonbKeyLikeOperator;
    readonly jsonbKeyIsNull: typeof jsonbKeyIsNullOperator;
    readonly jsonbKeyIsNotNull: typeof jsonbKeyIsNotNullOperator;
    readonly jsonbArrayLength: typeof jsonbArrayLengthOperator;
    readonly jsonbTypeOf: typeof jsonbTypeOfOperator;
    readonly jsonbDeepValue: typeof jsonbDeepValueOperator;
    readonly within: typeof withinOperator;
    readonly containsGEO: typeof containsGEOOperator;
    readonly intersects: typeof intersectsOperator;
    readonly nIntersects: typeof nIntersectsOperator;
    readonly dwithin: typeof dwithinOperator;
    readonly vectorL2: typeof vectorL2Operator;
    readonly vectorCosine: typeof vectorCosineOperator;
    readonly vectorInnerProduct: typeof vectorInnerProductOperator;
    readonly vectorL1: typeof vectorL1Operator;
};
export type OperatorName = keyof typeof OPERATOR_MAP;
/**
 * Apply an operator to a column with a value
 */
export declare function applyOperator(operatorName: string, ctx: OperatorContext, value: FilterValue, castType?: string, elementType?: string): SQL | null;
//# sourceMappingURL=filterOperators.d.ts.map