"""Title library repository port."""

from __future__ import annotations

from typing import List, Optional, Protocol

from packages.domain.title_library import TitleLibraryItem


class TitleLibraryRepository(Protocol):
    """标题库仓储接口"""

    def list_by_user(
        self,
        user_id: str,
        *,
        category: Optional[str] = None,
        is_active: bool = True,
        skip: int = 0,
        limit: int = 50,
    ) -> List[TitleLibraryItem]: ...

    def get(self, title_id: str, user_id: str) -> Optional[TitleLibraryItem]: ...

    def create(self, item: TitleLibraryItem) -> TitleLibraryItem: ...

    def update(self, item: TitleLibraryItem) -> TitleLibraryItem: ...

    def delete(self, title_id: str, user_id: str) -> bool: ...

    def count_by_user(self, user_id: str, is_active: bool = True) -> int: ...
