from __future__ import annotations

from typing import TYPE_CHECKING

from .doc import RenderDoc
from .mixin_call import RenderDocCallMixin

if TYPE_CHECKING:
    import griffe as gf

    from .. import content


class __RenderDocFunction(RenderDocCallMixin, RenderDoc):
    """
    Render documentation for a function (`content.DocFunction`)
    """

    def __post_init__(self):
        super().__post_init__()
        # We narrow the type with a TypeAlias since we do not expect
        # any subclasses to have narrower types
        self.doc: content.DocFunction = self.doc
        self.obj: gf.Function = self.obj

        if self.subject_above_signature is None:
            self.subject_above_signature = True


class RenderDocFunction(__RenderDocFunction):
    """
    Extension point for the rendering of a `content.DocFunction` object
    """
