"""Repository protocol for User operations."""

from __future__ import annotations

from typing import TYPE_CHECKING, Protocol

if TYPE_CHECKING:
    from uuid import UUID

    from noteflow.domain.identity import User


class UserRepository(Protocol):
    """Repository protocol for User operations."""

    async def get(self, user_id: UUID) -> User | None:
        """Get user by ID.

        Args:
            user_id: User UUID.

        Returns:
            User if found, None otherwise.
        """
        ...

    async def get_by_email(self, email: str) -> User | None:
        """Get user by email address.

        Args:
            email: User email.

        Returns:
            User if found, None otherwise.
        """
        ...

    async def get_default(self) -> User | None:
        """Get the default local user.

        Returns:
            Default user if exists, None otherwise.
        """
        ...

    async def create(self, user: User) -> User:
        """Create a new user.

        Args:
            user: User to create.

        Returns:
            Created user.
        """
        ...

    async def create_default(
        self,
        user_id: UUID,
        display_name: str,
        email: str | None = None,
    ) -> User:
        """Create the default local user.

        Args:
            user_id: UUID for the new user.
            display_name: Display name for the user.
            email: Optional email address.

        Returns:
            Created default user.
        """
        ...

    async def update(self, user: User) -> User:
        """Update an existing user.

        Args:
            user: User with updated fields.

        Returns:
            Updated user.

        Raises:
            ValueError: If user does not exist.
        """
        ...

    async def delete(self, user_id: UUID) -> bool:
        """Delete a user.

        Args:
            user_id: User UUID.

        Returns:
            True if deleted, False if not found.
        """
        ...
