# 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.rcs import Rcs
from .raw_client import AsyncRawSendClient, RawSendClient
from .types.send_mms_response import SendMmsResponse
from .types.send_mms_schema_options import SendMmsSchemaOptions
from .types.send_rcs_response import SendRcsResponse
from .types.send_sms_response import SendSmsResponse
from .types.send_sms_schema_options import SendSmsSchemaOptions

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


class SendClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawSendClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawSendClient
        """
        return self._raw_client

    def sms(
        self,
        *,
        from_: str,
        text: str,
        to: str,
        options: typing.Optional[SendSmsSchemaOptions] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SendSmsResponse:
        """
        Send a SMS message immediately or schedule it for future delivery.

        Parameters
        ----------
        from_ : str
            Phone number that sends the message in E.164 format.

        text : str
            Message content.

        to : str
            Recipient's phone number in E.164 format.

        options : typing.Optional[SendSmsSchemaOptions]
            Additional settings to customize SMS delivery.

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

        Returns
        -------
        SendSmsResponse
            Successfully sent or scheduled the message. <br>

            Use our [/messages/:id](./get) endpoint to track your message.

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

        client = Pinnacle(
            api_key="YOUR_API_KEY",
        )
        client.messages.send.sms(
            from_="+14155164736",
            text="Hey! 😂",
            to="+14154746461",
        )
        """
        _response = self._raw_client.sms(
            from_=from_, text=text, to=to, options=options, request_options=request_options
        )
        return _response.data

    def mms(
        self,
        *,
        from_: str,
        media_urls: typing.Sequence[str],
        text: str,
        to: str,
        options: typing.Optional[SendMmsSchemaOptions] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SendMmsResponse:
        """
        Send a MMS immediately or schedule it for future delivery.

        Parameters
        ----------
        from_ : str
            Phone number you want to send the message from in E.164 format.

        media_urls : typing.Sequence[str]
            Media file URLs to send.<br>

             See [supported media types](https://app.pinnacle.sh/supported-file-types?type=MMS).

        text : str
            Message text to accompany the media.

        to : str
            Recipient's phone number in E.164 format.

        options : typing.Optional[SendMmsSchemaOptions]
            Control how your MMS is processed and delivered.

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

        Returns
        -------
        SendMmsResponse
            Successfully sent or scheduled the message. <br>

            Each message part can be tracked independently using its unique message ID. Use our [/messages/:id](./get) endpoint to track your messages.

        Examples
        --------
        from rcs import Pinnacle
        from rcs.messages.send import SendMmsSchemaOptions

        client = Pinnacle(
            api_key="YOUR_API_KEY",
        )
        client.messages.send.mms(
            from_="+14155164736",
            media_urls=[
                "https://fastly.picsum.photos/id/941/300/300.jpg?hmac=mDxM9PWSqRDjecwSCEpzU4bj35gqnG7yA25OL29uNv0"
            ],
            options=SendMmsSchemaOptions(
                multiple_messages=True,
                validate=True,
            ),
            text="Check out this image!",
            to="+14154746461",
        )
        """
        _response = self._raw_client.mms(
            from_=from_, media_urls=media_urls, text=text, to=to, options=options, request_options=request_options
        )
        return _response.data

    def rcs(self, *, request: Rcs, request_options: typing.Optional[RequestOptions] = None) -> SendRcsResponse:
        """
        Send a RCS message immediately or schedule it for future delivery. <br>

        Requires an active RCS agent and recipient devices that support RCS Business Messaging.

        Parameters
        ----------
        request : Rcs

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

        Returns
        -------
        SendRcsResponse
            Successfully sent or scheduled the message.

            Use our [/messages/:id](./get) endpoint to track your message.

        Examples
        --------
        from rcs import Pinnacle, RcsButtonContent_OpenUrl, RcsText

        client = Pinnacle(
            api_key="YOUR_API_KEY",
        )
        client.messages.send.rcs(
            request=RcsText(
                quick_replies=[
                    RcsButtonContent_OpenUrl(
                        payload="payload",
                        title="title",
                    )
                ],
                text="text",
                from_="from",
                to="to",
            ),
        )
        """
        _response = self._raw_client.rcs(request=request, request_options=request_options)
        return _response.data


class AsyncSendClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawSendClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawSendClient
        """
        return self._raw_client

    async def sms(
        self,
        *,
        from_: str,
        text: str,
        to: str,
        options: typing.Optional[SendSmsSchemaOptions] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SendSmsResponse:
        """
        Send a SMS message immediately or schedule it for future delivery.

        Parameters
        ----------
        from_ : str
            Phone number that sends the message in E.164 format.

        text : str
            Message content.

        to : str
            Recipient's phone number in E.164 format.

        options : typing.Optional[SendSmsSchemaOptions]
            Additional settings to customize SMS delivery.

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

        Returns
        -------
        SendSmsResponse
            Successfully sent or scheduled the message. <br>

            Use our [/messages/:id](./get) endpoint to track your message.

        Examples
        --------
        import asyncio

        from rcs import AsyncPinnacle

        client = AsyncPinnacle(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.messages.send.sms(
                from_="+14155164736",
                text="Hey! 😂",
                to="+14154746461",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.sms(
            from_=from_, text=text, to=to, options=options, request_options=request_options
        )
        return _response.data

    async def mms(
        self,
        *,
        from_: str,
        media_urls: typing.Sequence[str],
        text: str,
        to: str,
        options: typing.Optional[SendMmsSchemaOptions] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SendMmsResponse:
        """
        Send a MMS immediately or schedule it for future delivery.

        Parameters
        ----------
        from_ : str
            Phone number you want to send the message from in E.164 format.

        media_urls : typing.Sequence[str]
            Media file URLs to send.<br>

             See [supported media types](https://app.pinnacle.sh/supported-file-types?type=MMS).

        text : str
            Message text to accompany the media.

        to : str
            Recipient's phone number in E.164 format.

        options : typing.Optional[SendMmsSchemaOptions]
            Control how your MMS is processed and delivered.

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

        Returns
        -------
        SendMmsResponse
            Successfully sent or scheduled the message. <br>

            Each message part can be tracked independently using its unique message ID. Use our [/messages/:id](./get) endpoint to track your messages.

        Examples
        --------
        import asyncio

        from rcs import AsyncPinnacle
        from rcs.messages.send import SendMmsSchemaOptions

        client = AsyncPinnacle(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.messages.send.mms(
                from_="+14155164736",
                media_urls=[
                    "https://fastly.picsum.photos/id/941/300/300.jpg?hmac=mDxM9PWSqRDjecwSCEpzU4bj35gqnG7yA25OL29uNv0"
                ],
                options=SendMmsSchemaOptions(
                    multiple_messages=True,
                    validate=True,
                ),
                text="Check out this image!",
                to="+14154746461",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.mms(
            from_=from_, media_urls=media_urls, text=text, to=to, options=options, request_options=request_options
        )
        return _response.data

    async def rcs(self, *, request: Rcs, request_options: typing.Optional[RequestOptions] = None) -> SendRcsResponse:
        """
        Send a RCS message immediately or schedule it for future delivery. <br>

        Requires an active RCS agent and recipient devices that support RCS Business Messaging.

        Parameters
        ----------
        request : Rcs

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

        Returns
        -------
        SendRcsResponse
            Successfully sent or scheduled the message.

            Use our [/messages/:id](./get) endpoint to track your message.

        Examples
        --------
        import asyncio

        from rcs import AsyncPinnacle, RcsButtonContent_OpenUrl, RcsText

        client = AsyncPinnacle(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.messages.send.rcs(
                request=RcsText(
                    quick_replies=[
                        RcsButtonContent_OpenUrl(
                            payload="payload",
                            title="title",
                        )
                    ],
                    text="text",
                    from_="from",
                    to="to",
                ),
            )


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