"""Type stubs for the Rust extension module."""

from typing import Any, List, Optional, Tuple

class BloomFilter:
    """A space-efficient probabilistic data structure for set membership testing."""

    num_bits: int
    num_hashes: int
    size_in_bytes: int
    false_positive_rate: float
    seed: int

    def __init__(
        self,
        expected_items: Optional[int] = None,
        false_positive_rate: float = 0.01,
        num_bits: Optional[int] = None,
        num_hashes: Optional[int] = None,
        seed: int = 0,
    ) -> None: ...
    def add(self, item: Any) -> None: ...
    def update(self, items: Any) -> None: ...
    def contains(self, item: Any) -> bool: ...
    def query(self, item: Any) -> bool: ...
    def merge(self, other: BloomFilter) -> None: ...
    def intersection(self, other: BloomFilter) -> BloomFilter: ...
    def copy(self) -> BloomFilter: ...
    def clear(self) -> None: ...
    def to_bytes(self) -> bytes: ...
    @staticmethod
    def from_bytes(data: bytes) -> BloomFilter: ...
    def to_json(self) -> str: ...
    @staticmethod
    def from_json(data: str) -> BloomFilter: ...
    def save(self, path: str) -> None: ...
    @staticmethod
    def load(path: str) -> BloomFilter: ...
    def bit_count(self) -> int: ...
    def fill_ratio(self) -> float: ...
    def estimate_count(self) -> float: ...
    def __len__(self) -> int: ...
    def __contains__(self, item: Any) -> bool: ...
    def __or__(self, other: BloomFilter) -> BloomFilter: ...
    def __ior__(self, other: BloomFilter) -> None: ...
    def __and__(self, other: BloomFilter) -> BloomFilter: ...
    def __repr__(self) -> str: ...


class CountingBloomFilter:
    """A Bloom filter variant that supports deletion using counters."""

    num_counters: int
    num_hashes: int
    size_in_bytes: int
    seed: int

    def __init__(
        self,
        expected_items: Optional[int] = None,
        false_positive_rate: float = 0.01,
        num_counters: Optional[int] = None,
        num_hashes: Optional[int] = None,
        seed: int = 0,
    ) -> None: ...
    def add(self, item: Any) -> None: ...
    def update(self, items: Any) -> None: ...
    def remove(self, item: Any) -> bool: ...
    def contains(self, item: Any) -> bool: ...
    def query(self, item: Any) -> bool: ...
    def merge(self, other: CountingBloomFilter) -> None: ...
    def copy(self) -> CountingBloomFilter: ...
    def clear(self) -> None: ...
    def to_bytes(self) -> bytes: ...
    @staticmethod
    def from_bytes(data: bytes) -> CountingBloomFilter: ...
    def to_json(self) -> str: ...
    @staticmethod
    def from_json(data: str) -> CountingBloomFilter: ...
    def save(self, path: str) -> None: ...
    @staticmethod
    def load(path: str) -> CountingBloomFilter: ...
    def __len__(self) -> int: ...
    def __contains__(self, item: Any) -> bool: ...
    def __repr__(self) -> str: ...


class ScalableBloomFilter:
    """A Bloom filter that automatically scales to accommodate more items."""

    num_slices: int
    size_in_bytes: int
    seed: int

    def __init__(
        self,
        initial_capacity: int = 1000,
        false_positive_rate: float = 0.01,
        growth_ratio: float = 2.0,
        fpr_ratio: float = 0.5,
        seed: int = 0,
    ) -> None: ...
    def add(self, item: Any) -> None: ...
    def update(self, items: Any) -> None: ...
    def contains(self, item: Any) -> bool: ...
    def query(self, item: Any) -> bool: ...
    def copy(self) -> ScalableBloomFilter: ...
    def clear(self) -> None: ...
    def capacity(self) -> int: ...
    def false_positive_rate(self) -> float: ...
    def to_bytes(self) -> bytes: ...
    @staticmethod
    def from_bytes(data: bytes) -> ScalableBloomFilter: ...
    def save(self, path: str) -> None: ...
    @staticmethod
    def load(path: str) -> ScalableBloomFilter: ...
    def __len__(self) -> int: ...
    def __contains__(self, item: Any) -> bool: ...
    def __repr__(self) -> str: ...


class CuckooFilter:
    """A space-efficient probabilistic filter with deletion support."""

    size_in_bytes: int
    seed: int

    def __init__(self, capacity: int, seed: int = 0) -> None: ...
    def add(self, item: str) -> bool: ...
    def update(self, items: List[str]) -> int: ...
    def contains(self, item: str) -> bool: ...
    def query(self, item: str) -> bool: ...
    def remove(self, item: str) -> bool: ...
    def copy(self) -> CuckooFilter: ...
    def clear(self) -> None: ...
    def capacity(self) -> int: ...
    def load_factor(self) -> float: ...
    def to_bytes(self) -> bytes: ...
    @staticmethod
    def from_bytes(data: bytes) -> CuckooFilter: ...
    def to_json(self) -> str: ...
    @staticmethod
    def from_json(data: str) -> CuckooFilter: ...
    def __len__(self) -> int: ...
    def __contains__(self, item: str) -> bool: ...
    def __repr__(self) -> str: ...


class HyperLogLog:
    """A probabilistic data structure for cardinality estimation."""

    precision: int
    size_in_bytes: int
    seed: int
    standard_error: float

    def __init__(self, precision: int = 14, seed: int = 0) -> None: ...
    def add(self, item: str) -> None: ...
    def update(self, items: List[str]) -> None: ...
    def cardinality(self) -> float: ...
    def query(self) -> float: ...
    def merge(self, other: HyperLogLog) -> None: ...
    def copy(self) -> HyperLogLog: ...
    def clear(self) -> None: ...
    def relative_error(self) -> float: ...
    def to_bytes(self) -> bytes: ...
    @staticmethod
    def from_bytes(data: bytes) -> HyperLogLog: ...
    def to_json(self) -> str: ...
    @staticmethod
    def from_json(data: str) -> HyperLogLog: ...
    def __len__(self) -> int: ...
    def __or__(self, other: HyperLogLog) -> HyperLogLog: ...
    def __ior__(self, other: HyperLogLog) -> None: ...
    def __repr__(self) -> str: ...


class CountMinSketch:
    """A probabilistic data structure for frequency estimation."""

    width: int
    depth: int
    size_in_bytes: int
    seed: int
    total_count: int

    def __init__(
        self,
        width: Optional[int] = None,
        depth: Optional[int] = None,
        error_rate: Optional[float] = None,
        confidence: Optional[float] = None,
        seed: int = 0,
    ) -> None: ...
    def add(self, item: str) -> None: ...
    def add_count(self, item: str, count: int = 1) -> None: ...
    def update(self, items: List[str]) -> None: ...
    def query(self, item: str) -> int: ...
    def count(self, item: str) -> int: ...
    def merge(self, other: CountMinSketch) -> None: ...
    def copy(self) -> CountMinSketch: ...
    def clear(self) -> None: ...
    def error_rate(self) -> float: ...
    def confidence(self) -> float: ...
    def inner_product(self, other: CountMinSketch) -> int: ...
    def to_bytes(self) -> bytes: ...
    @staticmethod
    def from_bytes(data: bytes) -> CountMinSketch: ...
    def to_json(self) -> str: ...
    @staticmethod
    def from_json(data: str) -> CountMinSketch: ...
    def __len__(self) -> int: ...
    def __getitem__(self, item: str) -> int: ...
    def __repr__(self) -> str: ...


class MinHash:
    """A probabilistic data structure for estimating set similarity."""

    num_hashes: int
    size_in_bytes: int
    seed: int

    def __init__(self, num_hashes: int = 128, seed: int = 0) -> None: ...
    def add(self, item: str) -> None: ...
    def update(self, items: List[str]) -> None: ...
    def jaccard(self, other: MinHash) -> float: ...
    def query(self, other: MinHash) -> float: ...
    def merge(self, other: MinHash) -> None: ...
    def copy(self) -> MinHash: ...
    def clear(self) -> None: ...
    def is_empty(self) -> bool: ...
    def get_signature(self) -> List[int]: ...
    def standard_error(self) -> float: ...
    def to_bytes(self) -> bytes: ...
    @staticmethod
    def from_bytes(data: bytes) -> MinHash: ...
    def to_json(self) -> str: ...
    @staticmethod
    def from_json(data: str) -> MinHash: ...
    def __or__(self, other: MinHash) -> MinHash: ...
    def __ior__(self, other: MinHash) -> None: ...
    def __repr__(self) -> str: ...


class TopK:
    """A probabilistic data structure for finding frequent items."""

    k: int
    size_in_bytes: int

    def __init__(self, k: int) -> None: ...
    def add(self, item: str) -> None: ...
    def add_count(self, item: str, count: int = 1) -> None: ...
    def update(self, items: List[str]) -> None: ...
    def query(self, item: str) -> int: ...
    def count(self, item: str) -> int: ...
    def contains(self, item: str) -> bool: ...
    def top(self, n: Optional[int] = None) -> List[Tuple[str, int]]: ...
    def top_with_error(self, n: Optional[int] = None) -> List[Tuple[str, int, int]]: ...
    def min_count(self) -> int: ...
    def merge(self, other: TopK) -> None: ...
    def copy(self) -> TopK: ...
    def clear(self) -> None: ...
    def to_bytes(self) -> bytes: ...
    @staticmethod
    def from_bytes(data: bytes) -> TopK: ...
    def to_json(self) -> str: ...
    @staticmethod
    def from_json(data: str) -> TopK: ...
    def __len__(self) -> int: ...
    def __contains__(self, item: str) -> bool: ...
    def __getitem__(self, item: str) -> int: ...
    def __repr__(self) -> str: ...
