"""# Summary CRUD service wiring for the treatment aggregate via the hexa container. """ from hexa import build from domain.treatments.models import Treatment from domain.treatments.ports.db import TreatmentDocument from infra.adapters.service import CrudsServiceAdaptor class TreatmentCrudsService(CrudsServiceAdaptor[Treatment, TreatmentDocument]): """Treatment CRUD service resolving :class:`TreatmentDocument` from a repo. Notes: Instances are created by :func:`get_treatment_service`. The ``model`` and ``schema`` class attributes bind the domain model and its document. """ model = Treatment schema = TreatmentDocument def get_treatment_service(repo) -> TreatmentCrudsService: """Build a treatment CRUD service wired to ``repo``. Args: repo (Any): Integer-id treatment repository from :func:`create_treatment_repo`. Returns: TreatmentCrudsService: Ready-to-use treatment CRUD service. """ return build(TreatmentCrudsService, instances={"repo": repo})