from .db_schema import ENTITY_ID_IN_EVENT as ENTITY_ID_IN_EVENT, OLD_ENTITY_ID_IN_EVENT as OLD_ENTITY_ID_IN_EVENT, States as States, StatesMeta as StatesMeta
from _typeshed import Incomplete
from collections.abc import Callable as Callable, Collection, Iterable
from homeassistant.const import CONF_DOMAINS as CONF_DOMAINS, CONF_ENTITIES as CONF_ENTITIES, CONF_EXCLUDE as CONF_EXCLUDE, CONF_INCLUDE as CONF_INCLUDE
from homeassistant.helpers.entityfilter import CONF_ENTITY_GLOBS as CONF_ENTITY_GLOBS
from homeassistant.helpers.json import json_dumps as json_dumps
from homeassistant.helpers.typing import ConfigType as ConfigType
from sqlalchemy import Column as Column
from sqlalchemy.sql.elements import ColumnElement as ColumnElement
from typing import Any

DOMAIN: str
HISTORY_FILTERS: str
JSON_NULL: Incomplete
GLOB_TO_SQL_CHARS: Incomplete
FILTER_TYPES: Incomplete
FITLER_MATCHERS: Incomplete

def extract_include_exclude_filter_conf(conf: ConfigType) -> dict[str, Any]: ...
def merge_include_exclude_filters(base_filter: dict[str, Any], add_filter: dict[str, Any]) -> dict[str, Any]: ...
def sqlalchemy_filter_from_include_exclude_conf(conf: ConfigType) -> Filters | None: ...

class Filters:
    _excluded_entities: Incomplete
    _excluded_domains: Incomplete
    _excluded_entity_globs: Incomplete
    _included_entities: Incomplete
    _included_domains: Incomplete
    _included_entity_globs: Incomplete
    def __init__(self, excluded_entities: Collection[str] | None = None, excluded_domains: Collection[str] | None = None, excluded_entity_globs: Collection[str] | None = None, included_entities: Collection[str] | None = None, included_domains: Collection[str] | None = None, included_entity_globs: Collection[str] | None = None) -> None: ...
    def __repr__(self) -> str: ...
    @property
    def has_config(self) -> bool: ...
    @property
    def _have_exclude(self) -> bool: ...
    @property
    def _have_include(self) -> bool: ...
    def _generate_filter_for_columns(self, columns: Iterable[Column], encoder: Callable[[Any], Any]) -> ColumnElement: ...
    def states_entity_filter(self) -> ColumnElement: ...
    def states_metadata_entity_filter(self) -> ColumnElement: ...
    def events_entity_filter(self) -> ColumnElement: ...

def _globs_to_like(glob_strs: Iterable[str], columns: Iterable[Column], encoder: Callable[[Any], Any]) -> ColumnElement: ...
def _entity_matcher(entity_ids: Iterable[str], columns: Iterable[Column], encoder: Callable[[Any], Any]) -> ColumnElement: ...
def _domain_matcher(domains: Iterable[str], columns: Iterable[Column], encoder: Callable[[Any], Any]) -> ColumnElement: ...
def like_domain_matchers(domains: Iterable[str]) -> list[str]: ...
