import dataclasses
from .storage import Store as Store
from .typing import UNDEFINED as UNDEFINED, UndefinedType as UndefinedType
from _typeshed import Incomplete
from collections import UserDict
from collections.abc import Iterable, ValuesView
from homeassistant.core import HomeAssistant as HomeAssistant, callback as callback
from homeassistant.util import slugify as slugify
from typing import Any, Literal, TypedDict

DATA_REGISTRY: str
EVENT_AREA_REGISTRY_UPDATED: str
STORAGE_KEY: str
STORAGE_VERSION_MAJOR: int
STORAGE_VERSION_MINOR: int
SAVE_DELAY: int

class EventAreaRegistryUpdatedData(TypedDict):
    action: Literal['create', 'remove', 'update']
    area_id: str

@dataclasses.dataclass(frozen=True, kw_only=True, slots=True)
class AreaEntry:
    aliases: set[str]
    icon: str | None
    id: str
    name: str
    normalized_name: str
    picture: str | None
    def __init__(self, *, aliases, icon, id, name, normalized_name, picture) -> None: ...

class AreaRegistryItems(UserDict[str, AreaEntry]):
    _normalized_names: Incomplete
    def __init__(self) -> None: ...
    def values(self) -> ValuesView[AreaEntry]: ...
    def __setitem__(self, key: str, entry: AreaEntry) -> None: ...
    def __delitem__(self, key: str) -> None: ...
    def get_area_by_name(self, name: str) -> AreaEntry | None: ...

class AreaRegistryStore(Store[dict[str, list[dict[str, Any]]]]):
    async def _async_migrate_func(self, old_major_version: int, old_minor_version: int, old_data: dict[str, list[dict[str, Any]]]) -> dict[str, Any]: ...

class AreaRegistry:
    areas: AreaRegistryItems
    _area_data: dict[str, AreaEntry]
    hass: Incomplete
    _store: Incomplete
    def __init__(self, hass: HomeAssistant) -> None: ...
    def async_get_area(self, area_id: str) -> AreaEntry | None: ...
    def async_get_area_by_name(self, name: str) -> AreaEntry | None: ...
    def async_list_areas(self) -> Iterable[AreaEntry]: ...
    def async_get_or_create(self, name: str) -> AreaEntry: ...
    def async_create(self, name: str, *, aliases: set[str] | None = None, icon: str | None = None, picture: str | None = None) -> AreaEntry: ...
    def async_delete(self, area_id: str) -> None: ...
    def async_update(self, area_id: str, *, aliases: set[str] | UndefinedType = ..., icon: str | None | UndefinedType = ..., name: str | UndefinedType = ..., picture: str | None | UndefinedType = ...) -> AreaEntry: ...
    def _async_update(self, area_id: str, *, aliases: set[str] | UndefinedType = ..., icon: str | None | UndefinedType = ..., name: str | UndefinedType = ..., picture: str | None | UndefinedType = ...) -> AreaEntry: ...
    async def async_load(self) -> None: ...
    def async_schedule_save(self) -> None: ...
    def _data_to_save(self) -> dict[str, list[dict[str, Any]]]: ...
    def _generate_area_id(self, name: str) -> str: ...

def async_get(hass: HomeAssistant) -> AreaRegistry: ...
async def async_load(hass: HomeAssistant) -> None: ...
def normalize_area_name(area_name: str) -> str: ...
