from typing import Literal, overload, Dict, Union

from cachetools import TTLCache

# Sometimes the storage functions are accessed dynamically.
# Comfort mypy by telling it the value will still be one of the specified ones.

PlatformEnabled = Literal[
    "local_enabled",
    "youtube_enabled",
    "spotify_enabled",
    "soundcloud_enabled",
    "jamendo_enabled",
]

PlatformSuggestions = Literal[
    "youtube_suggestions",
    "spotify_suggestions",
    "soundcloud_suggestions",
    "jamendo_suggestions",
]

DeviceBrightness = Literal[
    "ring_brightness", "strip_brightness", "wled_brightness", "screen_brightness"
]
DeviceMonochrome = Literal[
    "ring_monochrome", "strip_monochrome", "wled_monochrome", "screen_monochrome"
]
DeviceProgram = Literal[
    "ring_program",
    "last_ring_program",
    "strip_program",
    "last_strip_program",
    "wled_program",
    "last_wled_program",
    "screen_program",
    "last_screen_program",
]

cache: TTLCache = TTLCache(ttl=10, maxsize=128)

@overload
def get(key: Literal["voting_enabled"]) -> bool: ...
@overload
def get(key: Literal["ip_checking"]) -> bool: ...
@overload
def get(key: Literal["new_music_only"]) -> bool: ...
@overload
def get(key: Literal["logging_enabled"]) -> bool: ...
@overload
def get(key: Literal["hashtags_active"]) -> bool: ...
@overload
def get(key: Literal["embed_stream"]) -> bool: ...
@overload
def get(key: Literal["dynamic_embedded_stream"]) -> bool: ...
@overload
def get(key: Literal["online_suggestions"]) -> bool: ...
@overload
def get(key: Literal["number_of_suggestions"]) -> int: ...
@overload
def get(key: Literal["people_to_party"]) -> int: ...
@overload
def get(key: Literal["alarm_probability"]) -> float: ...
@overload
def get(key: Literal["buzzer_cooldown"]) -> float: ...
@overload
def get(key: Literal["downvotes_to_kick"]) -> int: ...
@overload
def get(key: Literal["max_download_size"]) -> float: ...
@overload
def get(key: Literal["max_playlist_items"]) -> int: ...
@overload
def get(key: Literal["max_queue_length"]) -> int: ...
@overload
def get(key: Literal["additional_keywords"]) -> str: ...
@overload
def get(key: Literal["forbidden_keywords"]) -> str: ...
@overload
def get(key: Literal["connectivity_host"]) -> str: ...
@overload
def get(key: Literal["local_enabled"]) -> bool: ...
@overload
def get(key: Literal["youtube_enabled"]) -> bool: ...
@overload
def get(key: Literal["youtube_suggestions"]) -> int: ...
@overload
def get(key: Literal["spotify_enabled"]) -> bool: ...
@overload
def get(key: Literal["spotify_suggestions"]) -> int: ...
@overload
def get(key: Literal["spotify_username"]) -> str: ...
@overload
def get(key: Literal["spotify_password"]) -> str: ...
@overload
def get(key: Literal["spotify_client_id"]) -> str: ...
@overload
def get(key: Literal["spotify_client_secret"]) -> str: ...
@overload
def get(key: Literal["soundcloud_enabled"]) -> bool: ...
@overload
def get(key: Literal["soundcloud_suggestions"]) -> int: ...
@overload
def get(key: Literal["soundcloud_auth_token"]) -> str: ...
@overload
def get(key: Literal["jamendo_enabled"]) -> bool: ...
@overload
def get(key: Literal["jamendo_suggestions"]) -> int: ...
@overload
def get(key: Literal["jamendo_client_id"]) -> str: ...
@overload
def get(key: Literal["feed_cava"]) -> bool: ...
@overload
def get(key: Literal["output"]) -> str: ...
@overload
def get(key: Literal["backup_stream"]) -> str: ...
@overload
def get(key: Literal["paused"]) -> bool: ...
@overload
def get(key: Literal["volume"]) -> float: ...
@overload
def get(key: Literal["shuffle"]) -> bool: ...
@overload
def get(key: Literal["repeat"]) -> bool: ...
@overload
def get(key: Literal["autoplay"]) -> bool: ...
@overload
def get(key: Literal["ups"]) -> float: ...
@overload
def get(key: Literal["fixed_color"]) -> tuple[float, float, float]: ...
@overload
def get(key: Literal["program_speed"]) -> float: ...
@overload
def get(key: Literal["wled_led_count"]) -> int: ...
@overload
def get(key: Literal["wled_ip"]) -> str: ...
@overload
def get(key: Literal["wled_port"]) -> int: ...
@overload
def get(key: Literal["ring_brightness"]) -> float: ...
@overload
def get(key: Literal["ring_monochrome"]) -> bool: ...
@overload
def get(key: Literal["ring_program"]) -> str: ...
@overload
def get(key: Literal["last_ring_program"]) -> str: ...
@overload
def get(key: Literal["strip_brightness"]) -> float: ...
@overload
def get(key: Literal["strip_monochrome"]) -> bool: ...
@overload
def get(key: Literal["strip_program"]) -> str: ...
@overload
def get(key: Literal["last_strip_program"]) -> str: ...
@overload
def get(key: Literal["wled_brightness"]) -> float: ...
@overload
def get(key: Literal["wled_monochrome"]) -> bool: ...
@overload
def get(key: Literal["wled_program"]) -> str: ...
@overload
def get(key: Literal["last_wled_program"]) -> str: ...
@overload
def get(key: Literal["screen_brightness"]) -> float: ...
@overload
def get(key: Literal["screen_monochrome"]) -> bool: ...
@overload
def get(key: Literal["screen_program"]) -> str: ...
@overload
def get(key: Literal["last_screen_program"]) -> str: ...
@overload
def get(key: Literal["initial_resolution"]) -> tuple[int, int]: ...
@overload
def get(key: Literal["dynamic_resolution"]) -> bool: ...
@overload
def put(key: Literal["voting_enabled"], value: bool) -> None: ...
@overload
def put(key: Literal["ip_checking"], value: bool) -> None: ...
@overload
def put(key: Literal["new_music_only"], value: bool) -> None: ...
@overload
def put(key: Literal["logging_enabled"], value: bool) -> None: ...
@overload
def put(key: Literal["hashtags_active"], value: bool) -> None: ...
@overload
def put(key: Literal["embed_stream"], value: bool) -> None: ...
@overload
def put(key: Literal["dynamic_embedded_stream"], value: bool) -> None: ...
@overload
def put(key: Literal["online_suggestions"], value: bool) -> None: ...
@overload
def put(key: Literal["number_of_suggestions"], value: int) -> None: ...
@overload
def put(key: Literal["people_to_party"], value: int) -> None: ...
@overload
def put(key: Literal["alarm_probability"], value: float) -> None: ...
@overload
def put(key: Literal["buzzer_cooldown"], value: float) -> None: ...
@overload
def put(key: Literal["downvotes_to_kick"], value: int) -> None: ...
@overload
def put(key: Literal["max_download_size"], value: float) -> None: ...
@overload
def put(key: Literal["max_playlist_items"], value: int) -> None: ...
@overload
def put(key: Literal["max_queue_length"], value: int) -> None: ...
@overload
def put(key: Literal["additional_keywords"], value: str) -> None: ...
@overload
def put(key: Literal["forbidden_keywords"], value: str) -> None: ...
@overload
def put(key: Literal["connectivity_host"], value: str) -> None: ...
@overload
def put(key: Literal["local_enabled"], value: bool) -> None: ...
@overload
def put(key: Literal["youtube_enabled"], value: bool) -> None: ...
@overload
def put(key: Literal["youtube_suggestions"], value: int) -> None: ...
@overload
def put(key: Literal["spotify_enabled"], value: bool) -> None: ...
@overload
def put(key: Literal["spotify_suggestions"], value: int) -> None: ...
@overload
def put(key: Literal["spotify_username"], value: str) -> None: ...
@overload
def put(key: Literal["spotify_password"], value: str) -> None: ...
@overload
def put(key: Literal["spotify_client_id"], value: str) -> None: ...
@overload
def put(key: Literal["spotify_client_secret"], value: str) -> None: ...
@overload
def put(key: Literal["soundcloud_enabled"], value: bool) -> None: ...
@overload
def put(key: Literal["soundcloud_suggestions"], value: int) -> None: ...
@overload
def put(key: Literal["soundcloud_auth_token"], value: str) -> None: ...
@overload
def put(key: Literal["jamendo_enabled"], value: bool) -> None: ...
@overload
def put(key: Literal["jamendo_suggestions"], value: int) -> None: ...
@overload
def put(key: Literal["jamendo_client_id"], value: str) -> None: ...
@overload
def put(key: Literal["feed_cava"], value: bool) -> None: ...
@overload
def put(key: Literal["output"], value: str) -> None: ...
@overload
def put(key: Literal["backup_stream"], value: str) -> None: ...
@overload
def put(key: Literal["paused"], value: bool) -> None: ...
@overload
def put(key: Literal["volume"], value: float) -> None: ...
@overload
def put(key: Literal["shuffle"], value: bool) -> None: ...
@overload
def put(key: Literal["repeat"], value: bool) -> None: ...
@overload
def put(key: Literal["autoplay"], value: bool) -> None: ...
@overload
def put(key: Literal["ups"], value: float) -> None: ...
@overload
def put(key: Literal["fixed_color"], value: tuple[float, float, float]) -> None: ...
@overload
def put(key: Literal["program_speed"], value: float) -> None: ...
@overload
def put(key: Literal["wled_led_count"], value: int) -> None: ...
@overload
def put(key: Literal["wled_ip"], value: str) -> None: ...
@overload
def put(key: Literal["wled_port"], value: int) -> None: ...
@overload
def put(key: Literal["ring_brightness"], value: float) -> None: ...
@overload
def put(key: Literal["ring_monochrome"], value: bool) -> None: ...
@overload
def put(key: Literal["ring_program"], value: str) -> None: ...
@overload
def put(key: Literal["last_ring_program"], value: str) -> None: ...
@overload
def put(key: Literal["strip_brightness"], value: float) -> None: ...
@overload
def put(key: Literal["strip_monochrome"], value: bool) -> None: ...
@overload
def put(key: Literal["strip_program"], value: str) -> None: ...
@overload
def put(key: Literal["last_strip_program"], value: str) -> None: ...
@overload
def put(key: Literal["wled_brightness"], value: float) -> None: ...
@overload
def put(key: Literal["wled_monochrome"], value: bool) -> None: ...
@overload
def put(key: Literal["wled_program"], value: str) -> None: ...
@overload
def put(key: Literal["last_wled_program"], value: str) -> None: ...
@overload
def put(key: Literal["screen_brightness"], value: float) -> None: ...
@overload
def put(key: Literal["screen_monochrome"], value: bool) -> None: ...
@overload
def put(key: Literal["screen_program"], value: str) -> None: ...
@overload
def put(key: Literal["last_screen_program"], value: str) -> None: ...
@overload
def put(key: Literal["initial_resolution"], value: tuple[int, int]) -> None: ...
@overload
def put(key: Literal["dynamic_resolution"], value: bool) -> None: ...
