from __future__ import annotations

from typing import Protocol

from ebay_client.core.auth.models import OAuthToken


class TokenStore(Protocol):
    def get_token(self) -> OAuthToken | None:
        ...

    def set_token(self, token: OAuthToken) -> None:
        ...

    def clear(self) -> None:
        ...


class InMemoryTokenStore:
    def __init__(self) -> None:
        self._token: OAuthToken | None = None

    def get_token(self) -> OAuthToken | None:
        return self._token

    def set_token(self, token: OAuthToken) -> None:
        self._token = token

    def clear(self) -> None:
        self._token = None
