"""
Warning:
    .. deprecated:: 5.0.0
"""

from typing import Any, List

from axipy._internal._decorator import _deprecated_by
from axipy.cpp_core_core import DefaultSettingsList, ShadowSettings

__all__: List[str] = []


def _apply_deprecated() -> None:
    # Using getattr to hide deprecated objects from axipy namespace on IDE inspections
    getattr(__all__, "extend")(("Settings",))

    # noinspection PyPep8Naming
    class Settings(DefaultSettingsList):
        """
        Warning:
            .. deprecated:: 5.0.0
                Используйте :class:`axipy.CurrentSettings`, :class:`axipy.DefaultSettings`.
        """

        # noinspection PyMissingConstructor
        def __init__(self) -> None:
            raise NotImplementedError

        @classmethod
        @_deprecated_by("axipy.CurrentSettings")
        def value(cls, key: DefaultSettingsList.Key) -> Any:
            """
            Warning:
                .. deprecated:: 5.0.0
            """
            return ShadowSettings.value(key)

        @classmethod
        @_deprecated_by("axipy.CurrentSettings")
        def setValue(cls, key: DefaultSettingsList.Key, value: Any) -> None:
            """
            Warning:
                .. deprecated:: 5.0.0
            """
            passedType = type(value)
            expectedType = type(cls.defaultValue(key))
            if passedType != expectedType:
                raise TypeError(f"Key type mismatch; expected {expectedType} but got {passedType} instead.")
            return ShadowSettings.set_value(key, value)

        @classmethod
        @_deprecated_by("axipy.DefaultSettings")
        def defaultValue(cls, key: DefaultSettingsList.Key) -> Any:
            """
            Warning:
                .. deprecated:: 5.0.0
            """
            return ShadowSettings.default_value(key)

        @classmethod
        @_deprecated_by("axipy.CurrentSettings.reset")
        def reset(cls, key: DefaultSettingsList.Key) -> None:
            """
            Warning:
                .. deprecated:: 5.0.0
            """
            ShadowSettings.set_value(key, ShadowSettings.default_value(key))

    globals().update(
        Settings=Settings,
    )


_apply_deprecated()
