"""
Project 仓储接口
"""

from abc import ABC, abstractmethod
from typing import Optional

from packages.domain.entities import Project


class ProjectRepository(ABC):
    """Project 仓储接口"""

    @abstractmethod
    def save(self, project: Project) -> None:
        """保存项目"""
        pass

    @abstractmethod
    def find_by_id(self, project_id: str) -> Optional[Project]:
        """根据 ID 查找项目"""
        pass

    @abstractmethod
    def find_by_owner_user_id(self, owner_user_id: str) -> list[Project]:
        """根据所有者用户 ID 查找项目"""
        pass

    @abstractmethod
    def find_accessible_projects(self, user_id: str) -> list[Project]:
        """查找用户可访问的所有项目（自己拥有的 + 被共享的）"""
        pass

    @abstractmethod
    def count_by_owner(self, owner_user_id: str) -> int:
        """统计用户的项目数量"""
        pass

    @abstractmethod
    def delete(self, project_id: str) -> bool:
        """删除项目"""
        pass
