from typing import Protocol from apps.shared.domain.value_objects import EmailAddress from apps.users.domain.entities import UserAccount class UserRepository(Protocol): def get_by_id(self, user_id: int) -> UserAccount | None: ... def get_by_email(self, email: EmailAddress) -> UserAccount | None: ... def save(self, user: UserAccount) -> UserAccount: """Insert or update; a new user gets its id here.""" ... def is_email_taken(self, email: EmailAddress, *, exclude_id: int | None = None) -> bool: ... def lock_active_admin_count(self) -> int: """Lock the active admin rows for the transaction and return their number.""" ... def has_active_interns(self, supervisor_id: int) -> bool: ...