from collections.abc import Iterable, Sequence from typing import Protocol from apps.catalog.application.dto import ServiceUnitNode, ServiceUnitSummary, WorkTypeOption class CatalogQueries(Protocol): """Public read interface of the catalog module. A row is selectable when it and every parent above it are active. """ def tree(self) -> Sequence[ServiceUnitNode]: """The whole hierarchy in order, inactive rows included (base data page).""" ... def active_service_units(self) -> Sequence[ServiceUnitSummary]: """Active service units in order, the shared unit included (``is_shared``).""" ... def work_type_options(self, service_unit_ids: Iterable[int]) -> Sequence[WorkTypeOption]: """Selectable work types of the given units plus those of the shared unit.""" ... def get_work_type(self, work_type_id: int) -> WorkTypeOption | None: """Any work type, also one no longer selectable (for showing stored rows).""" ...