from collections.abc import Callable

from a2a.server.context import ServerCallContext


# Definition
OwnerResolver = Callable[[ServerCallContext | None], str]


# Example Default Implementation
def resolve_user_scope(context: ServerCallContext | None) -> str:
    """Resolves the owner scope based on the user in the context."""
    if not context:
        return 'unknown'
    # Example: Basic user name. Adapt as needed for your user model.
    return context.user.user_name
