"""Deep warnings of a parser module: each call passing a stacklevel above 2 or one heki cannot bound is a report.

A constant by keyword or by position, a module constant plus one, a call, a computed value, the package's own warning
function and a nested function are reports; a stacklevel of 2 or none is not, and neither is ``listed``, which the
records list, while the record of ``stale`` allows no call and is an error.
"""

import warnings
from warnings import warn

from datamodel_code_generator.deprecations import warn_deprecated

LEVEL = 2


def constant() -> None:
    warnings.warn("x", stacklevel=3)


def four() -> None:
    warn("x", UserWarning, stacklevel=4)


def call(depth: int) -> None:
    warnings.warn("x", stacklevel=max(depth, 3))


def computed(depth: int) -> None:
    warnings.warn("x", stacklevel=depth + 2)


def positional() -> None:
    warnings.warn("x", UserWarning, 3)


def deprecated() -> None:
    warn_deprecated("x", stacklevel=3)


def deprecated_call(depth: int) -> None:
    warn_deprecated("x", stacklevel=max(depth, 3))


def outer() -> None:
    def inner() -> None:
        warnings.warn("x", stacklevel=3)

    inner()


def module_constant() -> None:
    warnings.warn("x", stacklevel=LEVEL + 1)


def caller_level() -> None:
    warnings.warn("x", stacklevel=2)


def default_level() -> None:
    warnings.warn("x")


def listed() -> None:
    warnings.warn("x", stacklevel=3)


def stale() -> None:
    warnings.warn("x", stacklevel=2)
