"""
用户仓储接口
"""

from abc import ABC, abstractmethod
from typing import Optional

from packages.domain.entities import User


class UserRepository(ABC):
    """用户仓储接口"""

    @abstractmethod
    def save(self, user: User) -> None:
        """保存用户"""
        pass

    @abstractmethod
    def find_by_id(self, user_id: str) -> Optional[User]:
        """根据 ID 查找用户"""
        pass

    @abstractmethod
    def find_by_email(self, email: str) -> Optional[User]:
        """根据邮箱查找用户"""
        pass

    @abstractmethod
    def find_by_username(self, username: str) -> Optional[User]:
        """根据用户名查找用户"""
        pass

    @abstractmethod
    def find_by_verification_token(self, token: str) -> Optional[User]:
        """根据邮箱验证令牌查找用户"""
        pass

    @abstractmethod
    def find_by_password_reset_token(self, token: str) -> Optional[User]:
        """根据密码重置令牌查找用户"""
        pass

    @abstractmethod
    def find_by_wechat_openid(self, openid: str) -> Optional[User]:
        """根据微信 openid 查找用户"""
        pass

    @abstractmethod
    def find_by_wechat_unionid(self, unionid: str) -> Optional[User]:
        """根据微信 unionid 查找用户"""
        pass

    @abstractmethod
    def delete(self, user_id: str) -> bool:
        """删除用户"""
        pass
