from __future__ import annotations

from typing import (
    Any,
    Dict,
    List,
    Optional,
    Protocol,
    Union,
)

from pydantic import AnyUrl


class MCPHostSession(Protocol):
    async def initialize(self) -> None: ...
    async def aclose(self) -> None: ...

    # ─── Tools ───────────────────────────────────────────────────────────
    async def list_tools(self, cursor: Optional[str] = None) -> Dict[str, Any]: ...
    async def call_tool(self, name: str, args: Optional[Dict[str, Any]]) -> Any: ...

    # ─── Templates ───────────────────────────────────────────────────────
    async def list_templates(self, cursor: Optional[str] = None) -> Dict[str, Any]: ...

    # ─── Resources ───────────────────────────────────────────────────────
    async def list_resources(self, cursor: Optional[str] = None) -> Dict[str, Any]: ...
    async def list_resource_templates(self, cursor: Optional[str] = None) -> Dict[str, Any]: ...
    async def read_resource(self, uri: AnyUrl) -> Union[str, bytes]: ...
    async def subscribe_resource(self, uri: AnyUrl) -> None: ...
    async def unsubscribe_resource(self, uri: AnyUrl) -> None: ...

    # ─── Prompts & Completions ─────────────────────────────────────────────
    async def list_prompts(self, cursor: Optional[str] = None) -> Dict[str, Any]: ...
    async def get_prompts(self, name: str, arguments: Optional[Dict[str, str]]) -> List[Any]: ...
    async def complete(self, ref: Any, argument: Dict[str, str]) -> Dict[str, Any]: ...
