"""Protocol definitions for result storage backends"""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/storage/protocols.ipynb.

# %% auto 0
__all__ = ['ResultStorageProtocol']

# %% ../../nbs/storage/protocols.ipynb 3
from typing import Protocol, Dict, Any, List, Optional, runtime_checkable
from pathlib import Path

# %% ../../nbs/storage/protocols.ipynb 5
@runtime_checkable
class ResultStorageProtocol(Protocol):
    """Protocol for transcription result storage backends."""

    def should_auto_save(self) -> bool:  # True if results should be automatically saved
        """Check if auto-save is enabled."""
        ...

    def save(
        self,
        job_id: str,  # Unique job identifier
        file_path: str,  # Path to the transcribed media file
        file_name: str,  # Name of the media file
        plugin_id: str,  # Plugin unique identifier
        plugin_name: str,  # Plugin display name
        text: str,  # The transcription text
        metadata: Optional[Dict[str, Any]] = None,  # Optional metadata from the transcription plugin
        additional_info: Optional[Dict[str, Any]] = None  # Optional additional information to store
    ) -> Any:  # Implementation-specific return value (e.g., Path for file storage, ID for database)
        """Save a transcription result."""
        ...

    def load(
        self,
        result_id: Any  # Implementation-specific identifier (e.g., Path for file storage, ID for database)
    ) -> Optional[Dict[str, Any]]:  # Result dictionary or None if not found
        """Load a transcription result by its identifier."""
        ...

    def list_results(
        self,
        sort_by: str = "timestamp",  # Field to sort by
        reverse: bool = True  # Sort in reverse order
    ) -> List[Dict[str, Any]]:  # List of result dictionaries
        """List all saved transcription results."""
        ...

    def get_by_job_id(
        self,
        job_id: str  # The job identifier to search for
    ) -> Optional[Dict[str, Any]]:  # Result dictionary if found, None otherwise
        """Find and load a transcription result by job ID."""
        ...

    def delete(
        self,
        result_id: Any  # Implementation-specific identifier
    ) -> bool:  # True if deletion successful, False otherwise
        """Delete a transcription result."""
        ...
