"""Entry point for building HOL DMSQuery XML."""
from ecmind_blue_client.ecm.builder._dms_query_builder import DmsQueryBuilder
from ecmind_blue_client.ecm.builder._dms_query_object_type_hol import (
    DmsQueryObjectTypeHol,
)


class DmsQueryBuilderHol(DmsQueryBuilder):
    """Builder for HOL (Hierarchical Object List) DMSQuery requests.

    Pre-sets ``requesttype`` to ``HOL``. Use this builder when you need hierarchical
    parent/child relationships in the result.
    """

    def __init__(self):
        super().__init__()
        self._node.attrib["requesttype"] = "HOL"

    def object_type(self, internal_name_or_type_id: str | int) -> DmsQueryObjectTypeHol:
        return DmsQueryObjectTypeHol(self._archive_node, internal_name_or_type_id)
