from abc import abstractmethod
from typing import *

import setdoc
from datarepr import datarepr

from v440.abc.CoreABC import CoreABC

__all__ = ["NestedABC"]


class NestedABC(CoreABC):
    __slots__ = ()
    packaging: str
    string: str

    @setdoc.basic
    def __bool__(self: Self) -> bool:
        return any(map(bool, self._todict().values()))

    @setdoc.basic
    def __repr__(self: Self) -> str:
        return datarepr(type(self).__name__, **self._todict())

    @abstractmethod
    def _todict(self: Self) -> dict[str, Any]: ...

    packaging = CoreABC.string
