# 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 AsyncRawPreEncounterClient, RawPreEncounterClient

if typing.TYPE_CHECKING:
    from .resources.appointments.client import AppointmentsClient, AsyncAppointmentsClient
    from .resources.coverages.client import AsyncCoveragesClient, CoveragesClient
    from .resources.eligibility_checks.client import AsyncEligibilityChecksClient, EligibilityChecksClient
    from .resources.images.client import AsyncImagesClient, ImagesClient
    from .resources.lists.client import AsyncListsClient, ListsClient
    from .resources.notes.client import AsyncNotesClient, NotesClient
    from .resources.patients.client import AsyncPatientsClient, PatientsClient
    from .resources.tags.client import AsyncTagsClient, TagsClient


class PreEncounterClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawPreEncounterClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._appointments: typing.Optional[AppointmentsClient] = None
        self._coverages: typing.Optional[CoveragesClient] = None
        self._eligibility_checks: typing.Optional[EligibilityChecksClient] = None
        self._images: typing.Optional[ImagesClient] = None
        self._lists: typing.Optional[ListsClient] = None
        self._notes: typing.Optional[NotesClient] = None
        self._patients: typing.Optional[PatientsClient] = None
        self._tags: typing.Optional[TagsClient] = None

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

        Returns
        -------
        RawPreEncounterClient
        """
        return self._raw_client

    @property
    def appointments(self):
        if self._appointments is None:
            from .resources.appointments.client import AppointmentsClient  # noqa: E402

            self._appointments = AppointmentsClient(client_wrapper=self._client_wrapper)
        return self._appointments

    @property
    def coverages(self):
        if self._coverages is None:
            from .resources.coverages.client import CoveragesClient  # noqa: E402

            self._coverages = CoveragesClient(client_wrapper=self._client_wrapper)
        return self._coverages

    @property
    def eligibility_checks(self):
        if self._eligibility_checks is None:
            from .resources.eligibility_checks.client import EligibilityChecksClient  # noqa: E402

            self._eligibility_checks = EligibilityChecksClient(client_wrapper=self._client_wrapper)
        return self._eligibility_checks

    @property
    def images(self):
        if self._images is None:
            from .resources.images.client import ImagesClient  # noqa: E402

            self._images = ImagesClient(client_wrapper=self._client_wrapper)
        return self._images

    @property
    def lists(self):
        if self._lists is None:
            from .resources.lists.client import ListsClient  # noqa: E402

            self._lists = ListsClient(client_wrapper=self._client_wrapper)
        return self._lists

    @property
    def notes(self):
        if self._notes is None:
            from .resources.notes.client import NotesClient  # noqa: E402

            self._notes = NotesClient(client_wrapper=self._client_wrapper)
        return self._notes

    @property
    def patients(self):
        if self._patients is None:
            from .resources.patients.client import PatientsClient  # noqa: E402

            self._patients = PatientsClient(client_wrapper=self._client_wrapper)
        return self._patients

    @property
    def tags(self):
        if self._tags is None:
            from .resources.tags.client import TagsClient  # noqa: E402

            self._tags = TagsClient(client_wrapper=self._client_wrapper)
        return self._tags


class AsyncPreEncounterClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawPreEncounterClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._appointments: typing.Optional[AsyncAppointmentsClient] = None
        self._coverages: typing.Optional[AsyncCoveragesClient] = None
        self._eligibility_checks: typing.Optional[AsyncEligibilityChecksClient] = None
        self._images: typing.Optional[AsyncImagesClient] = None
        self._lists: typing.Optional[AsyncListsClient] = None
        self._notes: typing.Optional[AsyncNotesClient] = None
        self._patients: typing.Optional[AsyncPatientsClient] = None
        self._tags: typing.Optional[AsyncTagsClient] = None

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

        Returns
        -------
        AsyncRawPreEncounterClient
        """
        return self._raw_client

    @property
    def appointments(self):
        if self._appointments is None:
            from .resources.appointments.client import AsyncAppointmentsClient  # noqa: E402

            self._appointments = AsyncAppointmentsClient(client_wrapper=self._client_wrapper)
        return self._appointments

    @property
    def coverages(self):
        if self._coverages is None:
            from .resources.coverages.client import AsyncCoveragesClient  # noqa: E402

            self._coverages = AsyncCoveragesClient(client_wrapper=self._client_wrapper)
        return self._coverages

    @property
    def eligibility_checks(self):
        if self._eligibility_checks is None:
            from .resources.eligibility_checks.client import AsyncEligibilityChecksClient  # noqa: E402

            self._eligibility_checks = AsyncEligibilityChecksClient(client_wrapper=self._client_wrapper)
        return self._eligibility_checks

    @property
    def images(self):
        if self._images is None:
            from .resources.images.client import AsyncImagesClient  # noqa: E402

            self._images = AsyncImagesClient(client_wrapper=self._client_wrapper)
        return self._images

    @property
    def lists(self):
        if self._lists is None:
            from .resources.lists.client import AsyncListsClient  # noqa: E402

            self._lists = AsyncListsClient(client_wrapper=self._client_wrapper)
        return self._lists

    @property
    def notes(self):
        if self._notes is None:
            from .resources.notes.client import AsyncNotesClient  # noqa: E402

            self._notes = AsyncNotesClient(client_wrapper=self._client_wrapper)
        return self._notes

    @property
    def patients(self):
        if self._patients is None:
            from .resources.patients.client import AsyncPatientsClient  # noqa: E402

            self._patients = AsyncPatientsClient(client_wrapper=self._client_wrapper)
        return self._patients

    @property
    def tags(self):
        if self._tags is None:
            from .resources.tags.client import AsyncTagsClient  # noqa: E402

            self._tags = AsyncTagsClient(client_wrapper=self._client_wrapper)
        return self._tags
