from .const import ATTR_ADDONS as ATTR_ADDONS, ATTR_ADDON_COUNT as ATTR_ADDON_COUNT, ATTR_ARCH as ATTR_ARCH, ATTR_AUTOMATION_COUNT as ATTR_AUTOMATION_COUNT, ATTR_AUTO_UPDATE as ATTR_AUTO_UPDATE, ATTR_BASE as ATTR_BASE, ATTR_BOARD as ATTR_BOARD, ATTR_CERTIFICATE as ATTR_CERTIFICATE, ATTR_CONFIGURED as ATTR_CONFIGURED, ATTR_CUSTOM_INTEGRATIONS as ATTR_CUSTOM_INTEGRATIONS, ATTR_DIAGNOSTICS as ATTR_DIAGNOSTICS, ATTR_ENERGY as ATTR_ENERGY, ATTR_ENGINE as ATTR_ENGINE, ATTR_HEALTHY as ATTR_HEALTHY, ATTR_INTEGRATIONS as ATTR_INTEGRATIONS, ATTR_INTEGRATION_COUNT as ATTR_INTEGRATION_COUNT, ATTR_OPERATING_SYSTEM as ATTR_OPERATING_SYSTEM, ATTR_PROTECTED as ATTR_PROTECTED, ATTR_RECORDER as ATTR_RECORDER, ATTR_SLUG as ATTR_SLUG, ATTR_SNAPSHOTS as ATTR_SNAPSHOTS, ATTR_STATE_COUNT as ATTR_STATE_COUNT, ATTR_STATISTICS as ATTR_STATISTICS, ATTR_SUPERVISOR as ATTR_SUPERVISOR, ATTR_SUPPORTED as ATTR_SUPPORTED, ATTR_USAGE as ATTR_USAGE, ATTR_USER_COUNT as ATTR_USER_COUNT, ATTR_UUID as ATTR_UUID, ATTR_VERSION as ATTR_VERSION, BASIC_ENDPOINT_URL as BASIC_ENDPOINT_URL, BASIC_ENDPOINT_URL_DEV as BASIC_ENDPOINT_URL_DEV, DOMAIN as DOMAIN, INTERVAL as INTERVAL, LOGGER as LOGGER, PREFERENCE_SCHEMA as PREFERENCE_SCHEMA, SNAPSHOT_DEFAULT_URL as SNAPSHOT_DEFAULT_URL, SNAPSHOT_URL_PATH as SNAPSHOT_URL_PATH, SNAPSHOT_VERSION as SNAPSHOT_VERSION, STORAGE_KEY as STORAGE_KEY, STORAGE_VERSION as STORAGE_VERSION
from _typeshed import Incomplete
from collections.abc import Awaitable, Callable, Iterable, Mapping
from dataclasses import dataclass, field
from datetime import datetime
from homeassistant.components import hassio as hassio
from homeassistant.components.api import ATTR_INSTALLATION_TYPE as ATTR_INSTALLATION_TYPE
from homeassistant.components.labs import async_is_preview_feature_enabled as async_is_preview_feature_enabled
from homeassistant.config_entries import SOURCE_IGNORE as SOURCE_IGNORE
from homeassistant.const import ATTR_ASSUMED_STATE as ATTR_ASSUMED_STATE, ATTR_DOMAIN as ATTR_DOMAIN, BASE_PLATFORMS as BASE_PLATFORMS
from homeassistant.core import CALLBACK_TYPE as CALLBACK_TYPE, HassJob as HassJob, HomeAssistant as HomeAssistant, ReleaseChannel as ReleaseChannel, callback as callback, get_release_channel as get_release_channel
from homeassistant.exceptions import HomeAssistantError as HomeAssistantError
from homeassistant.helpers.aiohttp_client import async_get_clientsession as async_get_clientsession
from homeassistant.helpers.event import async_call_later as async_call_later, async_track_time_interval as async_track_time_interval
from homeassistant.helpers.hassio import is_hassio as is_hassio
from homeassistant.helpers.singleton import singleton as singleton
from homeassistant.helpers.storage import Store as Store
from homeassistant.helpers.system_info import async_get_system_info as async_get_system_info
from homeassistant.helpers.typing import UNDEFINED as UNDEFINED
from homeassistant.loader import Integration as Integration, IntegrationNotFound as IntegrationNotFound, async_get_integration as async_get_integration, async_get_integrations as async_get_integrations
from homeassistant.setup import async_get_loaded_integrations as async_get_loaded_integrations
from typing import Any, Protocol

DATA_ANALYTICS_MODIFIERS: str
type AnalyticsModifier = Callable[[HomeAssistant, AnalyticsInput], Awaitable[AnalyticsModifications]]

def _async_get_modifiers(hass: HomeAssistant) -> dict[str, AnalyticsModifier | None]: ...

@dataclass
class AnalyticsInput:
    device_ids: Iterable[str] = field(default_factory=list)
    entity_ids: Iterable[str] = field(default_factory=list)

@dataclass
class AnalyticsModifications:
    remove: bool = ...
    devices: Mapping[str, DeviceAnalyticsModifications] | None = ...
    entities: Mapping[str, EntityAnalyticsModifications] | None = ...

@dataclass
class DeviceAnalyticsModifications:
    remove: bool = ...

@dataclass
class EntityAnalyticsModifications:
    remove: bool = ...

class AnalyticsPlatformProtocol(Protocol):
    async def async_modify_analytics(self, hass: HomeAssistant, analytics_input: AnalyticsInput) -> AnalyticsModifications: ...

async def _async_get_analytics_platform(hass: HomeAssistant, domain: str) -> AnalyticsPlatformProtocol | None: ...
async def _async_get_modifier(hass: HomeAssistant, domain: str) -> AnalyticsModifier | None: ...
def gen_uuid() -> str: ...

RELEASE_CHANNEL: Incomplete

@dataclass
class AnalyticsData:
    onboarded: bool
    preferences: dict[str, bool]
    uuid: str | None = ...
    submission_identifier: str | None = ...
    snapshot_submission_time: float | None = ...
    @classmethod
    def from_dict(cls, data: dict[str, Any]) -> AnalyticsData: ...

class Analytics:
    _hass: HomeAssistant
    _snapshots_url: Incomplete
    _session: Incomplete
    _data: Incomplete
    _store: Incomplete
    _basic_scheduled: CALLBACK_TYPE | None
    _snapshot_scheduled: CALLBACK_TYPE | None
    def __init__(self, hass: HomeAssistant, snapshots_url: str | None = None) -> None: ...
    @property
    def preferences(self) -> dict: ...
    @property
    def onboarded(self) -> bool: ...
    @property
    def uuid(self) -> str | None: ...
    @property
    def endpoint_basic(self) -> str: ...
    @property
    def supervisor(self) -> bool: ...
    @property
    def _snapshots_enabled(self) -> bool: ...
    async def load(self) -> None: ...
    async def _save(self) -> None: ...
    async def save_preferences(self, preferences: dict) -> None: ...
    async def send_analytics(self, _: datetime | None = None) -> None: ...
    @callback
    def _async_should_report_integration(self, integration: Integration, yaml_domains: set[str], entity_registry_platforms: set[str]) -> bool: ...
    async def send_snapshot(self, _: datetime | None = None) -> None: ...
    async def async_schedule(self) -> None: ...
    async def _async_schedule_basic(self, _: datetime | None = None) -> None: ...
    async def _async_schedule_snapshots(self, _: datetime | None = None) -> None: ...

def _domains_from_yaml_config(yaml_configuration: dict[str, Any]) -> set[str]: ...

DEFAULT_ANALYTICS_CONFIG: Incomplete
DEFAULT_DEVICE_ANALYTICS_CONFIG: Incomplete
DEFAULT_ENTITY_ANALYTICS_CONFIG: Incomplete

async def _async_snapshot_payload(hass: HomeAssistant) -> dict: ...
async def async_devices_payload(hass: HomeAssistant) -> dict: ...
