""" Domain Layer - Interfaces (Ports) Defines contracts for infrastructure implementations. """ from abc import ABC, abstractmethod from typing import List, Optional from uuid import UUID from app.domain.entities import Document, DocumentChunk class IDocumentRepository(ABC): """Repository interface for document persistence""" @abstractmethod async def create(self, document: Document) -> Document: """Create new document""" pass @abstractmethod async def get_by_id(self, document_id: UUID) -> Optional[Document]: """Get document by ID""" pass @abstractmethod async def update(self, document: Document) -> Document: """Update document""" pass @abstractmethod async def list_by_department( self, department: str, skip: int = 0, limit: int = 100 ) -> List[Document]: """List documents by department""" pass @abstractmethod async def delete(self, document_id: UUID) -> bool: """Delete document""" pass class IChunkRepository(ABC): """Repository interface for document chunks""" @abstractmethod async def create_bulk(self, chunks: List[DocumentChunk]) -> List[DocumentChunk]: """Create multiple chunks""" pass @abstractmethod async def get_by_document_id(self, document_id: UUID) -> List[DocumentChunk]: """Get all chunks for a document""" pass @abstractmethod async def delete_by_document_id(self, document_id: UUID) -> int: """Delete all chunks for a document""" pass