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

import datetime as dt
import typing
from json.decoder import JSONDecodeError

from .......core.api_error import ApiError
from .......core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .......core.datetime_utils import serialize_datetime
from .......core.http_response import AsyncHttpResponse, HttpResponse
from .......core.jsonable_encoder import jsonable_encoder
from .......core.pydantic_utilities import parse_obj_as
from .......core.request_options import RequestOptions
from ....common.errors.not_found_error import NotFoundError
from ....common.errors.version_conflict_error import VersionConflictError
from ....common.types.error_base_4_xx import ErrorBase4Xx
from ....common.types.filter_query_string import FilterQueryString
from ....common.types.page_token import PageToken
from ....common.types.version_conflict_error_body import VersionConflictErrorBody
from .types.batch_eligibility_response import BatchEligibilityResponse
from .types.eligibility_check_page import EligibilityCheckPage
from .types.eligibility_recommendation import EligibilityRecommendation
from .types.eligibility_request import EligibilityRequest
from .types.eligibility_response import EligibilityResponse
from .types.payer_search_response import PayerSearchResponse
from .types.post_eligibility_recommendation_request import PostEligibilityRecommendationRequest
from .types.vote import Vote

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class RawV1Client:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._client_wrapper = client_wrapper

    def post(
        self, *, request: EligibilityRequest, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[EligibilityResponse]:
        """
        Sends real-time eligibility checks to payers through Stedi.

        Parameters
        ----------
        request : EligibilityRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[EligibilityResponse]
        """
        _response = self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="POST",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityResponse,
                parse_obj_as(
                    type_=EligibilityResponse,  # type: ignore
                    object_=_response_json,
                ),
            )
            return HttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def batch(
        self, *, request: typing.Sequence[EligibilityRequest], request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[BatchEligibilityResponse]:
        """
        Sends a batch of eligibility checks to payers through Stedi.

        Parameters
        ----------
        request : typing.Sequence[EligibilityRequest]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[BatchEligibilityResponse]
        """
        _response = self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/batch",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="POST",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                BatchEligibilityResponse,
                parse_obj_as(
                    type_=BatchEligibilityResponse,  # type: ignore
                    object_=_response_json,
                ),
            )
            return HttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def poll_batch(
        self,
        batch_id: str,
        *,
        page_token: typing.Optional[PageToken] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[EligibilityCheckPage]:
        """
        Polls the status of a batch eligibility check.

        Parameters
        ----------
        batch_id : str

        page_token : typing.Optional[PageToken]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[EligibilityCheckPage]
        """
        _response = self._client_wrapper.httpx_client.request(
            f"eligibility-checks/v1/batch/{jsonable_encoder(batch_id)}",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="GET",
            params={
                "page_token": page_token,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityCheckPage,
                parse_obj_as(
                    type_=EligibilityCheckPage,  # type: ignore
                    object_=_response_json,
                ),
            )
            return HttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def payer_search(
        self,
        *,
        page_size: typing.Optional[int] = None,
        page_token: typing.Optional[PageToken] = None,
        query: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[PayerSearchResponse]:
        """
        Searches for payers that match the query parameters.

        Parameters
        ----------
        page_size : typing.Optional[int]

        page_token : typing.Optional[PageToken]

        query : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[PayerSearchResponse]
        """
        _response = self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/payer/search",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="GET",
            params={
                "page_size": page_size,
                "page_token": page_token,
                "query": query,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                PayerSearchResponse,
                parse_obj_as(
                    type_=PayerSearchResponse,  # type: ignore
                    object_=_response_json,
                ),
            )
            return HttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def recommendation(
        self,
        *,
        filters: typing.Optional[FilterQueryString] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[typing.List[EligibilityRecommendation]]:
        """
        Gets recommendation for eligibility checks based on filters. This endpoint will retrieve all the latest eligibility recommendations for each
        eligibility recommendation type for the given filters. If you want to get a specific recommendation type, you can use the `type` query parameter.

        Parameters
        ----------
        filters : typing.Optional[FilterQueryString]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[typing.List[EligibilityRecommendation]]
        """
        _response = self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/recommendation",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="GET",
            params={
                "filters": filters,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                typing.List[EligibilityRecommendation],
                parse_obj_as(
                    type_=typing.List[EligibilityRecommendation],  # type: ignore
                    object_=_response_json,
                ),
            )
            return HttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def create_recommendation(
        self, *, request: PostEligibilityRecommendationRequest, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[EligibilityRecommendation]:
        """
        Create an eligibiilty recommendation based on the request.

        Parameters
        ----------
        request : PostEligibilityRecommendationRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[EligibilityRecommendation]
        """
        _response = self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/recommendation",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="POST",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityRecommendation,
                parse_obj_as(
                    type_=EligibilityRecommendation,  # type: ignore
                    object_=_response_json,
                ),
            )
            return HttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def vote_recommendation(
        self,
        recommendation_id: str,
        version: str,
        *,
        request: Vote,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[EligibilityRecommendation]:
        """
        Submit user feedback on an eligibility recommendation. The path must contain the next version number to prevent race conditions. For example, if the current version of the recommendation is n, you will need to send a request to this endpoint with `/{recommendation_id}/{n+1}/vote` to update the vote.

        Parameters
        ----------
        recommendation_id : str

        version : str

        request : Vote

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[EligibilityRecommendation]
        """
        _response = self._client_wrapper.httpx_client.request(
            f"eligibility-checks/v1/recommendation/{jsonable_encoder(recommendation_id)}/{jsonable_encoder(version)}/vote",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="PUT",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityRecommendation,
                parse_obj_as(
                    type_=EligibilityRecommendation,  # type: ignore
                    object_=_response_json,
                ),
            )
            return HttpResponse(response=_response, data=_data)
        if "errorName" in _response_json:
            if _response_json["errorName"] == "NotFoundError":
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        ErrorBase4Xx,
                        parse_obj_as(
                            type_=ErrorBase4Xx,  # type: ignore
                            object_=_response_json["content"],
                        ),
                    ),
                )
            if _response_json["errorName"] == "VersionConflictError":
                raise VersionConflictError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        VersionConflictErrorBody,
                        parse_obj_as(
                            type_=VersionConflictErrorBody,  # type: ignore
                            object_=_response_json["content"],
                        ),
                    ),
                )
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get_multi(
        self,
        *,
        page_token: typing.Optional[PageToken] = None,
        limit: typing.Optional[int] = None,
        subscriber_member_id: typing.Optional[str] = None,
        payer_id: typing.Optional[str] = None,
        provider_npi: typing.Optional[str] = None,
        date_of_service: typing.Optional[str] = None,
        initiated_at_min: typing.Optional[dt.datetime] = None,
        initiated_at_max: typing.Optional[dt.datetime] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[EligibilityCheckPage]:
        """
        Parameters
        ----------
        page_token : typing.Optional[PageToken]

        limit : typing.Optional[int]

        subscriber_member_id : typing.Optional[str]

        payer_id : typing.Optional[str]

        provider_npi : typing.Optional[str]

        date_of_service : typing.Optional[str]

        initiated_at_min : typing.Optional[dt.datetime]

        initiated_at_max : typing.Optional[dt.datetime]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[EligibilityCheckPage]
        """
        _response = self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/get-multi/",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="GET",
            params={
                "page_token": page_token,
                "limit": limit,
                "subscriber_member_id": subscriber_member_id,
                "payer_id": payer_id,
                "provider_npi": provider_npi,
                "date_of_service": date_of_service,
                "initiated_at_min": serialize_datetime(initiated_at_min) if initiated_at_min is not None else None,
                "initiated_at_max": serialize_datetime(initiated_at_max) if initiated_at_max is not None else None,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityCheckPage,
                parse_obj_as(
                    type_=EligibilityCheckPage,  # type: ignore
                    object_=_response_json,
                ),
            )
            return HttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)


class AsyncRawV1Client:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._client_wrapper = client_wrapper

    async def post(
        self, *, request: EligibilityRequest, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[EligibilityResponse]:
        """
        Sends real-time eligibility checks to payers through Stedi.

        Parameters
        ----------
        request : EligibilityRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[EligibilityResponse]
        """
        _response = await self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="POST",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityResponse,
                parse_obj_as(
                    type_=EligibilityResponse,  # type: ignore
                    object_=_response_json,
                ),
            )
            return AsyncHttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def batch(
        self, *, request: typing.Sequence[EligibilityRequest], request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[BatchEligibilityResponse]:
        """
        Sends a batch of eligibility checks to payers through Stedi.

        Parameters
        ----------
        request : typing.Sequence[EligibilityRequest]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[BatchEligibilityResponse]
        """
        _response = await self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/batch",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="POST",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                BatchEligibilityResponse,
                parse_obj_as(
                    type_=BatchEligibilityResponse,  # type: ignore
                    object_=_response_json,
                ),
            )
            return AsyncHttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def poll_batch(
        self,
        batch_id: str,
        *,
        page_token: typing.Optional[PageToken] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[EligibilityCheckPage]:
        """
        Polls the status of a batch eligibility check.

        Parameters
        ----------
        batch_id : str

        page_token : typing.Optional[PageToken]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[EligibilityCheckPage]
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"eligibility-checks/v1/batch/{jsonable_encoder(batch_id)}",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="GET",
            params={
                "page_token": page_token,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityCheckPage,
                parse_obj_as(
                    type_=EligibilityCheckPage,  # type: ignore
                    object_=_response_json,
                ),
            )
            return AsyncHttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def payer_search(
        self,
        *,
        page_size: typing.Optional[int] = None,
        page_token: typing.Optional[PageToken] = None,
        query: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[PayerSearchResponse]:
        """
        Searches for payers that match the query parameters.

        Parameters
        ----------
        page_size : typing.Optional[int]

        page_token : typing.Optional[PageToken]

        query : typing.Optional[str]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[PayerSearchResponse]
        """
        _response = await self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/payer/search",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="GET",
            params={
                "page_size": page_size,
                "page_token": page_token,
                "query": query,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                PayerSearchResponse,
                parse_obj_as(
                    type_=PayerSearchResponse,  # type: ignore
                    object_=_response_json,
                ),
            )
            return AsyncHttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def recommendation(
        self,
        *,
        filters: typing.Optional[FilterQueryString] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[typing.List[EligibilityRecommendation]]:
        """
        Gets recommendation for eligibility checks based on filters. This endpoint will retrieve all the latest eligibility recommendations for each
        eligibility recommendation type for the given filters. If you want to get a specific recommendation type, you can use the `type` query parameter.

        Parameters
        ----------
        filters : typing.Optional[FilterQueryString]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[typing.List[EligibilityRecommendation]]
        """
        _response = await self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/recommendation",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="GET",
            params={
                "filters": filters,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                typing.List[EligibilityRecommendation],
                parse_obj_as(
                    type_=typing.List[EligibilityRecommendation],  # type: ignore
                    object_=_response_json,
                ),
            )
            return AsyncHttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def create_recommendation(
        self, *, request: PostEligibilityRecommendationRequest, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[EligibilityRecommendation]:
        """
        Create an eligibiilty recommendation based on the request.

        Parameters
        ----------
        request : PostEligibilityRecommendationRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[EligibilityRecommendation]
        """
        _response = await self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/recommendation",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="POST",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityRecommendation,
                parse_obj_as(
                    type_=EligibilityRecommendation,  # type: ignore
                    object_=_response_json,
                ),
            )
            return AsyncHttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def vote_recommendation(
        self,
        recommendation_id: str,
        version: str,
        *,
        request: Vote,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[EligibilityRecommendation]:
        """
        Submit user feedback on an eligibility recommendation. The path must contain the next version number to prevent race conditions. For example, if the current version of the recommendation is n, you will need to send a request to this endpoint with `/{recommendation_id}/{n+1}/vote` to update the vote.

        Parameters
        ----------
        recommendation_id : str

        version : str

        request : Vote

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[EligibilityRecommendation]
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"eligibility-checks/v1/recommendation/{jsonable_encoder(recommendation_id)}/{jsonable_encoder(version)}/vote",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="PUT",
            json=request,
            request_options=request_options,
            omit=OMIT,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityRecommendation,
                parse_obj_as(
                    type_=EligibilityRecommendation,  # type: ignore
                    object_=_response_json,
                ),
            )
            return AsyncHttpResponse(response=_response, data=_data)
        if "errorName" in _response_json:
            if _response_json["errorName"] == "NotFoundError":
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        ErrorBase4Xx,
                        parse_obj_as(
                            type_=ErrorBase4Xx,  # type: ignore
                            object_=_response_json["content"],
                        ),
                    ),
                )
            if _response_json["errorName"] == "VersionConflictError":
                raise VersionConflictError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        VersionConflictErrorBody,
                        parse_obj_as(
                            type_=VersionConflictErrorBody,  # type: ignore
                            object_=_response_json["content"],
                        ),
                    ),
                )
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get_multi(
        self,
        *,
        page_token: typing.Optional[PageToken] = None,
        limit: typing.Optional[int] = None,
        subscriber_member_id: typing.Optional[str] = None,
        payer_id: typing.Optional[str] = None,
        provider_npi: typing.Optional[str] = None,
        date_of_service: typing.Optional[str] = None,
        initiated_at_min: typing.Optional[dt.datetime] = None,
        initiated_at_max: typing.Optional[dt.datetime] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[EligibilityCheckPage]:
        """
        Parameters
        ----------
        page_token : typing.Optional[PageToken]

        limit : typing.Optional[int]

        subscriber_member_id : typing.Optional[str]

        payer_id : typing.Optional[str]

        provider_npi : typing.Optional[str]

        date_of_service : typing.Optional[str]

        initiated_at_min : typing.Optional[dt.datetime]

        initiated_at_max : typing.Optional[dt.datetime]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[EligibilityCheckPage]
        """
        _response = await self._client_wrapper.httpx_client.request(
            "eligibility-checks/v1/get-multi/",
            base_url=self._client_wrapper.get_environment().pre_encounter,
            method="GET",
            params={
                "page_token": page_token,
                "limit": limit,
                "subscriber_member_id": subscriber_member_id,
                "payer_id": payer_id,
                "provider_npi": provider_npi,
                "date_of_service": date_of_service,
                "initiated_at_min": serialize_datetime(initiated_at_min) if initiated_at_min is not None else None,
                "initiated_at_max": serialize_datetime(initiated_at_max) if initiated_at_max is not None else None,
            },
            request_options=request_options,
        )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        if 200 <= _response.status_code < 300:
            _data = typing.cast(
                EligibilityCheckPage,
                parse_obj_as(
                    type_=EligibilityCheckPage,  # type: ignore
                    object_=_response_json,
                ),
            )
            return AsyncHttpResponse(response=_response, data=_data)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
