from .const import MAX_ROWS_TO_PURGE as MAX_ROWS_TO_PURGE
from .db_schema import EventData as EventData, Events as Events, RecorderRuns as RecorderRuns, StateAttributes as StateAttributes, States as States, 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 find_shared_attributes_id(data_hash: int, shared_attrs: str) -> StatementLambdaElement: ...
def find_shared_data_id(attr_hash: int, shared_data: str) -> StatementLambdaElement: ...
def _state_attrs_exist(attr: Union[int, None]) -> Select: ...
def attributes_ids_exist_in_states_sqlite(attributes_ids: Iterable[int]) -> StatementLambdaElement: ...
def attributes_ids_exist_in_states(attr1: int, attr2: Union[int, None], attr3: Union[int, None], attr4: Union[int, None], attr5: Union[int, None], attr6: Union[int, None], attr7: Union[int, None], attr8: Union[int, None], attr9: Union[int, None], attr10: Union[int, None], attr11: Union[int, None], attr12: Union[int, None], attr13: Union[int, None], attr14: Union[int, None], attr15: Union[int, None], attr16: Union[int, None], attr17: Union[int, None], attr18: Union[int, None], attr19: Union[int, None], attr20: Union[int, None], attr21: Union[int, None], attr22: Union[int, None], attr23: Union[int, None], attr24: Union[int, None], attr25: Union[int, None], attr26: Union[int, None], attr27: Union[int, None], attr28: Union[int, None], attr29: Union[int, None], attr30: Union[int, None], attr31: Union[int, None], attr32: Union[int, None], attr33: Union[int, None], attr34: Union[int, None], attr35: Union[int, None], attr36: Union[int, None], attr37: Union[int, None], attr38: Union[int, None], attr39: Union[int, None], attr40: Union[int, None], attr41: Union[int, None], attr42: Union[int, None], attr43: Union[int, None], attr44: Union[int, None], attr45: Union[int, None], attr46: Union[int, None], attr47: Union[int, None], attr48: Union[int, None], attr49: Union[int, None], attr50: Union[int, None], attr51: Union[int, None], attr52: Union[int, None], attr53: Union[int, None], attr54: Union[int, None], attr55: Union[int, None], attr56: Union[int, None], attr57: Union[int, None], attr58: Union[int, None], attr59: Union[int, None], attr60: Union[int, None], attr61: Union[int, None], attr62: Union[int, None], attr63: Union[int, None], attr64: Union[int, None], attr65: Union[int, None], attr66: Union[int, None], attr67: Union[int, None], attr68: Union[int, None], attr69: Union[int, None], attr70: Union[int, None], attr71: Union[int, None], attr72: Union[int, None], attr73: Union[int, None], attr74: Union[int, None], attr75: Union[int, None], attr76: Union[int, None], attr77: Union[int, None], attr78: Union[int, None], attr79: Union[int, None], attr80: Union[int, None], attr81: Union[int, None], attr82: Union[int, None], attr83: Union[int, None], attr84: Union[int, None], attr85: Union[int, None], attr86: Union[int, None], attr87: Union[int, None], attr88: Union[int, None], attr89: Union[int, None], attr90: Union[int, None], attr91: Union[int, None], attr92: Union[int, None], attr93: Union[int, None], attr94: Union[int, None], attr95: Union[int, None], attr96: Union[int, None], attr97: Union[int, None], attr98: Union[int, None], attr99: Union[int, None], attr100: Union[int, None]) -> StatementLambdaElement: ...
def data_ids_exist_in_events_sqlite(data_ids: Iterable[int]) -> StatementLambdaElement: ...
def _event_data_id_exist(data_id: Union[int, None]) -> Select: ...
def data_ids_exist_in_events(id1: int, id2: Union[int, None], id3: Union[int, None], id4: Union[int, None], id5: Union[int, None], id6: Union[int, None], id7: Union[int, None], id8: Union[int, None], id9: Union[int, None], id10: Union[int, None], id11: Union[int, None], id12: Union[int, None], id13: Union[int, None], id14: Union[int, None], id15: Union[int, None], id16: Union[int, None], id17: Union[int, None], id18: Union[int, None], id19: Union[int, None], id20: Union[int, None], id21: Union[int, None], id22: Union[int, None], id23: Union[int, None], id24: Union[int, None], id25: Union[int, None], id26: Union[int, None], id27: Union[int, None], id28: Union[int, None], id29: Union[int, None], id30: Union[int, None], id31: Union[int, None], id32: Union[int, None], id33: Union[int, None], id34: Union[int, None], id35: Union[int, None], id36: Union[int, None], id37: Union[int, None], id38: Union[int, None], id39: Union[int, None], id40: Union[int, None], id41: Union[int, None], id42: Union[int, None], id43: Union[int, None], id44: Union[int, None], id45: Union[int, None], id46: Union[int, None], id47: Union[int, None], id48: Union[int, None], id49: Union[int, None], id50: Union[int, None], id51: Union[int, None], id52: Union[int, None], id53: Union[int, None], id54: Union[int, None], id55: Union[int, None], id56: Union[int, None], id57: Union[int, None], id58: Union[int, None], id59: Union[int, None], id60: Union[int, None], id61: Union[int, None], id62: Union[int, None], id63: Union[int, None], id64: Union[int, None], id65: Union[int, None], id66: Union[int, None], id67: Union[int, None], id68: Union[int, None], id69: Union[int, None], id70: Union[int, None], id71: Union[int, None], id72: Union[int, None], id73: Union[int, None], id74: Union[int, None], id75: Union[int, None], id76: Union[int, None], id77: Union[int, None], id78: Union[int, None], id79: Union[int, None], id80: Union[int, None], id81: Union[int, None], id82: Union[int, None], id83: Union[int, None], id84: Union[int, None], id85: Union[int, None], id86: Union[int, None], id87: Union[int, None], id88: Union[int, None], id89: Union[int, None], id90: Union[int, None], id91: Union[int, None], id92: Union[int, None], id93: Union[int, None], id94: Union[int, None], id95: Union[int, None], id96: Union[int, None], id97: Union[int, None], id98: Union[int, None], id99: Union[int, None], id100: Union[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) -> StatementLambdaElement: ...
def find_states_to_purge(purge_before: float) -> StatementLambdaElement: ...
def find_short_term_statistics_to_purge(purge_before: datetime) -> StatementLambdaElement: ...
def find_statistics_runs_to_purge(purge_before: datetime) -> StatementLambdaElement: ...
def find_latest_statistics_runs_run_id() -> StatementLambdaElement: ...
def find_legacy_event_state_and_attributes_and_data_ids_to_purge(purge_before: float) -> StatementLambdaElement: ...
def find_legacy_row() -> StatementLambdaElement: ...
