# 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.schedule_cancel_result import ScheduleCancelResult
from .raw_client import AsyncRawScheduleClient, RawScheduleClient


class ScheduleClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawScheduleClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawScheduleClient
        """
        return self._raw_client

    def cancel(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> ScheduleCancelResult:
        """
        Cancel a scheduled message or blast. <br>

        Works for both individual scheduled messages and scheduled blasts. Use the `scheduleId` returned when the message or blast was scheduled.

        Parameters
        ----------
        id : str
            Unique identifier of the scheduled message. This identifier is a string that always begins with the prefix `msg_sched_`, for example: `msg_sched_1234567890`.

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

        Returns
        -------
        ScheduleCancelResult
            Successfully cancelled the scheduled message or blast.

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

        client = Pinnacle(
            api_key="YOUR_API_KEY",
        )
        client.messages.schedule.cancel(
            id="id",
        )
        """
        _response = self._raw_client.cancel(id, request_options=request_options)
        return _response.data


class AsyncScheduleClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawScheduleClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawScheduleClient
        """
        return self._raw_client

    async def cancel(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> ScheduleCancelResult:
        """
        Cancel a scheduled message or blast. <br>

        Works for both individual scheduled messages and scheduled blasts. Use the `scheduleId` returned when the message or blast was scheduled.

        Parameters
        ----------
        id : str
            Unique identifier of the scheduled message. This identifier is a string that always begins with the prefix `msg_sched_`, for example: `msg_sched_1234567890`.

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

        Returns
        -------
        ScheduleCancelResult
            Successfully cancelled the scheduled message or blast.

        Examples
        --------
        import asyncio

        from rcs import AsyncPinnacle

        client = AsyncPinnacle(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.messages.schedule.cancel(
                id="id",
            )


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