# 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.get_whats_app_account_response import GetWhatsAppAccountResponse
from ...types.list_whats_app_accounts_response import ListWhatsAppAccountsResponse
from .raw_client import AsyncRawWhatsappAccountsClient, RawWhatsappAccountsClient

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


class WhatsappAccountsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawWhatsappAccountsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawWhatsappAccountsClient
        """
        return self._raw_client

    def get(
        self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetWhatsAppAccountResponse:
        """
        Get a WhatsApp account

        Parameters
        ----------
        phone_number_id : str

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

        Returns
        -------
        GetWhatsAppAccountResponse
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.whatsapp_accounts.get(
            phone_number_id="phone_number_id",
        )
        """
        _response = self._raw_client.get(phone_number_id, request_options=request_options)
        return _response.data

    def delete(self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
        """
        Delete a WhatsApp account

        Parameters
        ----------
        phone_number_id : str

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.whatsapp_accounts.delete(
            phone_number_id="phone_number_id",
        )
        """
        _response = self._raw_client.delete(phone_number_id, request_options=request_options)
        return _response.data

    def update(
        self,
        phone_number_id: str,
        *,
        assigned_agent_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Any:
        """
        Update a WhatsApp account

        Parameters
        ----------
        phone_number_id : str

        assigned_agent_id : typing.Optional[str]

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.whatsapp_accounts.update(
            phone_number_id="phone_number_id",
        )
        """
        _response = self._raw_client.update(
            phone_number_id, assigned_agent_id=assigned_agent_id, request_options=request_options
        )
        return _response.data

    def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListWhatsAppAccountsResponse:
        """
        List all WhatsApp accounts

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

        Returns
        -------
        ListWhatsAppAccountsResponse
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.whatsapp_accounts.list()
        """
        _response = self._raw_client.list(request_options=request_options)
        return _response.data


class AsyncWhatsappAccountsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawWhatsappAccountsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawWhatsappAccountsClient
        """
        return self._raw_client

    async def get(
        self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetWhatsAppAccountResponse:
        """
        Get a WhatsApp account

        Parameters
        ----------
        phone_number_id : str

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

        Returns
        -------
        GetWhatsAppAccountResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.whatsapp_accounts.get(
                phone_number_id="phone_number_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get(phone_number_id, request_options=request_options)
        return _response.data

    async def delete(
        self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Any:
        """
        Delete a WhatsApp account

        Parameters
        ----------
        phone_number_id : str

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.whatsapp_accounts.delete(
                phone_number_id="phone_number_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete(phone_number_id, request_options=request_options)
        return _response.data

    async def update(
        self,
        phone_number_id: str,
        *,
        assigned_agent_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Any:
        """
        Update a WhatsApp account

        Parameters
        ----------
        phone_number_id : str

        assigned_agent_id : typing.Optional[str]

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.whatsapp_accounts.update(
                phone_number_id="phone_number_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            phone_number_id, assigned_agent_id=assigned_agent_id, request_options=request_options
        )
        return _response.data

    async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListWhatsAppAccountsResponse:
        """
        List all WhatsApp accounts

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

        Returns
        -------
        ListWhatsAppAccountsResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.whatsapp_accounts.list()


        asyncio.run(main())
        """
        _response = await self._raw_client.list(request_options=request_options)
        return _response.data
