# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .raw_client import AsyncRawTokensClient, RawTokensClient

if typing.TYPE_CHECKING:
    from .single_use.client import AsyncSingleUseClient, SingleUseClient


class TokensClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawTokensClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._single_use: typing.Optional[SingleUseClient] = None

    @property
    def with_raw_response(self) -> RawTokensClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawTokensClient
        """
        return self._raw_client

    @property
    def single_use(self):
        if self._single_use is None:
            from .single_use.client import SingleUseClient  # noqa: E402

            self._single_use = SingleUseClient(client_wrapper=self._client_wrapper)
        return self._single_use


class AsyncTokensClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawTokensClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._single_use: typing.Optional[AsyncSingleUseClient] = None

    @property
    def with_raw_response(self) -> AsyncRawTokensClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawTokensClient
        """
        return self._raw_client

    @property
    def single_use(self):
        if self._single_use is None:
            from .single_use.client import AsyncSingleUseClient  # noqa: E402

            self._single_use = AsyncSingleUseClient(client_wrapper=self._client_wrapper)
        return self._single_use
