RobotPai / src /core /interfaces /message_repository.py
atr0p05's picture
Upload 291 files
8a682b5 verified
"""
Message repository interface defining the contract for message persistence.
"""
from abc import ABC, abstractmethod
from typing import List, Optional
from uuid import UUID
from src.core.entities.message import Message, MessageType
class MessageRepository(ABC):
"""
Abstract interface for message persistence operations.
"""
@abstractmethod
async def save(self, message: Message) -> Message:
pass
@abstractmethod
async def find_by_id(self, message_id: UUID) -> Optional[Message]:
pass
@abstractmethod
async def find_by_session(self, session_id: UUID) -> List[Message]:
pass
@abstractmethod
async def find_by_type(self, message_type: MessageType) -> List[Message]:
pass
@abstractmethod
async def delete(self, message_id: UUID) -> bool:
pass
@abstractmethod
async def get_statistics(self) -> dict:
pass