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

import typing

from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.request_options import RequestOptions
from ...types.list_test_numbers_response import ListTestNumbersResponse
from .raw_client import AsyncRawWhitelistedNumbersClient, RawWhitelistedNumbersClient
from .types.list_test_numbers_request_status import ListTestNumbersRequestStatus

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


class WhitelistedNumbersClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawWhitelistedNumbersClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawWhitelistedNumbersClient
        """
        return self._raw_client

    def list(
        self,
        *,
        page_index: typing.Optional[int] = OMIT,
        page_size: typing.Optional[int] = OMIT,
        agent_id: typing.Optional[str] = OMIT,
        number: typing.Optional[str] = OMIT,
        status: typing.Optional[ListTestNumbersRequestStatus] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListTestNumbersResponse:
        """
        List all whitelisted test numbers with optional filtering and pagination. Results are sorted by creation date, newest first.

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

        page_size : typing.Optional[int]

        agent_id : typing.Optional[str]
            Filter whitelisted numbers by agent ID (prefixed with 'agent_').

        number : typing.Optional[str]
            Filter by phone number in E.164 format.

        status : typing.Optional[ListTestNumbersRequestStatus]
            Filter by whitelist status.

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

        Returns
        -------
        ListTestNumbersResponse
            Returns paginated list of whitelisted numbers.

        Examples
        --------
        from rcs import Pinnacle

        client = Pinnacle(
            api_key="YOUR_API_KEY",
        )
        client.rcs.whitelisted_numbers.list()
        """
        _response = self._raw_client.list(
            page_index=page_index,
            page_size=page_size,
            agent_id=agent_id,
            number=number,
            status=status,
            request_options=request_options,
        )
        return _response.data


class AsyncWhitelistedNumbersClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawWhitelistedNumbersClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawWhitelistedNumbersClient
        """
        return self._raw_client

    async def list(
        self,
        *,
        page_index: typing.Optional[int] = OMIT,
        page_size: typing.Optional[int] = OMIT,
        agent_id: typing.Optional[str] = OMIT,
        number: typing.Optional[str] = OMIT,
        status: typing.Optional[ListTestNumbersRequestStatus] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListTestNumbersResponse:
        """
        List all whitelisted test numbers with optional filtering and pagination. Results are sorted by creation date, newest first.

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

        page_size : typing.Optional[int]

        agent_id : typing.Optional[str]
            Filter whitelisted numbers by agent ID (prefixed with 'agent_').

        number : typing.Optional[str]
            Filter by phone number in E.164 format.

        status : typing.Optional[ListTestNumbersRequestStatus]
            Filter by whitelist status.

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

        Returns
        -------
        ListTestNumbersResponse
            Returns paginated list of whitelisted numbers.

        Examples
        --------
        import asyncio

        from rcs import AsyncPinnacle

        client = AsyncPinnacle(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.rcs.whitelisted_numbers.list()


        asyncio.run(main())
        """
        _response = await self._raw_client.list(
            page_index=page_index,
            page_size=page_size,
            agent_id=agent_id,
            number=number,
            status=status,
            request_options=request_options,
        )
        return _response.data
