"""Parser for HOL ``<ObjectType>`` elements in DMSContent responses."""
from ecmind_blue_client.ecm.parser._dms_content_object_type import DmsContentObjectType
from ecmind_blue_client.ecm.parser._dms_content_object_hol import DmsContentObjectHol


class DmsContentObjectTypeHol(DmsContentObjectType):
    """HOL-specific ``<ObjectType>`` that exposes its contents as ``<Object>`` elements."""

    def objects(self):
        """Yields all ``<Object>`` elements from ``<ObjectList>``.

        Yields:
            DmsContentObject: Parsed HOL objects.
        """
        nodes = self._node.findall("ObjectList/Object")
        for node in nodes:
            yield DmsContentObjectHol(node, self._archive)
