"""Base repository interface for DDD.""" from abc import ABC, abstractmethod from typing import Generic, TypeVar from uuid import UUID from app.domain.entities.base import BaseEntity T = TypeVar("T", bound=BaseEntity) class Repository(ABC, Generic[T]): """Generic repository interface.""" @abstractmethod async def get_by_id(self, entity_id: UUID) -> T | None: """Get entity by ID.""" ... @abstractmethod async def get_all(self) -> list[T]: """Get all entities.""" ... @abstractmethod async def add(self, entity: T) -> None: """Add new entity.""" ... @abstractmethod async def update(self, entity: T) -> None: """Update existing entity.""" ... @abstractmethod async def delete(self, entity_id: UUID) -> None: """Delete entity by ID.""" ... @abstractmethod async def exists(self, entity_id: UUID) -> bool: """Check if entity exists.""" ...