from typing import Protocol

from mcp.server.auth.provider import AccessToken, RefreshToken
from mcp.shared.auth import OAuthClientInformationFull, OAuthToken

from mcp_tracker.mcp.oauth.types import YandexOauthAuthorizationCode, YandexOAuthState


class OAuthStore(Protocol):
    async def save_client(self, client: OAuthClientInformationFull) -> None: ...
    async def get_client(self, client_id: str) -> OAuthClientInformationFull | None: ...

    async def save_state(
        self, state: YandexOAuthState, *, state_id: str, ttl: int | None = None
    ) -> None: ...
    async def get_state(self, state_id: str) -> YandexOAuthState | None: ...

    async def save_auth_code(
        self, code: YandexOauthAuthorizationCode, *, ttl: int | None = None
    ) -> None: ...
    async def get_auth_code(
        self, code_id: str
    ) -> YandexOauthAuthorizationCode | None: ...

    async def save_oauth_token(
        self, token: OAuthToken, client_id: str, scopes: list[str], resource: str | None
    ) -> None: ...
    async def get_access_token(self, token: str) -> AccessToken | None: ...
    async def get_refresh_token(self, token: str) -> RefreshToken | None: ...

    async def revoke_refresh_token(self, token: str) -> None: ...
