74 lines
1.6 KiB
Python
74 lines
1.6 KiB
Python
"""Movie repository interfaces (abstract)."""
|
|
from abc import ABC, abstractmethod
|
|
from typing import List, Optional
|
|
|
|
from ..shared.value_objects import ImdbId
|
|
from .entities import Movie
|
|
|
|
|
|
class MovieRepository(ABC):
|
|
"""
|
|
Abstract repository for movie persistence.
|
|
|
|
This defines the interface that infrastructure implementations must follow.
|
|
"""
|
|
|
|
@abstractmethod
|
|
def save(self, movie: Movie) -> None:
|
|
"""
|
|
Save a movie to the repository.
|
|
|
|
Args:
|
|
movie: Movie entity to save
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_by_imdb_id(self, imdb_id: ImdbId) -> Optional[Movie]:
|
|
"""
|
|
Find a movie by its IMDb ID.
|
|
|
|
Args:
|
|
imdb_id: IMDb ID to search for
|
|
|
|
Returns:
|
|
Movie if found, None otherwise
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def find_all(self) -> List[Movie]:
|
|
"""
|
|
Get all movies in the repository.
|
|
|
|
Returns:
|
|
List of all movies
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete(self, imdb_id: ImdbId) -> bool:
|
|
"""
|
|
Delete a movie from the repository.
|
|
|
|
Args:
|
|
imdb_id: IMDb ID of the movie to delete
|
|
|
|
Returns:
|
|
True if deleted, False if not found
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def exists(self, imdb_id: ImdbId) -> bool:
|
|
"""
|
|
Check if a movie exists in the repository.
|
|
|
|
Args:
|
|
imdb_id: IMDb ID to check
|
|
|
|
Returns:
|
|
True if exists, False otherwise
|
|
"""
|
|
pass
|