# 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 AsyncRawWebhooksClient, RawWebhooksClient

if typing.TYPE_CHECKING:
    from .event_types.client import AsyncEventTypesClient, EventTypesClient
    from .subscriptions.client import AsyncSubscriptionsClient, SubscriptionsClient


class WebhooksClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawWebhooksClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._event_types: typing.Optional[EventTypesClient] = None
        self._subscriptions: typing.Optional[SubscriptionsClient] = None

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

        Returns
        -------
        RawWebhooksClient
        """
        return self._raw_client

    @property
    def event_types(self):
        if self._event_types is None:
            from .event_types.client import EventTypesClient  # noqa: E402

            self._event_types = EventTypesClient(client_wrapper=self._client_wrapper)
        return self._event_types

    @property
    def subscriptions(self):
        if self._subscriptions is None:
            from .subscriptions.client import SubscriptionsClient  # noqa: E402

            self._subscriptions = SubscriptionsClient(client_wrapper=self._client_wrapper)
        return self._subscriptions


class AsyncWebhooksClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawWebhooksClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._event_types: typing.Optional[AsyncEventTypesClient] = None
        self._subscriptions: typing.Optional[AsyncSubscriptionsClient] = None

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

        Returns
        -------
        AsyncRawWebhooksClient
        """
        return self._raw_client

    @property
    def event_types(self):
        if self._event_types is None:
            from .event_types.client import AsyncEventTypesClient  # noqa: E402

            self._event_types = AsyncEventTypesClient(client_wrapper=self._client_wrapper)
        return self._event_types

    @property
    def subscriptions(self):
        if self._subscriptions is None:
            from .subscriptions.client import AsyncSubscriptionsClient  # noqa: E402

            self._subscriptions = AsyncSubscriptionsClient(client_wrapper=self._client_wrapper)
        return self._subscriptions
