"""Recipe repository port."""

from __future__ import annotations

from typing import List, Optional, Protocol

from packages.domain.recipe import Recipe, RecipeItem


class RecipeRepository(Protocol):
    """配方仓储接口"""

    def list_by_user(
        self,
        user_id: str,
        *,
        skip: int = 0,
        limit: int = 50,
    ) -> List[Recipe]: ...

    def get(self, recipe_id: str, user_id: str) -> Optional[Recipe]: ...

    def create(self, recipe: Recipe) -> Recipe: ...

    def update(self, recipe: Recipe) -> Recipe: ...

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

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

    def list_items(self, recipe_id: str) -> List[RecipeItem]: ...

    def create_items(self, items: List[RecipeItem]) -> List[RecipeItem]: ...

    def delete_items_by_recipe(self, recipe_id: str) -> int: ...
