from .db_schema import EventData as EventData, EventTypes as EventTypes, Events as Events, RecorderRuns as RecorderRuns, StateAttributes as StateAttributes, States as States, StatesMeta as StatesMeta, Statistics as Statistics, StatisticsRuns as StatisticsRuns, StatisticsShortTerm as StatisticsShortTerm
from collections.abc import Iterable
from datetime import datetime
from sqlalchemy.sql.lambdas import StatementLambdaElement as StatementLambdaElement
from sqlalchemy.sql.selectable import Select as Select

def select_event_type_ids(event_types: tuple[str, ...]) -> Select: ...
def get_shared_attributes(hashes: list[int]) -> StatementLambdaElement: ...
def get_shared_event_datas(hashes: list[int]) -> StatementLambdaElement: ...
def find_event_type_ids(event_types: Iterable[str]) -> StatementLambdaElement: ...
def find_all_states_metadata_ids() -> StatementLambdaElement: ...
def find_states_metadata_ids(entity_ids: Iterable[str]) -> StatementLambdaElement: ...
def _state_attrs_exist(attr: int | None) -> Select: ...
def attributes_ids_exist_in_states_with_fast_in_distinct(attributes_ids: Iterable[int]) -> StatementLambdaElement: ...
def attributes_ids_exist_in_states(attr1: int, attr2: int | None, attr3: int | None, attr4: int | None, attr5: int | None, attr6: int | None, attr7: int | None, attr8: int | None, attr9: int | None, attr10: int | None, attr11: int | None, attr12: int | None, attr13: int | None, attr14: int | None, attr15: int | None, attr16: int | None, attr17: int | None, attr18: int | None, attr19: int | None, attr20: int | None, attr21: int | None, attr22: int | None, attr23: int | None, attr24: int | None, attr25: int | None, attr26: int | None, attr27: int | None, attr28: int | None, attr29: int | None, attr30: int | None, attr31: int | None, attr32: int | None, attr33: int | None, attr34: int | None, attr35: int | None, attr36: int | None, attr37: int | None, attr38: int | None, attr39: int | None, attr40: int | None, attr41: int | None, attr42: int | None, attr43: int | None, attr44: int | None, attr45: int | None, attr46: int | None, attr47: int | None, attr48: int | None, attr49: int | None, attr50: int | None, attr51: int | None, attr52: int | None, attr53: int | None, attr54: int | None, attr55: int | None, attr56: int | None, attr57: int | None, attr58: int | None, attr59: int | None, attr60: int | None, attr61: int | None, attr62: int | None, attr63: int | None, attr64: int | None, attr65: int | None, attr66: int | None, attr67: int | None, attr68: int | None, attr69: int | None, attr70: int | None, attr71: int | None, attr72: int | None, attr73: int | None, attr74: int | None, attr75: int | None, attr76: int | None, attr77: int | None, attr78: int | None, attr79: int | None, attr80: int | None, attr81: int | None, attr82: int | None, attr83: int | None, attr84: int | None, attr85: int | None, attr86: int | None, attr87: int | None, attr88: int | None, attr89: int | None, attr90: int | None, attr91: int | None, attr92: int | None, attr93: int | None, attr94: int | None, attr95: int | None, attr96: int | None, attr97: int | None, attr98: int | None, attr99: int | None, attr100: int | None) -> StatementLambdaElement: ...
def data_ids_exist_in_events_with_fast_in_distinct(data_ids: Iterable[int]) -> StatementLambdaElement: ...
def _event_data_id_exist(data_id: int | None) -> Select: ...
def data_ids_exist_in_events(id1: int, id2: int | None, id3: int | None, id4: int | None, id5: int | None, id6: int | None, id7: int | None, id8: int | None, id9: int | None, id10: int | None, id11: int | None, id12: int | None, id13: int | None, id14: int | None, id15: int | None, id16: int | None, id17: int | None, id18: int | None, id19: int | None, id20: int | None, id21: int | None, id22: int | None, id23: int | None, id24: int | None, id25: int | None, id26: int | None, id27: int | None, id28: int | None, id29: int | None, id30: int | None, id31: int | None, id32: int | None, id33: int | None, id34: int | None, id35: int | None, id36: int | None, id37: int | None, id38: int | None, id39: int | None, id40: int | None, id41: int | None, id42: int | None, id43: int | None, id44: int | None, id45: int | None, id46: int | None, id47: int | None, id48: int | None, id49: int | None, id50: int | None, id51: int | None, id52: int | None, id53: int | None, id54: int | None, id55: int | None, id56: int | None, id57: int | None, id58: int | None, id59: int | None, id60: int | None, id61: int | None, id62: int | None, id63: int | None, id64: int | None, id65: int | None, id66: int | None, id67: int | None, id68: int | None, id69: int | None, id70: int | None, id71: int | None, id72: int | None, id73: int | None, id74: int | None, id75: int | None, id76: int | None, id77: int | None, id78: int | None, id79: int | None, id80: int | None, id81: int | None, id82: int | None, id83: int | None, id84: int | None, id85: int | None, id86: int | None, id87: int | None, id88: int | None, id89: int | None, id90: int | None, id91: int | None, id92: int | None, id93: int | None, id94: int | None, id95: int | None, id96: int | None, id97: int | None, id98: int | None, id99: int | None, id100: int | None) -> StatementLambdaElement: ...
def disconnect_states_rows(state_ids: Iterable[int]) -> StatementLambdaElement: ...
def delete_states_rows(state_ids: Iterable[int]) -> StatementLambdaElement: ...
def delete_event_data_rows(data_ids: Iterable[int]) -> StatementLambdaElement: ...
def delete_states_attributes_rows(attributes_ids: Iterable[int]) -> StatementLambdaElement: ...
def delete_statistics_runs_rows(statistics_runs: Iterable[int]) -> StatementLambdaElement: ...
def delete_statistics_short_term_rows(short_term_statistics: Iterable[int]) -> StatementLambdaElement: ...
def delete_event_rows(event_ids: Iterable[int]) -> StatementLambdaElement: ...
def delete_recorder_runs_rows(purge_before: datetime, current_run_id: int) -> StatementLambdaElement: ...
def find_events_to_purge(purge_before: float, max_bind_vars: int) -> StatementLambdaElement: ...
def find_states_to_purge(purge_before: float, max_bind_vars: int) -> StatementLambdaElement: ...
def find_short_term_statistics_to_purge(purge_before: datetime, max_bind_vars: int) -> StatementLambdaElement: ...
def find_statistics_runs_to_purge(purge_before: datetime, max_bind_vars: int) -> StatementLambdaElement: ...
def find_latest_statistics_runs_run_id() -> StatementLambdaElement: ...
def find_legacy_event_state_and_attributes_and_data_ids_to_purge(purge_before: float, max_bind_vars: int) -> StatementLambdaElement: ...
def find_legacy_detached_states_and_attributes_to_purge(purge_before: float, max_bind_vars: int) -> StatementLambdaElement: ...
def find_legacy_row() -> StatementLambdaElement: ...
def find_events_context_ids_to_migrate(max_bind_vars: int) -> StatementLambdaElement: ...
def find_event_type_to_migrate(max_bind_vars: int) -> StatementLambdaElement: ...
def find_entity_ids_to_migrate(max_bind_vars: int) -> StatementLambdaElement: ...
def batch_cleanup_entity_ids() -> StatementLambdaElement: ...
def has_used_states_event_ids() -> StatementLambdaElement: ...
def has_events_context_ids_to_migrate() -> StatementLambdaElement: ...
def has_states_context_ids_to_migrate() -> StatementLambdaElement: ...
def has_event_type_to_migrate() -> StatementLambdaElement: ...
def has_entity_ids_to_migrate() -> StatementLambdaElement: ...
def find_states_context_ids_to_migrate(max_bind_vars: int) -> StatementLambdaElement: ...
def find_event_types_to_purge() -> StatementLambdaElement: ...
def find_entity_ids_to_purge() -> StatementLambdaElement: ...
def delete_event_types_rows(event_type_ids: Iterable[int]) -> StatementLambdaElement: ...
def delete_states_meta_rows(metadata_ids: Iterable[int]) -> StatementLambdaElement: ...
def find_unmigrated_short_term_statistics_rows(max_bind_vars: int) -> StatementLambdaElement: ...
def find_unmigrated_statistics_rows(max_bind_vars: int) -> StatementLambdaElement: ...
def migrate_single_short_term_statistics_row_to_timestamp(statistic_id: int, start_ts: float | None, created_ts: float | None, last_reset_ts: float | None) -> StatementLambdaElement: ...
def migrate_single_statistics_row_to_timestamp(statistic_id: int, start_ts: float | None, created_ts: float | None, last_reset_ts: float | None) -> StatementLambdaElement: ...
def delete_duplicate_short_term_statistics_row(statistic_id: int) -> StatementLambdaElement: ...
def delete_duplicate_statistics_row(statistic_id: int) -> StatementLambdaElement: ...
