# 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 AsyncRawStreamClient, RawStreamClient

if typing.TYPE_CHECKING:
    from .events.client import AsyncEventsClient, EventsClient


class StreamClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawStreamClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._events: typing.Optional[EventsClient] = None

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

        Returns
        -------
        RawStreamClient
        """
        return self._raw_client

    @property
    def events(self):
        if self._events is None:
            from .events.client import EventsClient  # noqa: E402

            self._events = EventsClient(client_wrapper=self._client_wrapper)
        return self._events


class AsyncStreamClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawStreamClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._events: typing.Optional[AsyncEventsClient] = None

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

        Returns
        -------
        AsyncRawStreamClient
        """
        return self._raw_client

    @property
    def events(self):
        if self._events is None:
            from .events.client import AsyncEventsClient  # noqa: E402

            self._events = AsyncEventsClient(client_wrapper=self._client_wrapper)
        return self._events
