"""Type stubs for exp (expression filter) module."""

from typing import Any

Expr = dict[str, Any]

# Expression type constants
EXP_TYPE_NIL: int
EXP_TYPE_BOOL: int
EXP_TYPE_INT: int
EXP_TYPE_STRING: int
EXP_TYPE_LIST: int
EXP_TYPE_MAP: int
EXP_TYPE_BLOB: int
EXP_TYPE_FLOAT: int
EXP_TYPE_GEO: int
EXP_TYPE_HLL: int

# Value constructors
def int_val(val: int) -> Expr: ...
def float_val(val: float) -> Expr: ...
def string_val(val: str) -> Expr: ...
def bool_val(val: bool) -> Expr: ...
def blob_val(val: bytes) -> Expr: ...
def list_val(val: list) -> Expr: ...
def map_val(val: dict) -> Expr: ...
def geo_val(val: str) -> Expr: ...
def nil() -> Expr: ...
def infinity() -> Expr: ...
def wildcard() -> Expr: ...

# Bin accessors
def int_bin(name: str) -> Expr: ...
def float_bin(name: str) -> Expr: ...
def string_bin(name: str) -> Expr: ...
def bool_bin(name: str) -> Expr: ...
def blob_bin(name: str) -> Expr: ...
def list_bin(name: str) -> Expr: ...
def map_bin(name: str) -> Expr: ...
def geo_bin(name: str) -> Expr: ...
def hll_bin(name: str) -> Expr: ...
def bin_exists(name: str) -> Expr: ...
def bin_type(name: str) -> Expr: ...

# Record metadata
def key(exp_type: int) -> Expr: ...
def key_exists() -> Expr: ...
def set_name() -> Expr: ...
def record_size() -> Expr: ...
def last_update() -> Expr: ...
def since_update() -> Expr: ...
def void_time() -> Expr: ...
def ttl() -> Expr: ...
def is_tombstone() -> Expr: ...
def digest_modulo(modulo: int) -> Expr: ...

# Comparison operations
def eq(left: Expr, right: Expr) -> Expr: ...
def ne(left: Expr, right: Expr) -> Expr: ...
def gt(left: Expr, right: Expr) -> Expr: ...
def ge(left: Expr, right: Expr) -> Expr: ...
def lt(left: Expr, right: Expr) -> Expr: ...
def le(left: Expr, right: Expr) -> Expr: ...

# Logical operations
def and_(*exprs: Expr) -> Expr: ...
def or_(*exprs: Expr) -> Expr: ...
def not_(expr: Expr) -> Expr: ...
def xor_(*exprs: Expr) -> Expr: ...

# Numeric operations
def num_add(*exprs: Expr) -> Expr: ...
def num_sub(*exprs: Expr) -> Expr: ...
def num_mul(*exprs: Expr) -> Expr: ...
def num_div(*exprs: Expr) -> Expr: ...
def num_mod(numerator: Expr, denominator: Expr) -> Expr: ...
def num_pow(base: Expr, exponent: Expr) -> Expr: ...
def num_log(num: Expr, base: Expr) -> Expr: ...
def num_abs(value: Expr) -> Expr: ...
def num_floor(num: Expr) -> Expr: ...
def num_ceil(num: Expr) -> Expr: ...
def to_int(num: Expr) -> Expr: ...
def to_float(num: Expr) -> Expr: ...
def min_(*exprs: Expr) -> Expr: ...
def max_(*exprs: Expr) -> Expr: ...

# Integer bitwise operations
def int_and(*exprs: Expr) -> Expr: ...
def int_or(*exprs: Expr) -> Expr: ...
def int_xor(*exprs: Expr) -> Expr: ...
def int_not(expr: Expr) -> Expr: ...
def int_lshift(value: Expr, shift: Expr) -> Expr: ...
def int_rshift(value: Expr, shift: Expr) -> Expr: ...
def int_arshift(value: Expr, shift: Expr) -> Expr: ...
def int_count(expr: Expr) -> Expr: ...
def int_lscan(value: Expr, search: Expr) -> Expr: ...
def int_rscan(value: Expr, search: Expr) -> Expr: ...

# Pattern matching
def regex_compare(regex: str, flags: int, bin_expr: Expr) -> Expr: ...
def geo_compare(left: Expr, right: Expr) -> Expr: ...

# Variables and control flow
def cond(*exprs: Expr) -> Expr: ...
def var(name: str) -> Expr: ...
def def_(name: str, value: Expr) -> Expr: ...
def let_(*exprs: Expr) -> Expr: ...
