# 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 AsyncRawAnalyticsClient, RawAnalyticsClient

if typing.TYPE_CHECKING:
    from .requests.client import AsyncRequestsClient, RequestsClient


class AnalyticsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAnalyticsClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._requests: typing.Optional[RequestsClient] = None

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

        Returns
        -------
        RawAnalyticsClient
        """
        return self._raw_client

    @property
    def requests(self):
        if self._requests is None:
            from .requests.client import RequestsClient  # noqa: E402

            self._requests = RequestsClient(client_wrapper=self._client_wrapper)
        return self._requests


class AsyncAnalyticsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAnalyticsClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._requests: typing.Optional[AsyncRequestsClient] = None

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

        Returns
        -------
        AsyncRawAnalyticsClient
        """
        return self._raw_client

    @property
    def requests(self):
        if self._requests is None:
            from .requests.client import AsyncRequestsClient  # noqa: E402

            self._requests = AsyncRequestsClient(client_wrapper=self._client_wrapper)
        return self._requests
