from typing import Any, Sequence
from datetime import datetime

class Expr:
    def __invert__(self) -> Expr: ...

class RCDB:
    def __init__(self, path: str) -> None: ...
    @property
    def connection_path(self) -> str: ...
    def fetch(
        self,
        condition_names: Sequence[str],
        *,
        run_period: str | None = None,
        runs: Sequence[int] | None = None,
        run_min: int | None = None,
        run_max: int | None = None,
        filters: Expr | Sequence[Expr] | None = None,
    ) -> dict[int, dict[str, Any]]: ...
    def fetch_runs(
        self,
        *,
        run_period: str | None = None,
        runs: Sequence[int] | None = None,
        run_min: int | None = None,
        run_max: int | None = None,
        filters: Expr | Sequence[Expr] | None = None,
    ) -> list[int]: ...

class IntCondition:
    def eq(self, value: int) -> Expr: ...
    def ne(self, value: int) -> Expr: ...
    def gt(self, value: int) -> Expr: ...
    def ge(self, value: int) -> Expr: ...
    def lt(self, value: int) -> Expr: ...
    def le(self, value: int) -> Expr: ...

class FloatCondition:
    def eq(self, value: float) -> Expr: ...
    def gt(self, value: float) -> Expr: ...
    def ge(self, value: float) -> Expr: ...
    def lt(self, value: float) -> Expr: ...
    def le(self, value: float) -> Expr: ...

class StringCondition:
    def eq(self, value: str) -> Expr: ...
    def ne(self, value: str) -> Expr: ...
    def isin(self, values: Sequence[str]) -> Expr: ...
    def contains(self, value: str) -> Expr: ...

class BoolCondition:
    def is_true(self) -> Expr: ...
    def is_false(self) -> Expr: ...
    def exists(self) -> Expr: ...

class TimeCondition:
    def eq(self, value: datetime) -> Expr: ...
    def gt(self, value: datetime) -> Expr: ...
    def ge(self, value: datetime) -> Expr: ...
    def lt(self, value: datetime) -> Expr: ...
    def le(self, value: datetime) -> Expr: ...

def int_cond(name: str) -> IntCondition: ...
def float_cond(name: str) -> FloatCondition: ...
def string_cond(name: str) -> StringCondition: ...
def bool_cond(name: str) -> BoolCondition: ...
def time_cond(name: str) -> TimeCondition: ...
def all(*exprs: Expr) -> Expr: ...
def any(*exprs: Expr) -> Expr: ...

class Aliases:
    @property
    def is_production(self) -> Expr: ...
    @property
    def is_2018production(self) -> Expr: ...
    @property
    def is_primex_production(self) -> Expr: ...
    @property
    def is_dirc_production(self) -> Expr: ...
    @property
    def is_src_production(self) -> Expr: ...
    @property
    def is_cpp_production(self) -> Expr: ...
    @property
    def is_production_long(self) -> Expr: ...
    @property
    def is_cosmic(self) -> Expr: ...
    @property
    def is_empty_target(self) -> Expr: ...
    @property
    def is_amorph_radiator(self) -> Expr: ...
    @property
    def is_coherent_beam(self) -> Expr: ...
    @property
    def is_field_off(self) -> Expr: ...
    @property
    def is_field_on(self) -> Expr: ...
    @property
    def status_calibration(self) -> Expr: ...
    @property
    def status_approved_long(self) -> Expr: ...
    @property
    def status_approved(self) -> Expr: ...
    @property
    def status_unchecked(self) -> Expr: ...
    @property
    def status_reject(self) -> Expr: ...
    def approved_production(self, run_period: str) -> Expr: ...

aliases: Aliases

__all__ = [
    "RCDB",
    "IntCondition",
    "FloatCondition",
    "StringCondition",
    "BoolCondition",
    "TimeCondition",
    "Expr",
    "int_cond",
    "float_cond",
    "string_cond",
    "bool_cond",
    "time_cond",
    "all",
    "any",
    "aliases",
]
