from collections.abc import Sequence from typing import Protocol from apps.customers.application.dto import ( BillingUnitView, ContactView, CustomerDetails, CustomerSummary, ) from apps.customers.domain.enums import CustomerType class CustomerQueries(Protocol): """Public read interface of the customers module.""" def list_customers( self, *, search: str = "", type: CustomerType | None = None ) -> Sequence[CustomerSummary]: """Search by name or business ID (never by personal identity code); internal first.""" ... def search(self, term: str, *, limit: int = 20) -> Sequence[CustomerSummary]: """Autocomplete for other modules (e.g. job intake).""" ... def get_summary(self, customer_id: int) -> CustomerSummary | None: ... def get_details( self, customer_id: int, *, include_full_personal_id: bool = False ) -> CustomerDetails | None: ... def contacts(self, customer_id: int) -> Sequence[ContactView]: ... def billing_units(self, customer_id: int) -> Sequence[BillingUnitView]: ... def is_deletable(self, customer_id: int) -> bool: """Not internal and nothing (contacts, billing units, jobs, sales …) refers to it.""" ...