# Path: src/instawow/common.py
# class Flavour(StrEnum):
#     # The latest Classic version is always aliased to "classic".
#     # The logic here is that should Classic not be discontinued
#     # it will continue to be updated in place so that new Classic versions
#     # will inherit the "_classic_" folder.  This means we won't have to
#     # migrate Classic profiles either automatically or by requiring user
#     # intervention for new Classic releases.
#     retail = 'retail'
#     vanilla_classic = 'vanilla_classic'
#     burning_crusade_classic = 'classic'
# 
#     @classmethod
#     def from_flavour_keyed_enum(cls, enum: Enum) -> Flavour:
#         return cls[enum.name]
# 
#     @classmethod
#     def to_flavour_keyed_enum(cls, enum: _FlavourKeyedEnum[_TEnum], flavour: Flavour) -> _TEnum:
#         return enum[flavour.name]
# 
# Path: src/instawow/utils.py
# def trash(paths: Sequence[PurePath], *, dest: PurePath, missing_ok: bool = False) -> None:
#     if not paths:
#         return
# 
#     parent_folder = mkdtemp(dir=dest, prefix=f'deleted-{paths[0].name}-')
#     for path in paths:
#         try:
#             move(path, dest=parent_folder)
#         except (FileNotFoundError if missing_ok else ()):
#             pass


from collections.abc import Iterable, Set
from pathlib import Path, PurePath
from tempfile import gettempdir
from typing import Any
from loguru import logger
from pydantic import BaseModel, BaseSettings, Field, PydanticValueError, SecretStr, validator
from pydantic.env_settings import SettingsSourceCallable
from .common import Flavour
from .utils import trash
    from types import SimpleNamespace
import json
import os
import sys
import typing
import click
    import queue
    import threading
    import loguru._handler
    import logging
            ]
        )
        return self

    def write(self) -> GlobalConfig:
        """Write the configuration on disk.

        ``write`` should only be called when configuring instawow.
        This means that environment overrides should only be persisted
        if made during configuration.
        """
        self.ensure_dirs()
        _write_config(
            self, {'auto_update_check', 'access_tokens'}, encoder=_encode_reveal_secret_str
        )
        return self

    @property
    def cache_dir(self) -> Path:
        return self.temp_dir / 'cache'

    @property
    def config_file(self) -> Path:
        return self.config_dir / 'config.json'


class Config(_BaseSettings):
    global_config: GlobalConfig
    profile: str = Field(min_length=1, strip_whitespace=True)
    addon_dir: Path

# Path: src/instawow/common.py
# class Flavour(StrEnum):
#     # The latest Classic version is always aliased to "classic".
#     # The logic here is that should Classic not be discontinued
#     # it will continue to be updated in place so that new Classic versions
#     # will inherit the "_classic_" folder.  This means we won't have to
#     # migrate Classic profiles either automatically or by requiring user
#     # intervention for new Classic releases.
#     retail = 'retail'
#     vanilla_classic = 'vanilla_classic'
#     burning_crusade_classic = 'classic'
# 
#     @classmethod
#     def from_flavour_keyed_enum(cls, enum: Enum) -> Flavour:
#         return cls[enum.name]
# 
#     @classmethod
#     def to_flavour_keyed_enum(cls, enum: _FlavourKeyedEnum[_TEnum], flavour: Flavour) -> _TEnum:
#         return enum[flavour.name]
# 
# Path: src/instawow/utils.py
# def trash(paths: Sequence[PurePath], *, dest: PurePath, missing_ok: bool = False) -> None:
#     if not paths:
#         return
# 
#     parent_folder = mkdtemp(dir=dest, prefix=f'deleted-{paths[0].name}-')
#     for path in paths:
#         try:
#             move(path, dest=parent_folder)
#         except (FileNotFoundError if missing_ok else ()):
#             pass


# Path: src/instawow/config.py
from collections.abc import Iterable, Set
from pathlib import Path, PurePath
from tempfile import gettempdir
from typing import Any
from loguru import logger
from pydantic import BaseModel, BaseSettings, Field, PydanticValueError, SecretStr, validator
from pydantic.env_settings import SettingsSourceCallable
from .common import Flavour
from .utils import trash
    from types import SimpleNamespace
import json
import os
import sys
import typing
import click
    import queue
    import threading
    import loguru._handler
    import logging

            ]
        )
        return self

    def write(self) -> GlobalConfig:
        """Write the configuration on disk.

        ``write`` should only be called when configuring instawow.
        This means that environment overrides should only be persisted
        if made during configuration.
        """
        self.ensure_dirs()
        _write_config(
            self, {'auto_update_check', 'access_tokens'}, encoder=_encode_reveal_secret_str
        )
        return self

    @property
    def cache_dir(self) -> Path:
        return self.temp_dir / 'cache'

    @property
    def config_file(self) -> Path:
        return self.config_dir / 'config.json'


class Config(_BaseSettings):
    global_config: GlobalConfig
    profile: str = Field(min_length=1, strip_whitespace=True)
    addon_dir: Path

    game_flavour: Flavour